繁体   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')

我升级了 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.

我看到了一些关于这个补丁的东西,但我不知道我是怎么做到的

只需 go 到 node_modules/react-native-button/Button.js

并添加

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

'static propTypes'更改为

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

显然,您必须先 npm 安装 deprecated-react-native-prop-types 然后执行上述操作。 希望能帮助到你

暂无
暂无

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

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