简体   繁体   中英

how to solve TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.allowFontScaling')

I upgraded expo and was using react-native-star-rating and I'm getting:

 ERROR  TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.allowFontScaling')
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

I saw something about a patch to this but I dont know how I do this

Just go to node_modules/react-native-button/Button.js

and add

import {TextPropTypes} from 'deprecated-react-native-prop-types'

Change 'static propTypes' to

static propTypes = {
...
allowFontScaling: TextPropTypes.allowFontScaling,
...
style: TextPropTypes.style
styleDisabled: TextPropTypes.style,
...
};

Obviously, you will have to npm install deprecated-react-native-prop-types first then do the above stated things. Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM