-
-
Notifications
You must be signed in to change notification settings - Fork 836
Open
Description
Issue: Incomplete Text Filtering in CountryPicker Component
Description
When using the CountryPicker
component from react-native-country-picker-modal
(v2.0.0) with the withFilter
option enabled, the search functionality doesn't properly filter countries based on text input.
For example, when searching for "Viet", the results include both "Viet Nam" and "Bouvet Island". This suggests the filter is matching text in a non-intuitive way, possibly searching for character sequences anywhere within the country name.
Expected Behavior
When searching for "Viet", only countries that start with or closely match this prefix (like "Viet Nam") should be displayed in the list.
Current Behavior
The current filter matches partial text within country names, producing unexpected results. Searching for "Viet" returns:
- "Viet Nam" (expected)
- "Bouvet Island" (unexpected)
Reproduction Steps
- Create a component with CountryPicker and enable filtering:
<CountryPicker
countryCode="MY"
withFilter
withFlag
// other props...
/>
- Open the country picker
- Type "Viet" in the search box
- Observe both "Viet Nam" and "Bouvet Island" in the results
Environment
- react-native-country-picker-modal: v2.0.0
- React Native: v0.77.0
- Platform: Android/iOS
Metadata
Metadata
Assignees
Labels
No labels