From 1b7e249c2e70f133b925f501b6ce91e2a2b8c076 Mon Sep 17 00:00:00 2001 From: xwenliang Date: Wed, 6 Jan 2016 01:14:46 +0800 Subject: [PATCH] add shouldupdate detect --- index.js | 4 ++++ package.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 3605f88..98397b3 100644 --- a/index.js +++ b/index.js @@ -58,6 +58,10 @@ export default class PickerAny extends React.Component { this.setState(newState); } + shouldComponentUpdate(props, state, context){ + return JSON.stringify([props, state, context]) !== JSON.stringify([this.props, this.state, this.context]); + } + _getStateFromProps(props){ //the pickedValue must looks like [wheelone's, wheeltwo's, ...] //this.state.selectedValue may be the result of the first pickerWheel diff --git a/package.json b/package.json index 62b17cc..ce94eab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-picker", - "version": "0.2.8", + "version": "0.2.9", "description": "react-native-picker", "main": "index.js", "scripts": { @@ -19,7 +19,7 @@ "email": "wenliang.web@gmail.com" }, "dependencies": { - "react-native-picker-android": "~0.3.4" + "react-native-picker-android": "~0.3.5" }, "engines": { "node": ">=4" -- 2.26.2