androidreactjsreact-nativeexpolocalization

rror: Cannot find native module 'ExpoLocalization', js engine: hermes in Expo React Native app


I am trying to implement localization for Expo React Native app. My i18n.js file looks like this:

import { getLocales } from 'expo-localization';
import { I18n } from 'i18n-js';

// Set the key-value pairs for the different languages you want to support.
const i18n = new I18n({
  en: { welcome: 'Hello' },
  lt: { welcome: 'Labas' },
});

// Set the locale once at the beginning of your app.
i18n.locale = getLocales()[0].languageCode;

console.log(i18n.t('welcome'));

I did

npm install expo-localization
npx expo install i18n-js

And I launch with

npx expo start

I get error:

Cannot find native module 'ExpoLocalization', js engine: hermes

My versions in package-lock.json:

    "i18n-js": "^4.4.3",

    "expo-localization": "~15.0.3",

I also tried setting jsEngine in app.json:

  "expo": {
    "jsEngine": "hermes",

None of this really helped. Any suggestions?


Solution

  • Something was wrong with my project. I also needed maps but it didnt allowed me to use maps either. So I created new project using

    npx create-expo-app react-native-maps-demo
    cd react-native-maps-demo
    

    And then it worked - I was able to add localization as well as maps.