关于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