Skip to content

Bug running Jest with ScrollView dependant components #13034

Description

@alvaromb

Description

When running npm run test, the default tests index.ios.js and index.android.js fail due to the following error:

    TypeError: _this._scrollView.scrollTo is not a function

      at TabViewPagerScroll._this._scrollTo (node_modules/react-native-tab-view/src/TabViewPagerScroll.js:68:19)
      at TabViewPagerScroll.componentDidMount (node_modules/react-native-tab-view/src/TabViewPagerScroll.js:123:197)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:265:25
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:11
      at CallbackQueue.notifyAll (node_modules/react-test-renderer/lib/CallbackQueue.js:76:22)
      at ReactTestReconcileTransaction.close (node_modules/react-test-renderer/lib/ReactTestReconcileTransaction.js:36:26)
      at ReactTestReconcileTransaction.closeAll (node_modules/react-test-renderer/lib/Transaction.js:206:25)
      at ReactTestReconcileTransaction.perform (node_modules/react-test-renderer/lib/Transaction.js:153:16)
      at batchedMountComponentIntoNode (node_modules/react-test-renderer/lib/ReactTestMount.js:69:27)

Reproduction

$ react-native init Test
$ cd Test/
$ yarn add react-navigation
$ npm run test

Solution

I'm open to send a PR with a fix if somebody can guide me through this. Could be here https://github.com/facebook/react-native/blob/dbe555ba78d7b0f79e482c62787db2fc3d897848/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js?

Additional Information

  • React Native version: 0.42.0
  • Platform: both
  • Operating System: macOS Sierra
  • Dev tools: iOS 10.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Help Wanted :octocat:Issues ideal for external contributors.JavaScriptResolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions