Permalink
Browse files

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 #10486

Differential Revision: D4063500

Pulled By: cpojer

fbshipit-source-id: f6bdda1fdd1ad87958f435071d353684cb812af4
  • Loading branch information...
1 parent 61ddf0e commit 487171fd892416ced6f305a5036464c1dd733ee1 @cpojer cpojer committed with Facebook Github Bot Oct 23, 2016
Showing with 10 additions and 0 deletions.
  1. +10 −0 jest/setup.js
View
@@ -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,
+ );
+});

0 comments on commit 487171f

Please sign in to comment.