From 1f20b69f2ae3cc660c52453bef3bfef837822838 Mon Sep 17 00:00:00 2001 From: xwenliang Date: Wed, 20 Jan 2016 19:34:11 +0800 Subject: [PATCH] v0.3.5 --- index.js | 16 +++++++++++----- package.json | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 49cba1ed9..bab68c3e0 100644 --- a/index.js +++ b/index.js @@ -110,7 +110,7 @@ export default class PickerAny extends React.Component { cascadeData = this._getCascadeData(pickerData, selectedValue, firstPickedData, secondPickedData, true); } //save picked data - this.pickedValue = selectedValue; + this.pickedValue = JSON.parse(JSON.stringify(selectedValue)); this.pickerStyle = pickerStyle; return { pickerBtnText, @@ -217,8 +217,12 @@ export default class PickerAny extends React.Component { selectedValue={me.state.selectedValue[index]} onValueChange={value => { me.pickedValue.splice(index, 1, value); + //do not set state to another object!! why? + // me.setState({ + // selectedValue: me.pickedValue + // }); me.setState({ - selectedValue: me.pickedValue + selectedValue: JSON.parse(JSON.stringify(me.pickedValue)) }); }} > {item.map((value, index) => ( @@ -303,7 +307,8 @@ export default class PickerAny extends React.Component { //on ios platform 'this' refers to Picker? me.pickedValue.splice(2, 1, me.state.thirdWheelData[index]); me.setState({ - thirdPickedDataIndex: index + thirdPickedDataIndex: index, + selectedValue: 'wheel3'+index }); }} > {me.state.thirdWheelData.map((value, index) => ( @@ -336,7 +341,7 @@ export default class PickerAny extends React.Component { } me.setState({ - selectedValue: value, + selectedValue: 'wheel1'+value, firstPickedData: value, secondWheelData: cascadeData.secondWheelData, secondPickedDataIndex: 0, @@ -371,7 +376,8 @@ export default class PickerAny extends React.Component { me.setState({ secondPickedDataIndex: index, thirdWheelData, - thirdPickedDataIndex: 0 + thirdPickedDataIndex: 0, + selectedValue: 'wheel2'+index }); me.refs.thirdWheel && me.refs.thirdWheel.moveTo && me.refs.thirdWheel.moveTo(0); }} > diff --git a/package.json b/package.json index 00671c8ef..5af20733e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-picker", - "version": "0.3.4", + "version": "0.3.5", "description": "react-native-picker", "main": "index.js", "scripts": {