xcarpentier / react-native-country-picker-modal

🇦🇶 Country picker provides a modal allowing a user to select a country from a list. It display a flag next to each country name.
https://reactnative.gallery/xcarpentier/country-picker
MIT License
1.07k stars 795 forks source link

Ignore accents in country names when using filter and spanish translation #493

Open KevinBarrera opened 1 year ago

KevinBarrera commented 1 year ago

Issue Description

While using react-native-country-picker-modal I found an issue while using withFilter and translation props. As you might know there are some countries which names could include accent marks, among other punctuation marks, in some languages. The issue is that if I select spa -> for spanish translation and type something within filter input it doesn't match the input with the countries because inpute does not include accents but names do. (i.e) Having this:

    <CountryPicker
      translation="spa"
      withFilter
      ...
    />

I got this behavior:

https://user-images.githubusercontent.com/24555028/200438049-123704e3-8cce-4b66-99a9-0825381981b1.mov

As you can see, if user types "M" "México" appears as one of possible options, but if I add an "e" -> "Me". "México" disappears from the list, I think it is because the accent, I've been looking for a way to get this ignoring the accent while filtering but cannot find the solution.

Steps to Reproduce / Code Snippets

Expected Results

If user types "Me" "México" should appears within the options even if user does not type the accent when using "spanish" translation.

Additional Information