React-native-i18n: Undefined is not an object (evaluating 'RNI18n.languages')

Created on 25 Jul 2017  路  7Comments  路  Source: AlexanderZaytsev/react-native-i18n

Hi,

I just upgraded an existing app to RN 0.46.4 and React 16.0.0-alpha.12 and React-Native-i18n 2.0.2 and I'm seeing undefined is not an object (evaluating 'RNI18n.languages') during launch when running the app for iOS ( unlike the testing issue #99 ).

RNI18n is imported in index.ios.js and used immediately, so I'm wondering if something needs to happen before (react-native-i18n).languages will be available...

// index.ios.js
import I18n from 'react-native-i18n';

const locale = I18n.locale.substr(0, 2); // --> error undefined is not an object (evaluating 'RNI18n.languages')

Thanks!

Most helpful comment

This happened to me again. Simply this: import I18n from 'react-native-i18n'; caused it.

All 7 comments

After building from XCode this vanished (before I had only tried it through the command line...) ... so closing this issue again. Sorry for the confusion.

This happened to me again. Simply this: import I18n from 'react-native-i18n'; caused it.

Hi there, I'm having the same issue.
@felixdivo what did you write instead of the "import I18n from 'react-native-i18n':" to prevent the error?

Well, this might not be a solution for you, but we were still evaluating what library to use. So we simply switched to that one: https://github.com/stefalda/ReactNativeLocalization. It has a fairly similar and straight forward syntax and so far works fine for us.

I am suffering this problem too. (but only Android)
rm -rf ./node_modules, updating npm, restart packager, remove packages.lock ..
I followed everything in doc, but always fails with Undefined is not an object (evaluating 'RNI18n.languages')

@AlexanderZaytsev Would you please consider reopening the issue? Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibelius picture sibelius  路  4Comments

alainib picture alainib  路  7Comments

ankita-p17 picture ankita-p17  路  6Comments

xilonxiao picture xilonxiao  路  5Comments

Mengxiaowei picture Mengxiaowei  路  4Comments