react-native-echarts
react-native-echarts copied to clipboard
Android的图表不显示
Android的图表不显示
react native 安卓模拟器无法显示+1, iOS模拟器正常
不显示+1
我之前使用android studio 的默认模拟器也不显示,后来使用genymotion模拟器或者真机可以
通常是android release下不显示,按照下面方式操作就可以了
1.根目录下找到目录node_modules\native-echarts\src\components\Echarts
将tpl.html文件copy到根目录下的android\app\src\main\assets下
2.修改node_modules\native-echarts\src\components\Echarts目录下的index.js文件(加粗部分)
render() { return ( <View style={{flex: 1, height: this.props.height || 400,}}> <WebView ref="chart" scrollEnabled = {false} injectedJavaScript = {renderChart(this.props)} style={{ height: this.props.height || 400, }} source={{uri:'file:///android_asset/tpl.html'}} /> </View> ); }