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.

Cannot read property of 'language' of undefined

See original GitHub issue

I’m playing around with the example provided. I copied over the code in verbatim to see how it works. Ran npm install and react-native link. Now when I run it, the build errors out and returns this error => Cannot read property of 'language' of undefined The error message points to a line in my code that reads as such - import RNLanguages from 'react-native-languages';

Not sure what is causing this error. Any thoughts ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

20reactions
zoontekcommented, May 8, 2018

@ArronJLinton Please respect the issue template so I can help you without asking you a bunch of questions first: https://github.com/react-community/react-native-languages/blob/master/.github/ISSUE_TEMPLATE.md

(Looks like a bad install, but I need more details, thanks!)

8reactions
radikcommented, Oct 5, 2018

@viton Mock module for testing:

// jest-setup.js
jest.mock('react-native-languages', () => ({
  RNLanguages: {
    language: 'en',
    languages: ['en'],
  },
}));
// in package.json
...
"jest": {
    "preset": "react-native",
    "setupFiles": [
      "./jest-setup.js"
    ],
...
}
...
Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'language' of undefined
Create jest-setup.js file (if already not exists) and add following lines in that import { NativeModules } from 'react-native'; ...
Read more >
Cannot read property of 'language' of undefined #4 - GitHub
I'm playing around with the example provided. I copied over the code in verbatim to see how it works. Ran npm install and...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong...
Read more >
Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >
Uncaught TypeError : Cannot read properties of undefined
The solution to TypeError: Cannot read properties of undefined ... The root cause of the error is that the declared variable doesn't have...
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