Add a warning when the package is not linked

This commit is contained in:
Mathieu Acthernoene 2017-09-08 21:39:23 +02:00
parent 31f54d1a95
commit 13c8bd50c7
1 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,11 @@
const RNI18n = require('react-native').NativeModules.RNI18n;
const I18nJs = require('i18n-js');
if (typeof RNI18n !== 'undefined') {
I18nJs.locale = RNI18n.languages[0];
} else if (__DEV__) {
console.warn('react-native-i18n module is not correctly linked');
}
export const getLanguages = RNI18n.getLanguages;
export default I18nJs;