androidreact-nativepolyfillsjavascriptcorereact-intl

Using Intl properly in Android React Native app


I'm trying to use number formatter of Intl, which works perfectly on iOS and when debugger is attached to either iOS or Android, but only fails on Android without debugger attached due to outdated JSC in Android.

After a bit research I've found two possible solutions:

I tried Intl polyfill first like this after installing intl and react-intl using yarn:

//in my app's index.js
if (!global.Intl) {
    global.Intl = require('intl');
}

Though it still says ReferenceError: Can't find variable: Intl.

Then I gave up and tried to include custom JSC (I've confirmed that custom AAR is referenced correctly) though I still get the same error. No matter what I do I can't get Intl to get running on Android without debugger attached.

What am I doing wrong? (I'm on React Native 0.59.9)


Solution

  • I wanted to delete this question but I can't since there's already another answer.


    It had nothing to do with JSC. My build script wasn't updating the APK properly while I thought it was, and I was trying an old bogus APK over and over again. Otherwise, apparently I was doing everything properly as it works now with the new APK.