question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RNLocalize gets an undefined object on RNLocalize.initialContants

See original GitHub issue

Hello !

We used react-native-languages with i18n-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

  • react-native-localize v 1.0.1
  • react-native v 0.57.7
  • Target platform: both
  • Device : Android Virtual Device
  • OS version: Android 6.0
  • DevTools: Android Studio v 3.1.4 with build tools v 27.0.3

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.

  1. Unlink then uninstall react-native-languages with npm
  2. Install then link react-native-localize
  3. Edited my i18n.js file to be the exact same as in the link above
  4. react-native run-android now instantly throws me this exception undefined 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 and i18n-js installed, but I got the same result except the value was nulland not undefined.

Basically just using import * as RNLocalize from 'react-native-localize throws this exception. Have you any clues about what could cause this issue ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:44 (12 by maintainers)

github_iconTop GitHub Comments

17reactions
smeevilcommented, Mar 5, 2019

I did have the same errors on iOS. (did not test android yet). Manual linking did work, adding the RNLocalize.xcodeproj to the libraries on the project navigator AND (missing in the docs) adding libRNLocalize.a in the linked frameworks and libraries in the general tab of the target app.

So it seems the automatic linking is not working as advertised.

14reactions
zoontekcommented, Jul 11, 2019

@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/

Read more comments on GitHub >

github_iconTop Results From Across the Web

RNLocalize gets an undefined object on RNLocalize ... - GitHub
Hey guys! I got an error as image below (image1.png)! I don't know why it's happen? Can anyone give me known and fix...
Read more >
react native - RNLocalize gets an undefined object on ...
In terminal run - react-native link react-native-localize and double check on your iOS and android project following files has the linking code ...
Read more >
[Solved]-RNLocalize gets an undefined object on RNLocalize ...
Coding example for the question RNLocalize gets an undefined object on RNLocalize.initialContants-React Native. ... import com.reactcommunity.rnlocalize.
Read more >
RNLocalize gets an undefined object on RNLocali...anycodings
Answers 1 : of RNLocalize gets an undefined object on RNLocalize.initialContants. It seems to be you didn't properly anycodings_react-native linking the ...
Read more >
The react-native-localize from zoontek - GithubHelp
RNLocalize gets an undefined object on RNLocalize.initialContants. Hello ! We used react-native-languages with i18n-js in our app to easly manage the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found