somonus / react-native-echarts

Echarts for react-native. The react-naitve chart.
MIT License
721 stars 309 forks source link

Android mi max 6.0.1 版本登录app后能正常显示,但是操作了app中的其他内容后,再回到报表显示页,柱状图处一片空白,而且不可点 #92

Open jichangshuai opened 6 years ago

jichangshuai commented 6 years ago

src/Echarts/index.js内容如下:

import React, { Component } from 'react'; import { WebView, View, StyleSheet, Platform } from 'react-native'; import renderChart from './renderChart'; import echarts from './echarts.min';

export default class App extends Component {

// 预防过渡渲染
shouldComponentUpdate(nextProps, nextState) {
    const thisProps = this.props || {}
    nextProps = nextProps || {}
    if (Object.keys(thisProps).length !== Object.keys(nextProps).length) {
        return true
    }
    for (const key in nextProps) {
        if (JSON.stringify(thisProps[key]) != JSON.stringify(nextProps[key])) {
            return true
        }
    }
    return false
}

componentWillReceiveProps(nextProps) { if(nextProps.option !== this.props.option) { // this.refs.chart.reload(); // 解决数据改变时页面闪烁的问题 this.refs.chart.injectJavaScript(renderChart(nextProps)) } }

render() { const source = (Platform.OS === 'ios') ? require('./tpl.html') : ({uri: 'file:///android_asset/tpl.html'}); const IOSFit = (Platform.OS === 'ios') ? false : true; 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: 'rgba(0,0,0,0)' }} scalesPageToFit={IOSFit} source={source} /> ); } }

jichangshuai commented 6 years ago

华为mate8目前也会出现此种情况

jichangshuai commented 6 years ago

这2中机型,都是初次进入的时候可以显示,当进行了OCR(拍照或者扫一扫)识别后,就不显示了,是拍照之后找不到模板了吗

xiehaol commented 6 years ago

@jichangshuai 你好 ,我这边也出现这种情况 ,请问你找到解决方法了吗