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(); } }