Mock requireNativeComponent so manual mocking of UIManager properties isn't needed

Summary:
Fixes warnings such as `Warning: Native component for "RCTView" does not exist` when you don't mock the native view class on `UIManager`.

**Test plan (required)**

Run `npm test` with it and without it, notice that warnings are gone and results are the same.

cc cpojer
Closes https://github.com/facebook/react-native/pull/10486

Differential Revision: D4063500

Pulled By: cpojer

fbshipit-source-id: f6bdda1fdd1ad87958f435071d353684cb812af4
This commit is contained in:
Christoph Pojer
2016-10-22 20:17:32 -07:00
committed by Facebook Github Bot
parent 61ddf0effe
commit 487171fd89

View File

@@ -158,3 +158,13 @@ jest
register: id => id,
getByID: () => mockEmptyObject,
}));
jest.doMock('requireNativeComponent', () => {
const React = require('react');
return viewName => props => React.createElement(
viewName,
props,
props.children,
);
});