2
votes

I am trying to use the lib https://github.com/AlexanderZaytsev/react-native-i18n

It works, but a warning

react-native-i18n module is not correctly linked

still show up.

I installed it with npm install react-native-i18n --save

Versions

react-native-cli: 2.0.1

react-native: 0.55.4

npm: 5.6.0

Code

Above App.js :

import I18n from 'react-native-i18n';

I18n.locale = I18n.currentLocale();
I18n.fallbacks = true;
I18n.translations = {en: {GENERAL: {NAME: 'example'}}};

In render:

render(){
    return (
        <View>
            <Text>{I18n.t('GENERAL.NAME')}</Text>
        </View>
    );
}

I already looked at these, but I couldn't find an answer:

I tested using an android phone (xiaomi redmi note 5, Expo app).

Thanks for any help.

1
did you tried react-native-link react-native-i18n ?reisdev

1 Answers

1
votes

It was my mistake to even think "react-native-link" will solve the problem because i work with Expo react native.

There is 2 type of react native

  1. Expo - does NOT change native code (like java or swift). meaning "react-native-link" does't work at all

  2. CLI - classic react native. change native code and require "react-native-link" sometimes.

If you use expo with this library you can't fix this issue. You only can disable the yellow box if its annoying you by write this line of code. no matter where

console.disableYellowBox = true;