react-component / m-picker

React Mobile Picker(web & react-native)

Home Page:http://react-component.github.io/m-picker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: if props are updated except selectedValue, Picker's selectedValue will have the value of first Picker.Item.

wonism opened this issue · comments

{/* 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.