native-echarts入坑

一.  集成native-echarts

输入命令: npm install native-echarts --save 

二. 问题

1. webview提示错误

 Invariant Violation: WebView has been removed from React Native. It can ...

因为webview已经不在react-native 库中了,需要安装react-native-webview 库。并将native-echarts中的index.js引用的webview修改成react-native-webview 

2. 显示的时候,android显示了html的乱码问题

找到native-echarts/src/components/Echarts/tpl.html文件,复制到android/app/src/main/assets这个目录下面,如果文件夹不存在就新建一个即可。

修改native-echarts中的index.js文件:

source={Platform.OS === 'ios' ? require('./tpl.html') : {uri: 'file:///android_asset/tpl.html'}}

参考博客:https://blog.csdn.net/weixin_44187730/article/details/86489233

原文地址:https://www.cnblogs.com/Ayinger/p/13571593.html