Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-native-i18n is deprecated, should this lib migrate to react-native-localize ? #8

Open
zedtux opened this issue Nov 17, 2022 · 0 comments

Comments

@zedtux
Copy link

zedtux commented Nov 17, 2022

More than 3 years ago, the react-native-i18n library has been deprecated.

It is the only and the main dependency of this package, so should this package migrate to react-native-localize as suggested from the deprecation warning message ?

In a React-Native 0.70 app, I have the following warning :

react-native-i18n module is not correctly linked

I had to patch react-native-i18n with :

diff --git a/node_modules/react-native-i18n/index.js b/node_modules/react-native-i18n/index.js
index 6402f5a..4736e57 100644
--- a/node_modules/react-native-i18n/index.js
+++ b/node_modules/react-native-i18n/index.js
@@ -5,7 +5,7 @@
 const RNI18n = require('react-native').NativeModules.RNI18n;
 const I18nJs = require('i18n-js');
 
-if (typeof RNI18n !== 'undefined') {
+if (typeof RNI18n !== 'undefined' && RNI18n !== null) {
   I18nJs.locale = RNI18n.languages[0];
 } else if (__DEV__) {
   console.warn('react-native-i18n module is not correctly linked');

in order to prevent the error :

TypeError: Cannot read property 'languages' of null, js engine: hermes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant