From 17dd39e0ddf8b6f50feaaa7d13ac8cde345c5e91 Mon Sep 17 00:00:00 2001 From: Mar-er <243958407@qq.com> Date: Fri, 12 Apr 2019 16:30:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=B7=B1=E6=AF=94=E8=BE=83?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=87=8D=E6=96=B0=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/components/Echarts/index.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f2f97eb..6ebe63d 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ }, "homepage": "https://github.com/somonus/react-native-echarts#readme", "dependencies": { - "echarts": "3.2.3" + "echarts": "3.2.3", + "ramda": "^0.26.1" } } diff --git a/src/components/Echarts/index.js b/src/components/Echarts/index.js index c4e1e9a..caa6d89 100644 --- a/src/components/Echarts/index.js +++ b/src/components/Echarts/index.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { WebView, View, StyleSheet, Platform } from 'react-native'; +import { equals } from 'ramda'; import renderChart from './renderChart'; import echarts from './echarts.min'; @@ -12,7 +13,10 @@ export default class App extends Component { componentWillReceiveProps(nextProps) { - if(nextProps.option !== this.props.option) { + // if(nextProps.option !== this.props.option) { + // this.refs.chart.reload(); + // } + if(!equals(nextProps.option, this.props.option)) { this.refs.chart.reload(); } }