importReact, { Component }from'react';
import{ WebView, View, StyleSheet,Platform? }from'react-native';
importrenderChartfrom'./renderChart';
importechartsfrom'./echarts.min';
exportdefaultclassAppextendsComponent{
? ? componentWillReceiveProps(nextProps) {
if(nextProps.option !==this.props.option) {
this.refs.chart.reload();
? ? ? ? }
? ? }
? ? render() {
letscalesPageToFitValue;
Platform.OS ==='ios'? (scalesPageToFitValue =false) : (scalesPageToFitValue =true)
letsource = (Platform.OS ==='ios') ?require('./tpl.html'): {'uri':'file:///android_asset/tpl.html'}
return(
ref="chart"
scrollEnabled={false}
injectedJavaScript={renderChart(this.props)}
style={{
height:this.props.height||400,
backgroundColor:this.props.backgroundColor|| 'transparent'
? ? ? ? ? ? ? ? ? ? }}
scalesPageToFit={scalesPageToFitValue}
source={source}
onMessage={event=> this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
? ? ? ? ? ? ? ? />
? ? ? ? );
? ? }
}