From 0c8a3e4f797563c99e988ec2f42ec2a618a8b196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Medina=20Ballester?= Date: Tue, 28 Nov 2017 12:24:51 -0800 Subject: [PATCH] closes #13034 Fixes the ScrollViewMock methods Summary: Solves https://github.com/facebook/react-native/issues/13034 Now the `ScrollView` mock has all the methods available. React Native tests pass. To test this specific part of the code, ```sh $ react-native init Test $ cd Test/ $ yarn add react-navigation ``` Then, add a simple project that uses `react-navigation`: ```js import React from 'react'; import { Text } from 'react-native'; import { StackNavigator } from 'react-navigation'; class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { return Hello, Navigation!; } } const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, }); export default SimpleApp ``` Run the default render tests: ```js $ npm run test ``` Closes https://github.com/facebook/react-native/pull/13048 Differential Revision: D4746028 Pulled By: shergin fbshipit-source-id: cb1791978d15be7f5d14b7b22979388066ad6caa --- .../Components/ScrollView/__mocks__/ScrollViewMock.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js b/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js index 2263234a7c..6aa19b2f0e 100644 --- a/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js +++ b/Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js @@ -8,8 +8,13 @@ * * @flow */ + +/* eslint-env jest */ + 'use strict'; +declare var jest: any; + const React = require('React'); const View = require('View'); @@ -17,7 +22,9 @@ const requireNativeComponent = require('requireNativeComponent'); const RCTScrollView = requireNativeComponent('RCTScrollView'); -class ScrollViewMock extends React.Component<$FlowFixMeProps> { +const ScrollViewComponent = jest.genMockFromModule('ScrollView'); + +class ScrollViewMock extends ScrollViewComponent { render() { return (