m-picker icon indicating copy to clipboard operation
m-picker copied to clipboard

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

Open wonism opened this issue 5 years ago • 0 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.

wonism avatar Feb 24 '20 09:02 wonism