MobileReality / react-native-select-pro

React Native dropdown (select) component developed by Mobile Reality
https://mobilereality.github.io/react-native-select-pro
MIT License
299 stars 18 forks source link

[BUG] "defaultOption" and "searchable" Select not displaying the preselected option #243

Closed grmnlxndr closed 3 months ago

grmnlxndr commented 3 months ago

Describe the bug When having a Select component with both defaultOption and searchable props, the Select is rendered with the placeholder text instead of the defaultOption label.

<Select options={DATA} defaultOption={{ label: 'Option 3', value: 'option3'}} searchable />

To Reproduce Check this Snack to see the current behavior: Snack Demo

Expected behavior The Select component should render the defaultOption label instead of the placeholder text.

Screenshots The select when first rendered, it is not showing the default option, but the empty search field with the placeholder text: closed-select

When opening the select for the first time, it shows the default option selected in the option list: first-open-select

Environment (please complete the following information):

Additional context Looks like the searchfield is not pre-populating the defaultOption's label when both options are enabled.

Thanks,

Germán

dawidgierdal commented 3 months ago

@grmnlxndr fix has been merged: https://github.com/MobileReality/react-native-select-pro/pull/245/files

grmnlxndr commented 3 months ago

Thanks Dawid!