Skip to content

Commit

Permalink
Mock Native components with a class component to avoid stateless refs…
Browse files Browse the repository at this point in the history
… warnings.
  • Loading branch information
jmoutte committed Oct 7, 2017
1 parent e1f4460 commit 6e15bb7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,13 @@ jest
jest.doMock('requireNativeComponent', () => {
const React = require('react');

return viewName => props => React.createElement(
viewName,
props,
props.children,
);
return viewName => class extends React.Component {
render() {
return React.createElement(
viewName,
this.props,
this.props.children,
);
}
};
});

0 comments on commit 6e15bb7

Please sign in to comment.