Intl.numberformat in React native works fine when running in ios but not in android

Viewed 3532

I am developing an app with React Native to run on IOS and Android. I use Intl.numberformat() to print currency, and it works smoothly when the app runs on IOS, but I get this error when running on Android: ReferenceError: Can't find variable: Intl.

How can I make it run in both plataforms?

1 Answers

I had faced similar issue. The issue was with Javascript core which runs the react- native. There are two ways to overcome this.

1.Method 1 You'll have to integrate latest javascript core into your android build or upgrade react native to 0.59

You can find it here

  1. Method 2 Add or override the following code in your app/build.gradle

def jscFlavor = 'org.webkit:android-jsc-intl:+'

Clean build and react-native run android

Related