简体   繁体   English

如何解决 TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.allowFontScaling')

[英]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:我升级了 expo 并使用了 react-native-star-rating 并且我得到:

 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只需 go 到 node_modules/react-native-button/Button.js

and add并添加

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

Change 'static propTypes' to'static propTypes'更改为

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.显然,您必须先 npm 安装 deprecated-react-native-prop-types 然后执行上述操作。 Hope it helps希望能帮助到你

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError: undefined is not an object(评估'_reactNative.Animated.Text.propTypes.style') - TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style') React Native TypeError: undefined is not an object (evalating '_reactNative.Animated.Text.propTypes.style') 在 iOS 模拟器 - React Native TypeError: undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style') in iOS simulator TypeError: undefined is not an object(评估'_reactNative.Image.propTypes.resizeMode') - TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.resizeMode') undefined 不是一个对象(评估'_reactNative.Animated.Text.propTypes.style') - undefined is not an object (evaluating '_reactNative.Animated.Text.propTypes.style') react-native-in-app-notification 错误类型错误:未定义不是 object(评估“_reactNative.Image.propTypes.source”) - react-native-in-app-notification ERROR TypeError: undefined is not an object (evaluating '_reactNative.Image.propTypes.source') React Native,未定义不是 object(评估 '_reactNative.Image.propTypes.resizeMode') - React Native, undefined is not an object (evaluating ‘_reactNative.Image.propTypes.resizeMode’) undefined 不是对象(评估'_reactNative.PropTypes.string')错误 - undefined is not an object (evaluating '_reactNative.PropTypes.string') Error 在将本机版本更新到 0.59.4 后,undefined 不是评估 (_reactnative.Modal.propTypes.animationType) 的对象 - undefined is not an object evaluating (_reactnative.Modal.propTypes.animationType) after updating react native version to 0.59.4 React Native AdMob 错误:undefined 不是对象(评估“_reactNative.View.propTypes.style”) - React Native AdMob Error: undefined is not an object (evaluating '_reactNative.View.propTypes.style') 如何解决:TypeError: undefined is not an object(评估'navigation.navigate') - How to solve: TypeError: undefined is not an object (evaluating 'navigation.navigate')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM