美文网首页
React-Native:安卓使用echart组件的时候不显示折

React-Native:安卓使用echart组件的时候不显示折

作者: 終于 | 来源:发表于2017-11-20 11:44 被阅读0次

某个项目组用React-Native开发,最近过去帮着写业务,做曲线图的时候去网上找的Echart组件,在iOS里面运行没问题,但是在安卓上面运行没有折线图和饼图,解决办法是:

到以下目录下的index.js修改资源路径:

./node_modules/native-echarts/src/components/Echarts/index.js

1.添加引入

import { WebView, View, StyleSheet } from 'react-native';

改为

import { WebView, View, StyleSheet, Platform } from 'react-native';


2.设置新路径,添加一下路径常量:

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

3.修改source路径:

source={require('./tpl.html')}

改为

source={source}

参考链接:

https://github.com/somonus/react-native-echarts/issues/12

相关文章

网友评论

      本文标题:React-Native:安卓使用echart组件的时候不显示折

      本文链接:https://www.haomeiwen.com/subject/roxvvxtx.html