Merge 72effbe06a into 9ee6a04c9d
This commit is contained in:
commit
d8292ce728
|
|
@ -1,9 +1,19 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { WebView, View, StyleSheet } from 'react-native';
|
import { WebView, View, StyleSheet, Platform } from 'react-native';
|
||||||
import renderChart from './renderChart';
|
import renderChart from './renderChart';
|
||||||
import echarts from './echarts.min';
|
import echarts from './echarts.min';
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
export default class App extends Component {
|
export default class App extends Component {
|
||||||
|
static propTypes = {
|
||||||
|
...WebView.propTypes,
|
||||||
|
option: PropTypes.object.isRequired,
|
||||||
|
width: PropTypes.number,
|
||||||
|
height: PropTypes.number,
|
||||||
|
backgroundColor: PropTypes.string,
|
||||||
|
onPress: PropTypes.func,
|
||||||
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if(nextProps.option !== this.props.option) {
|
if(nextProps.option !== this.props.option) {
|
||||||
this.refs.chart.reload();
|
this.refs.chart.reload();
|
||||||
|
|
@ -22,8 +32,9 @@ export default class App extends Component {
|
||||||
backgroundColor: this.props.backgroundColor || 'transparent'
|
backgroundColor: this.props.backgroundColor || 'transparent'
|
||||||
}}
|
}}
|
||||||
scalesPageToFit={false}
|
scalesPageToFit={false}
|
||||||
source={require('./tpl.html')}
|
source={(Platform.OS == 'ios') ? require('./tpl.html') : {uri:'file:///android_asset/tpl.html'}}
|
||||||
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
|
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
|
||||||
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue