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 <Text>Hello, Navigation!</Text>;
  }
}

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
This commit is contained in:
Álvaro Medina Ballester 2017-11-28 12:24:51 -08:00 committed by Facebook Github Bot
parent 72e762d4bc
commit 0c8a3e4f79
1 changed files with 8 additions and 1 deletions

View File

@ -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 (
<RCTScrollView {...this.props}>