Skip to content

Commit

Permalink
value 可以传入不仅仅是 int ,还可以string
Browse files Browse the repository at this point in the history
之前value 只能接收 int ,修改 value 为 index 值,原 value 使用另外的变量代替。
  • Loading branch information
HiZhenyu committed Jun 17, 2016
1 parent a7c9646 commit b61f7d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions WheelCurvedPicker.android.js
Expand Up @@ -52,7 +52,7 @@ var WheelCurvedPicker = React.createClass ({
if (child.props.value === props.selectedValue) {
selectedIndex = index;
}
items.push({value: child.props.value, label: child.props.label});
items.push({value: index, theValue: child.props.value, label: child.props.label});
});

var textSize = props.itemStyle.fontSize
Expand All @@ -63,7 +63,9 @@ var WheelCurvedPicker = React.createClass ({

_onValueChange: function(e: Event) {
if (this.props.onValueChange) {
this.props.onValueChange(e.nativeEvent.data);
var selectedItem = this.state.items[e.nativeEvent.data] ;
!selectedItem && (selectedItem = {theValue:0}) ;
this.props.onValueChange(selectedItem.theValue);
}
},

Expand Down

0 comments on commit b61f7d0

Please sign in to comment.