native-echarts 禁止滚动

2018-10-25  本文已影响0人  精灵神帝

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}

                />

        );

    }

}

上一篇下一篇

猜你喜欢

热点阅读