2021-05-12

关于ReactNative版本升级问题(持续更新)

从0.59.10版本到现在的0.63.4版本遇到的问题:

1.一直白屏,没有渲染App.js代码

Invariant Violation: "XXX" 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.

具体找到是 ViewPagerAndroid库,已经被移除,使用第三方库

Invariant Violation: ViewPagerAndroid has been removed from React Native. It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. See https://github.com/react-native-community/react-native-viewpager

2.console.assert if not a function

因为用了以下代码,增加assert:() => {}函数即可

ISDEBU || (()=>{

    window.console={

        info: () => {},

        log: () => {},

        warn: () => {},

        debug: () => {},

        error: () => {},

        assert:() => {}

    };

})()

3  componentWillMount 替换成 UNSAFE_componentWillMount

componentWillReceiveProps替换成UNSAFE_componentWillReceiveProps

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容