m-picker
m-picker copied to clipboard
Bug: if props are updated except selectedValue, Picker's selectedValue will have the value of first Picker.Item.
{/* if component props will be changed like below. */}
<Picker
defaultSelectedValue={0}
selectedValue={someAwaitingValue /* it is undefined yet. */}
>
{items}
</Picker>
{/* vvvvvvvvvv */}
<Picker
defaultSelectedValue={1}
selectedValue={someAwaitingValue /* it is undefined yet. */}
>
{items}
</Picker>
The condition for updating this.state.selectedValue
is currently 'selectedValue' in nextProps
.
This causes select
method will update the selectedValue
to be the first value of Picker.Item
.