【问题标题】:how to solve TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.allowFontScaling')如何解决 TypeError: undefined is not an object (evaluating \'_reactNative.Text.propTypes.allowFontScaling\')
【发布时间】:2022-11-19 03:06:28
【问题描述】:

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

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

【问题讨论】:

    标签: react-native expo


    【解决方案1】:

    只需转到 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 install deprecated-react-native-prop-types 然后执行上述操作。希望能帮助到你

    【讨论】:

      猜你喜欢
      • 2022-12-21
      • 2023-02-18
      • 2022-12-03
      • 2019-11-02
      • 2020-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多