react-native-echarts 安卓版打包后,部分手机图表不显示问题

1. 找到  node_modules\native-echarts\src\components\Echarts\tpl.html 文件 ,把它复制到 (android\app\src\main\assets) 目录下

tpl.html 加上

<meta name="viewport" content="width=device-width, initial-scale=1">

2. 修改 node_modules\native-echarts\src\components\Echarts\index.js    

  

source={require('./tpl.html')}
修改为:
source={Platform.OS==='ios' ? require('./tpl.html'):{uri:'file:///android_asset/tpl.html'}}
import { WebView, View, StyleSheet } from 'react-native';
修改为:
import { WebView, View, StyleSheet, Platform } from 'react-native';

猜你喜欢

转载自www.cnblogs.com/bruce-gou/p/9271969.html
今日推荐