-
-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
world country data #22
Comments
I agree, the country data file is huge and a local copy of the file containing only the necessary data would be a big improvement. Maybe we could add some functionality to provide your own data as well. Not everyone needs the currency or all translations for example. Some might not even need all countries (Antartica for example doesn't even have a calling code if I'm not mistaken). |
I started to work on such a converter... I am generating a file like this:
Trying to see how I could escape the names to be more robust. I also think that a country code of 2 characters instead of 3 for the translations would be more useful... |
Good point. Speed and efficiency is very important for a basic component like a country picker. I think we should default include the bare minimum but make extra features possible. +1 for a 2 char country code for translation. |
Unicode flags would be a nice improvement. However, on Android, unicode flags are only supported since Lollipop. Half of the Android users still use older versions, hence I don't think unicode flags are a solid solution at the moment. |
Ah ok, but we can then use Platform.version to discover this and include base64 strings as legacy option? |
Hello @pcarion, thank you and I agree ! |
See my PR #29 :) |
Improve here #29 |
Let me expose here a concern I have with the memory usage of the
CountryPicker
component and I am OK to tackle this issue and submit a PR if you think it is a valid concern.Currently, you load the
countries.json
file from theworld_country
npm module, to get extra data from the selected country.This file is big (
444K
) and it may be a waste of space considering that very few piece of information is needed from the file:You already have a configuration file of yours (
countryFlags.js
) to store the image of the flags.My suggestion would be to parse (offline) the
countries.json
and generate a localcountryInfo.js
file, that would be stored in your repo (with proper attribution to the author ofworld_country
) with only the information needed in the context of your app.This would require a few changes in the code (such as
orderCountryList
andgetCountry
) but nothing major and the footprint of the component in memory would be much smaller...The text was updated successfully, but these errors were encountered: