Skip to content

Incomplete Text Filtering in CountryPicker Component #539

@dominhthanh0206

Description

@dominhthanh0206

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

  1. Create a component with CountryPicker and enable filtering:
<CountryPicker
  countryCode="MY"
  withFilter
  withFlag
  // other props...
/>
  1. Open the country picker
  2. Type "Viet" in the search box
  3. 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions