使用深比较避免重新渲染
This commit is contained in:
parent
d7340b8e78
commit
17dd39e0dd
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue