UNPKG

react-native-echarts-cus

Version:

echarts4.2的图表,实现echarts的各种图表, 本组件使用百度的echarts4.2 使用方法遵循native-echarts

32 lines (29 loc) 1 kB
import React, { Component } from 'react'; import { WebView, View, StyleSheet } from 'react-native'; import renderChart from './renderChart'; import echarts from './echarts.min'; export default class App extends Component { componentWillReceiveProps(nextProps) { /*if(nextProps.option !== this.props.option) { this.refs.chart.reload(); }*/ } 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, backgroundColor: this.props.backgroundColor || 'transparent' }} scalesPageToFit={false} source={require('./tpl.html')} onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null} /> </View> ); } }