React-Native and Intl polyfill required on Android device

I recently updated my Android Studio and many components/sdk and since then React-Intl complains about intl library missing, even though it was working fine before.

I have installed the intl polyfill and I import it at the very top of my main file App.js. I also import the localeData from react-intl and add it. Then, I render my view within the IntlProvider specifying the locale with no messages (I only use FormattedNumber for now)

  • Xml namespace declaration: auto-substitute package name
  • How to manually include external aar package using new Gradle Android Build System
  • How to use private keys from Android storage
  • How to play sounds at accurate periods of time across different devices in Android
  • How to implement filter for custom BaseAdapter with ListView?
  • how to implement in-app purchase in my android application?
  • This is a simplified version of my code:

    import 'intl';
    import { IntlProvider, FormattedNumber, addLocaleData } from 'react-intl';
    import en from 'react-intl/locale-data/en';
    
    addLocaleData(en);
    
    [...]
    
    render() {
        return (
            <IntlProvider locale="en">
                <Text>
                    <FormattedNumber value={123} />
                </Text>
            </IntlProvider>
        )
    }
    

    I get the following error:

    [React Intl] Error formatting number. ReferenceError: No locale data
    has been provided for this object yet.

    enter image description here

    I don’t understand what’s going on. Anyone encounter the same issue?

    Thanks

    Related posts:

    Notification Icon with the new Firebase Cloud Messaging system
    Custom ListView and context menu. How to get it?
    LOG4J in Android
    How to add a SearchWidget to the ActionBar?
    Why using XML to create GUI is a good practice in Android
    How to add a button at the end of RecyclerView?
  • Xamarin Visual Studio IOS Development Without a Mac?
  • Is there a way to disable fading that a viewPager has scroll to edges?
  • Button not working for AlexKolpa/fab-toolbar
  • How to stop asynctask thread in android?
  • Android VideoView MediaPlayer OnInfoListener - events not fired
  • Refreshing activity on receiving gcm push notification
  • 2 Solutions collect form web for “React-Native and Intl polyfill required on Android device”

    Instead of importing locale-data from react-intl, I have resolved the issue importing the polyfill and the locale data from intl

    Add this at the very top of your app:

    import 'intl';
    import 'intl/locale-data/jsonp/en';
    

    Heads up, this works now with just doing the import 'intl'; at the top and still loading the locale-data from react-intl. Using the following versions:

    "intl": "^1.2.5",
    "react-intl": "^2.2.2",
    
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.