react-native-select-picker icon indicating copy to clipboard operation
react-native-select-picker copied to clipboard

Issue when parsing value={null}

Open arelstone opened this issue 4 years ago • 1 comments

When having an<SelectPicker.Item with the value null and and parsing a value 0 as value in one of the other fields the Item with the null value is being selected

<SelectPicker
    selected={0}
>
    <SelectPicker.Item label="Select none" value={null} /> /* THIS WILL VE SELECTED */
    <SelectPicker.Item label="option #1" value={0} />
    <SelectPicker.Item label="option #2" value={1} />
    <SelectPicker.Item label="option #3" value={2} />
</SelectPicker>

Expected behaviour

When parsing any as selected the Item with the value matching the value of selected should be picked.

Eg:

  1. parsing selected={0} should select the item with the value={0}
  2. parsing selected={1} should select the item with the value={1}
  3. parsing selected={null} should select the item with the value={null}

As a temporary solution i moved the Select none to the bottom of the list

arelstone avatar Jul 31 '20 09:07 arelstone

Thanks for the notice. Did you try it with any other value? Did it work?

olayinkaokewale avatar Aug 01 '20 15:08 olayinkaokewale