-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
RNLocalize gets an undefined object on RNLocalize.initialContants #30
Comments
+1 |
@QuentinNev Is this Could you provides me the content of your |
I'm experiencing the same issue, making at least our jest tests fail:
|
@FransTwisk Could you provides your module mock? |
Ignore it, you're right, I forgot to update the mock file :) Works for me now. |
I experienced the same problem and downgrading to 1.0.0 solves it. Seems to be an issue with the most recent release. |
@nigel-smk In the same conditions (on Android) ? Because the only change between |
I was experiencing it on iOS. I did not test Android. I'll test it out tomorrow and report back. |
@nigel-smk Do you use CocoaPods? |
I experience this same error in the iOS simulator. RN version 0.57.8. Downgrading to 1.0.0 did not fix. |
I just tried using: react-native init TestRNLocalize && cd TestRNLocalize
yarn add react-native-localize
react-native link react-native-localize
react-native run-ios
react-native run-android import * as RNLocalize from "react-native-localize";
console.log(RNLocalize.getLocales()); Without any issues. It's probably due to |
Thanks for helping us out with this! Running the commands you posted also works without issues here. Maybe it is a react-native version issue? |
I need to investigate. EDIT: Could you check that the linking went OK using manual instructions? https://github.com/react-native-community/react-native-localize#manual-ios |
Just to update on my side:
|
@nigel-smk Maybe metro bundler cache invalidation? |
I've upgraded my app to the latest react-native version (use Building on iOS requires some changing of a script that installs third-party elements (see this issue and this issue). Fix the path of Anyway, returning to this issue: after upgrading and solving all the other issues, this error disappeared. I do not know what exactly fixed the issue, but upgrading to the latest react-native version seems to do the trick. |
+1 Could not get it to work with Works on virtual device but not on physical device
|
I did have the same errors on iOS. (did not test android yet). So it seems the automatic linking is not working as advertised. |
@smeevil, could you please tell me which version of react-native you use? I have installed: Thx |
The same except for : "react-native": "0.59.0-rc.3", |
I just integrated react-native-localize into my project, including with a jest test and I looked at it on iOS (deployed it to users actually!) and did not encounter this problem. Every version I am using is current as of today (RN 0.59.3, latest release of localize etc etc.) I am using the jest file from here, but with getBestAvailableLanguage added - in my mocks folder: #24 (comment) |
+1 |
I solved it by adding |
I had this issue on android. It's because the linking didn't happen correctly in the MainApplication.java. |
can you please give an example of how you changed this? |
Sure, |
I'm having the same issues with |
I'm having the same issues too... Android |
@dmacan23 Could you post your Podfile? @troyamtec Which RN version? |
Having the same problem with my project on React Native version |
@plahteenlahti On React Native 0.60, you have nothing more to do than |
I'm experiencing the same issue on my expo project.
did some researches but not resolve yet. |
I've just done the quick fix by remove react-native-localize. locales/i18n.js
In the components
I think this solution does not cover all the cases. For example for the right to left languages do not work well. It just work well in my case with the particular languages. Cheers |
@duluong This package will not works with Expo (you can't install native packages in Expo without exjecting to Expokit). Check the Expo documentation to achieve the same effect: https://docs.expo.io/versions/v33.0.0/sdk/localization/ |
@zoontek Thanks for your feedback. |
I'm having the same issue on Android devices. Is there a known fix? I tried both the manual configuration and |
+1 |
I'm closing this since a lot of the issues are often related to bad installation / linking. More infos here if you struggle with Cocoapods: #63 |
I just need to rebuild native module and then it works |
Sorry, how did you do that I am stuck in this error after migrating from RN 0.59.10 to 0.60.0 |
just link the package with project... autolink is not working for this package.
(root) -> |
Oh my god, thank you so much for clarifying this! I've tried for hours to solve this unsolvable problem because I was trying to use it with my managed Expo project... There's a react native example called RocketChat: https://github.com/RocketChat/Rocket.Chat.ReactNative |
Hello !
We used
react-native-languages
withi18n-js
in our app to easly manage the translations. Now that it has been updated and that we've done the migration, we faced a strange exception as described below.Describe your environment
How to repeat issue and example
Before the update to RNLocalize, everything worked fine, I did nothing more than copying the example. After the update, I followed the steps described here.
react-native run-android
now instantly throws me this exceptionundefined is not an object (evaluating 'RNLocalize.initialContants')
even in the console it's the only thing printed.I'm not really confident with react-native and I don't have any clue about what's happening.
I created a new project with only
react-native-localize
andi18n-js
installed, but I got the same result except the value wasnull
and notundefined
.Basically just using
import * as RNLocalize from 'react-native-localize
throws this exception.Have you any clues about what could cause this issue ?
The text was updated successfully, but these errors were encountered: