ReactNative 升级总结
ReactNative 从0.53升级到0.63 iOS项目总结
1.
ERROR Invariant Violation: ART has been removed from React Native. It can now be installed and imported from '@react-native-community/art' instead of 'react-native'. See https://github.com/react-native-community/art
新版ART使用方法改变
yarn add @react-native-community/art
or
npm install --save @react-native-community/art
引用方法
import {ART} from 'react-native';
const {Surface, Shape} = ART;
改为
import { Surface, Shape, Path } from "@react-native-community/art";
9.
Invariant Violation: ListView has been removed from React Native. See https://fb.me/nolistview for more information or use deprecated-react-native-listview
.
10.
Unrecognized font family 'icomoon'
Unrecognized font family 'icon'
资源引用问题
1.打开react-native-vector-icons插件目录确认Fonts文件夹里面字体,是否拥有icomoon.ttf,icon.ttf。没有复制进去,如果有确认Xocde项目里是否导入,没有的话删除原有引用,重新导入
2.确认Images.xcassets
里面引用
3.编辑Info.plist并添加一个名为Fonts的属性
11.
ERROR AnimatedValue: Attempting to set value to undefined
使用中应该
new Animated.Value() =>new Animated.Value(0)
12.
Echarts图表不显示
因为RN移除WebView组件,Echarts引用没有移除所以修改
Echarts 在模块的路径下:node_modules /native-echarts/src / components/Echarts的index.js文件中修改成如下:
import { WebView } from 'react-native-webview';
Js在WebView交互不显示
因为在'react-native-webview插件中 onmessage 参数修改。
Webview调用时调用的函数window.ReactNativeWebView.postMessage。
window.ReactNativeWebView.postMessage接受一个参数,data该参数将在事件对象上可用event.nativeEvent.data。data必须是一个字符串。
13.
'react-native-root-toast'
弹窗没反应
1.引用新插件 react-native-root-siblings
2.在App.js 界面加入代码
import { RootSiblingParent } from 'react-native-root-siblings';
return (
);
14.
warring animated: useNativeDriver was not specified
useNativeDriver: true //
15.
ERROR currentlyFocusedField is deprecated and will be removed in a future release. Use currentlyFocusedInput
node_modules/@react-navigation/native/lib/module/createKeyboardAwareNavigator.js
currentlyFocusedField 替换成。currentlyFocusedInput
16.
'MOBFoundation/MOBFDataModel.h' file not found
在Framework Search Paths
"${PODS_ROOT}/MOBFoundation/MOBFoundation"
framework not found BDPCAID
"${PODS_ROOT}/BaiduMobStatCodeless/BaiduMobStatCodeless"