hossein-zare / react-native-dropdown-picker

A single / multiple, categorizable, customizable, localizable and searchable item picker (drop-down) component for react native which supports both Android & iOS.
https://hossein-zare.github.io/react-native-dropdown-picker-website/
MIT License
1k stars 297 forks source link

feat: add clear search field functionality on item select #767

Open Sujalkumar12 opened 1 month ago

Sujalkumar12 commented 1 month ago

Hey @hossein-zare ,

I noticed that there’s currently no functionality to clear the search field after selecting an item when both multiple and searchable are true.

I recently implemented this feature in my project, and I believe it would be a valuable addition to our package as well. I also found some open issues related to this functionality:

Issue #622 Issue #750

In this PR, I’ve added a new prop called clearSearchFieldOnSelect. This will clear the search field if the following conditions are met:

  1. clearSearchFieldOnSelect should be true
  2. multiple (picker) should be true
  3. search field should not be empty

If all conditions are satisfied, clearSearchFieldOnSelect will clear the search field.

Please let me know if you have any feedback or if there are any changes needed!