Skip to content

Commit 1b7e249

Browse files
committed
add shouldupdate detect
1 parent ddec3ff commit 1b7e249

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export default class PickerAny extends React.Component {
5858
this.setState(newState);
5959
}
6060

61+
shouldComponentUpdate(props, state, context){
62+
return JSON.stringify([props, state, context]) !== JSON.stringify([this.props, this.state, this.context]);
63+
}
64+
6165
_getStateFromProps(props){
6266
//the pickedValue must looks like [wheelone's, wheeltwo's, ...]
6367
//this.state.selectedValue may be the result of the first pickerWheel

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-picker",
3-
"version": "0.2.8",
3+
"version": "0.2.9",
44
"description": "react-native-picker",
55
"main": "index.js",
66
"scripts": {
@@ -19,7 +19,7 @@
1919
"email": "[email protected]"
2020
},
2121
"dependencies": {
22-
"react-native-picker-android": "~0.3.4"
22+
"react-native-picker-android": "~0.3.5"
2323
},
2424
"engines": {
2525
"node": ">=4"

0 commit comments

Comments
 (0)