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

Cannot read property 'getLanguages' of undefined #152

Closed
julestruong opened this issue Dec 7, 2017 · 13 comments
Closed

Cannot read property 'getLanguages' of undefined #152

julestruong opened this issue Dec 7, 2017 · 13 comments

Comments

@julestruong
Copy link

julestruong commented Dec 7, 2017

Hello guys, i've got this wonderful lib and it works fine except during test

I'm using jest, and i've go this weird error.

    TypeError: Cannot read property 'getLanguages' of undefined

      at Object.<anonymous> (node_modules/react-native-i18n/index.js:12:45)
      at Object.<anonymous> (src/i18n/index.js:1:849)
      at Object.<anonymous> (src/features/login/index.js:5:11)

The app works tho.

@AlexanderZaytsev

@wilomgfx
Copy link

wilomgfx commented Dec 7, 2017

Same here, one every two runs.

@yanivnizry
Copy link

+1

1 similar comment
@giantss
Copy link
Contributor

giantss commented Dec 11, 2017

+1

@giantss
Copy link
Contributor

giantss commented Dec 11, 2017

image
Why does this happen?
@AlexanderZaytsev

@zoontek
Copy link
Collaborator

zoontek commented Dec 11, 2017

@giantss Try replacing the function with (don't forget to clean the packager cache):

export const getLanguages = () => RNI18n.getLanguages()

Does it fixes the problem?

@LcTwisk
Copy link

LcTwisk commented Dec 11, 2017

+1

@giantss
Copy link
Contributor

giantss commented Dec 12, 2017

#153 ,I am now working for both android and ios. I was not able to work before because of the operationAutomatic setup with Cocoapods. I guess it may be because pod install failed, but I did not see the error log on the console.
Here are my steps:

1, Created a new project

2, npm install react-native-i18n --save

3, react-native link

4, react-native run-ios/run-android

I did not configure Automatic setup with Cocoapods In ios, it is recommended to update the document, to prevent the user with trouble.
@zoontek

@zoontek
Copy link
Collaborator

zoontek commented Dec 12, 2017

@giantss What version of RN are you using?

@giantss
Copy link
Contributor

giantss commented Dec 12, 2017

@zoontek 0.49.5

@compojoom
Copy link

@zoontek - with your change it's working. I guess we need a pull request :)

@zoontek
Copy link
Collaborator

zoontek commented Dec 21, 2017

@compojoom feel free to do it :)

@compojoom
Copy link

compojoom commented Dec 21, 2017

@zoontek - I see that we already have one
#153

@zoontek
Copy link
Collaborator

zoontek commented Dec 21, 2017

@zoontek zoontek closed this as completed Dec 21, 2017
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

7 participants