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

Filtering show countries without translation #480

Open cbarceloc opened 2 years ago

cbarceloc commented 2 years ago

The countries list show correct translations, but when we write some text in the search box, the list shown is always in english

Poli97 commented 1 year ago

Any update on this one? Basically the initial list is presented with the correct translation, but as soon as you start typing in the search filter, the filtered results are shown in default english

9christian9 commented 1 year ago

Ciao @cbarceloc , @Poli97 , and everyone,

I ran into the same problem as you and tried to solve it,

The problem in my opinion: The problem could be data: search(filter, data) from /lib/CountryList.js, more precisely the problem could be search from useContext(). When trying to do a search, search(filter, data) returns data with the old translation option. If you debug filter and data in /lib/CountryList.js, the variables are set correctly, but when you activate the search function, an old data is passed back.

The solution I created a repo that with a js script solves the problem before building the app https://github.com/9christian9/FIX-react-native-country-picker-modal-filtering-countries-with-old-translation

I hope this will help. With ♥ by Christian