Commit 66d131fc authored by xwenliang's avatar xwenliang

add shouldComponentUpdate

parent 79f13530
...@@ -58,18 +58,12 @@ export default class PickerAny extends React.Component { ...@@ -58,18 +58,12 @@ export default class PickerAny extends React.Component {
this.setState(newState); this.setState(newState);
} }
//todo shouldComponentUpdate(nextProps, nextState, context){
/*shouldComponentUpdate(props, state, context){ if(JSON.stringify(nextState.selectedValue) === JSON.stringify(this.state.selectedValue)){
let newProps = Object.assign({}, props); return false;
let newState = Object.assign({}, state);
let oldProps = Object.assign({}, this.props);
let oldState = Object.assign({}, this.state);
let arr = [newProps, newState, oldProps, oldState];
for(let i in arr){
delete arr[i].slideAnim;
} }
return JSON.stringify([newProps, newState, context]) !== JSON.stringify([oldProps, oldState, this.context]); return true;
}*/ }
_getStateFromProps(props){ _getStateFromProps(props){
//the pickedValue must looks like [wheelone's, wheeltwo's, ...] //the pickedValue must looks like [wheelone's, wheeltwo's, ...]
......
{ {
"name": "react-native-picker", "name": "react-native-picker",
"version": "0.2.11", "version": "0.3.0",
"description": "react-native-picker", "description": "react-native-picker",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment