Skip to content

Commit

Permalink
Include props in new ListView and ScrollView mocks
Browse files Browse the repository at this point in the history
Summary:
Hi,

The (as of yet unreleased) commit 5537055 added some ListView and ScrollView mocks, but they leave out the original properties passed into them, which broke some of my tests (e.g. by excluding some properties like `testID`, for example, from the render tree) and I assume might break others' as well.

This PR makes it so the ListView mock directly returns the scroll component (instead of wrapping it in a View), and has ListViewMock and ScrollViewMock pass their given properties through.
Closes #11847

Differential Revision: D4408497

Pulled By: sahrens

fbshipit-source-id: 7ec01c35d6b8efeb97761cddffdb4075d09c7d70
  • Loading branch information
dingbat authored and facebook-github-bot committed Jan 12, 2017
1 parent d12d0b4 commit dbe555b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const RCTScrollView = requireNativeComponent('RCTScrollView');
class ScrollViewMock extends React.Component {
render() {
return (
<RCTScrollView>
<RCTScrollView {...this.props}>
{this.props.refreshControl}
<View>
{this.props.children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const ListViewDataSource = require('ListViewDataSource');
const React = require('React');
const ScrollView = require('ScrollView');
const StaticRenderer = require('StaticRenderer');
const View = require('View');

class ListViewMock extends React.Component {
static latestRef: ?ListViewMock;
Expand Down Expand Up @@ -48,11 +47,7 @@ class ListViewMock extends React.Component {
}
}
renderFooter && rows.push(renderFooter());
return (
<View>
{this.props.renderScrollComponent({children: rows})}
</View>
);
return this.props.renderScrollComponent({...this.props, children: rows});
}
static DataSource = ListViewDataSource;
}
Expand Down

0 comments on commit dbe555b

Please sign in to comment.