Skip to content

Commit

Permalink
v0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
xwenliang committed Jan 20, 2016
1 parent beedb0f commit 1f20b69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) => (
Expand Down Expand Up @@ -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) => (
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}} >
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-picker",
"version": "0.3.4",
"version": "0.3.5",
"description": "react-native-picker",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 1f20b69

Please sign in to comment.