React-native-splash-screen: Cannot read property 'hide' of undefined

Created on 26 Apr 2018  ·  3Comments  ·  Source: crazycodeboy/react-native-splash-screen

Hi need some hand here...

I'm facing problem of cannot read property of undefined on non test enviroment

I don't know why

Device iOS
Using the latest version

I'm doing the linking manually not using react-native link

any idea?

Most helpful comment

try to downgrade to 3.0.1 it works with [email protected]

All 3 comments

try to downgrade to 3.0.1 it works with [email protected]

@tavriaforever it works for me.

[email protected] and [email protected]

I am facing this issue only in a testing environment:

yarn run v1.22.4
$ jest __tests__/App1.test.tsx
 FAIL  __tests__/App1.test.tsx (8.89s)
  ✕ render without errors (74ms)

  ● render without errors

    TypeError: Cannot read property 'hide' of undefined

      36 |     this.addDebugMenuListener();
      37 |     PushNotificationSubscriber.registerForPushNotificationsAsync();
    > 38 |     RNBootSplash.hide();
         |                  ^
      39 |   }
      40 |
      41 |   componentWillUnmount() {

      at Object.hide (node_modules/react-native-bootsplash/index.js:5:16)
      at App.componentDidMount (src/App.tsx:38:18)
      at fn (node_modules/enzyme/src/ShallowWrapper.js:429:22)
      at Object.batchedUpdates (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:771:16)
      at new ShallowWrapper (node_modules/enzyme/src/ShallowWrapper.js:428:26)
      at shallow (node_modules/enzyme/src/shallow.js:10:10)
      at setup (__tests__/App1.test.tsx:22:10)
      at Object.<anonymous> (__tests__/App1.test.tsx:26:19)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        9.036s, estimated 31s
Ran all test suites matching /__tests__\/App1.test.tsx/i.

"react-native-bootsplash": "^2.2.5",

Was this page helpful?
0 / 5 - 0 ratings