TypeError: Cannot read property 'hide' of undefined
See original GitHub issue FAIL src/App.test.js
✕ renders correctly (86ms)
● renders correctly
TypeError: Cannot read property 'hide' of undefined
45 | // do stuff while splash screen is shown
46 | // After having done stuff (such as async tasks) hide the splash screen
> 47 | SplashScreen.hide()
48 | }
49 |
50 | render() {
at App.componentDidMount (src/App.js:47:34)
at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:5461:24)
at commitAllLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6250:9)
at Object.invokeGuardedCallback$1 (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2159:10)
at invokeGuardedCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2106:29)
at commitAllWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6371:9)
at workLoop (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6643:13)
at Object.invokeGuardedCallback$1 (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2159:10)
at invokeGuardedCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2106:29)
at performWork (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6756:7)
console.error node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2053
The above error occurred in the <App> component:
in App
Consider adding an error boundary to your tree to customize error handling behavior.
You can learn more about error boundaries at https://fb.me/react-error-boundaries.
console.warn node_modules/react-native/jest/setup.js:99
Calling .blur() in the test renderer environment is not supported. Instead, mock out your components that use findNodeHandle with replacements that don't rely on the native environment.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:10
Top Results From Across the Web
Angular: Error 'Cannot read property 'hide' of undefined' when ...
While everything works except closing the modal which gives me error "TypeError: Cannot read property 'hide' of undefined".
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >Uncaught (in promise) TypeError: Cannot read property 'hide ...
Hello! I have just started using Vue.js, so my question may be very simple. I took over a project which I am struggling...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
As a JavaScript developer, I'm sure you've encountered the frustrating runtime TypeError Cannot read properties of undefined .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution is simple, because of the use of Native Modules, when you are running into a test environment those modules are unavailable, so you have to make a jest mock to actually test it, just like this:
Getting this error for
react-native-bootsplash
, adding mocks did not help