{/* 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.
The condition for updating
this.state.selectedValue
is currently'selectedValue' in nextProps
. This causesselect
method will update theselectedValue
to be the first value ofPicker.Item
.