Closed MartijnGevaert closed 2 years ago
The issue was fixed by code importing below. Unfortunate that this requires such a large number of dependencies to add to package.json
Maybe this can be made clearer in the Readme? Or will this step no longer be needed in future releases?
(modified for nl
language)
if (Platform.OS === 'android') {
// this line is only needed if you don't use an .android.js file
require('@formatjs/intl-getcanonicallocales/polyfill');
require('@formatjs/intl-locale/polyfill');
require('@formatjs/intl-pluralrules/polyfill');
require('@formatjs/intl-pluralrules/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-displaynames/polyfill');
require('@formatjs/intl-displaynames/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-listformat/polyfill');
require('@formatjs/intl-listformat/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-numberformat/polyfill');
require('@formatjs/intl-numberformat/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-relativetimeformat/polyfill');
require('@formatjs/intl-relativetimeformat/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-datetimeformat/polyfill');
require('@formatjs/intl-datetimeformat/locale-data/nl.js'); // USE YOUR OWN LANGUAGE OR MULTIPLE IMPORTS YOU WANT TO SUPPORT
require('@formatjs/intl-datetimeformat/add-golden-tz.js');
}
You should upgrade & use Hermes on Android, no polyfills are needed then. Intl works there for all languages without bigger binary because it uses underlying platform
Hermes also have great speed improvements on Android devices!
This worked, thanks, I didn't use Hermes before because it breaks the android debugger on VScode in my project.
Greetings,
I noticed a bug where on Android, a Render error is thrown on react-native 0.67.4. I'm not using Hermes, but I am above RN 0.66 https://snack.expo.dev/okpH8pb3C
It does work on web.