lawnstarter / react-native-picker-select

🔽 A Picker component for React Native which emulates the native <select> interfaces for iOS and Android
https://npmjs.com/package/react-native-picker-select
MIT License
1.74k stars 497 forks source link

Add a way to clear the picker #474

Closed DaanKorver closed 1 year ago

DaanKorver commented 2 years ago

Is your feature request related to a problem? Please describe.
I have a form that needs to be cleared if its valid and ready to send. The only problem is that I can't seem to clear the picker/reset the state of the picker

Describe the solution you'd like
I want a option to programmatically clear the input

Describe alternatives you've considered
I tried to use some other packages but this ones looks the best.

Additional details
N.A.

Hassan426 commented 2 years ago

+1

EmilyRagan commented 2 years ago

If you are tracking the value in a variable, you can just set that variable to null or undefined to clear the input.

CptFabulouso commented 2 years ago

That won't clear the input, because the value prop

Will attempt to locate a matching item from the items array by checking each item's value property. If found, it will update the component to show that item as selected. If the value is not found, it will default to the first item.

DaanKorver commented 1 year ago

Closing this issue since the package isn't being updated anymore.