Skip to content

Commit

Permalink
closes #13034 Fixes the ScrollViewMock methods
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alvaromb authored and facebook-github-bot committed Nov 28, 2017
1 parent 72e762d commit 0c8a3e4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,23 @@
*
* @flow
*/

/* eslint-env jest */

'use strict';

declare var jest: any;

const React = require('React');
const View = require('View');

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}>
Expand Down

0 comments on commit 0c8a3e4

Please sign in to comment.