1)安装后居然echarts不显示,但是在模拟器中是显示的,也是从网上找的
1.1)复制文件tpl.html(路径: node_modules\native-echarts\src\components\Echarts)至android\app\src\main\assets目录下
有时候main下如果没有assets文件夹,则需要自己建一个
1.2)修改 node_modules/native-echarts/src/components/Echarts/index.js文件
第二行改成
import { WebView, View, StyleSheet,Platform } from 'react-native';
把WebView中的source={require('./tpl.html')} 改成下面的,需要加Platform
source={Platform.OS==='ios' ? require('./tpl.html'):{uri:'file:///android_asset/tpl.html'}}
本文介绍了解决ECharts在React Native环境下不显示的方法,包括将tpl.html文件复制到特定目录及修改Echarts组件源码,确保跨平台正确加载。

2514

被折叠的 条评论
为什么被折叠?



