From 45275e30b990b8ffa549f8b68b3f2888034d042a Mon Sep 17 00:00:00 2001 From: Cristian Carlesso Date: Fri, 28 Oct 2016 10:56:58 -0700 Subject: [PATCH] Fixes Components with prefixes in mock Reviewed By: bestander Differential Revision: D4096027 fbshipit-source-id: 342677a27c6d03dc7d2d6eb53970a504fb62d63b --- jest/mockComponent.js | 4 +++- jest/setup.js | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/jest/mockComponent.js b/jest/mockComponent.js index 3b2f3abf4..ab6c56797 100644 --- a/jest/mockComponent.js +++ b/jest/mockComponent.js @@ -13,8 +13,10 @@ module.exports = moduleName => { const Component = class extends RealComponent { render() { + const name = RealComponent.displayName || RealComponent.name; + return React.createElement( - RealComponent.displayName || RealComponent.name, + name.replace(/^(RTC|RK)/,''), this.props, this.props.children, ); diff --git a/jest/setup.js b/jest/setup.js index 5347247fc..c46dd2c5b 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -132,13 +132,13 @@ const mockNativeModules = { width: 750, }, }, - RCTModalFullscreenView: { + ModalFullscreenView: { Constants: {}, }, - RCTScrollView: { + ScrollView: { Constants: {}, }, - RCTView: { + View: { Constants: {}, }, },