mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
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:
committed by
Facebook Github Bot
parent
61ddf0effe
commit
487171fd89
@@ -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,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user