Skip to content

Commit 0c8a3e4

Browse files
alvarombfacebook-github-bot
authored andcommitted
closes #13034 Fixes the ScrollViewMock methods
Summary: Solves #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 <Text>Hello, Navigation!</Text>; } } const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, }); export default SimpleApp ``` Run the default render tests: ```js $ npm run test ``` Closes #13048 Differential Revision: D4746028 Pulled By: shergin fbshipit-source-id: cb1791978d15be7f5d14b7b22979388066ad6caa
1 parent 72e762d commit 0c8a3e4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@
88
*
99
* @flow
1010
*/
11+
12+
/* eslint-env jest */
13+
1114
'use strict';
1215

16+
declare var jest: any;
17+
1318
const React = require('React');
1419
const View = require('View');
1520

1621
const requireNativeComponent = require('requireNativeComponent');
1722

1823
const RCTScrollView = requireNativeComponent('RCTScrollView');
1924

20-
class ScrollViewMock extends React.Component<$FlowFixMeProps> {
25+
const ScrollViewComponent = jest.genMockFromModule('ScrollView');
26+
27+
class ScrollViewMock extends ScrollViewComponent {
2128
render() {
2229
return (
2330
<RCTScrollView {...this.props}>

0 commit comments

Comments
 (0)