美文网首页
Navigator过期导致的问题

Navigator过期导致的问题

作者: Mark_Guan | 来源:发表于2018-03-04 18:43 被阅读159次

    在新版的RN中,因为Navigator已经不再react-native这个库中了,如果继续从该库中导入,系统会直接给我们抛出一个错误,如下图:

    提示我们Navigator已经过期,我们可以从react-native-deprecated-custom-components 库中导入.

    根据提示我们执行:

    npm install react-native-deprecated-custom-components --save
    

    然后在项目中我们直接导入Navigator:

    import {Navigator} from 'react-native-deprecated-custom-components'
    

    但是一运行之后系统仍然给我抛了一个错误:

    React-Native – undefined is not an object (“evaluating _react3.default.PropTypes.shape”)]

    解决方法:从stackoverflow找到了一种解决方法,这里贴出来方便以后查看:

    it seems like they haven't updated their npm package but their github branch has the proptypes changes,

    Uninstall the already installed react-native-deprecated-custom-components like below.

    npm uninstall --save react-native-deprecated-custom-components
    

    After that install it as follows.

    npm install --save https://github.com/facebookarchive/react-native-custom-components.git
    

    相关文章

      网友评论

          本文标题:Navigator过期导致的问题

          本文链接:https://www.haomeiwen.com/subject/pfdqfftx.html