@samitouri / QOS-React-2 / commits / 61f62246c8

[react-native] Use path-based imports instead of Haste for the RN renderer (#15604)

* [react-native] Use path-based imports instead of Haste for the RN renderer To move React Native to standard path-based imports instead of Haste, the RN renderer that is generated from the code in this repo needs to use path-based imports as well since the generated code is vendored by RN. This commit makes it so the interface between the generated renderers and RN does not rely on Haste and instead uses a private interface explicitly defined by RN. This inverts control of the abstraction so that RN decides the internals to export rather than React deciding what to import. On RN's side, a new module named `react-native/Libraries/ReactPrivate/ReactNativePrivateInterface` explicitly exports the modules used by the renderers in this repo. (There is also a private module for InitializeCore so that we can import it just for the side effects.) On React's side, the various renderer modules access RN internals through the explicit private interface. The Rollup configuration becomes slimmer since the only external package is now `react-native`, and the individual modules are instead listed out in `ReactNativePrivateInterface`. Task description: https://github.com/facebook/react-native/issues/24770 Sister RN PR (needs to land before this one): https://github.com/facebook/react-native/pull/24782 Test Plan: Ran unit tests and Flow in this repo. Generated the renderers and manually copied them over to the RN repo. Ran the RN tests and launched the RNTester app. * Access natively defined "nativeFabricUIManager" instead of importing it Some places in the Fabric renderers access `nativeFabricUIManager` (a natively defined global) instead of importing UIManager. While this is coupling across repos that depends on the timing of events, it is necessary until we have a way to defer top-level imports to run after `nativeFabricUIManager` is defined. So for consistency we use `nativeFabricUIManager` everywhere (see the comment in https://github.com/facebook/react/pull/15604#pullrequestreview-236842223 for more context).

James Ide committed May 23, 2019 at 00:23 UTC 61f62246c8cfb76a4a19d1661eeaa5822ec37b36
37 files changed +326 -292
packages/react-native-renderer/src/NativeMethodsMixin.js
+4 -2
@@ -17,8 +17,10 @@ import type {
17
18 import invariant from 'shared/invariant';
19 // Modules provided by RN:
20 -import TextInputState from 'TextInputState';
21 -import UIManager from 'UIManager';
20 +import {
21 + TextInputState,
22 + UIManager,
23 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
24
25 import {create} from './ReactNativeAttributePayload';
26 import {
packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js
+1 -1
@@ -8,7 +8,7 @@
8 */
9
10 // Module provided by RN:
11 -import UIManager from 'UIManager';
11 +import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
12
13 const ReactFabricGlobalResponderHandler = {
14 onChange: function(from: any, to: any, blockNativeResponder: boolean) {
packages/react-native-renderer/src/ReactFabricHostConfig.js
+15 -10
@@ -18,31 +18,36 @@ import type {ReactEventComponentInstance} from 'shared/ReactTypes';
18
19 import {mountSafeCallback_NOT_REALLY_SAFE} from './NativeMethodsMixinUtils';
20 import {create, diff} from './ReactNativeAttributePayload';
21 -import {get as getViewConfigForType} from 'ReactNativeViewConfigRegistry';
21
23 -import deepFreezeAndThrowOnMutationInDev from 'deepFreezeAndThrowOnMutationInDev';
22 import invariant from 'shared/invariant';
23 import warningWithoutStack from 'shared/warningWithoutStack';
24
25 import {dispatchEvent} from './ReactFabricEventEmitter';
26
27 // Modules provided by RN:
30 -import TextInputState from 'TextInputState';
28 import {
29 + ReactNativeViewConfigRegistry,
30 + TextInputState,
31 + deepFreezeAndThrowOnMutationInDev,
32 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
33 +
34 +const {
35 createNode,
36 cloneNode,
37 cloneNodeWithNewChildren,
38 cloneNodeWithNewChildrenAndProps,
39 cloneNodeWithNewProps,
37 - createChildSet as createChildNodeSet,
38 - appendChild as appendChildNode,
39 - appendChildToSet as appendChildNodeToSet,
40 + createChildSet: createChildNodeSet,
41 + appendChild: appendChildNode,
42 + appendChildToSet: appendChildNodeToSet,
43 completeRoot,
44 registerEventHandler,
42 - measure as fabricMeasure,
43 - measureInWindow as fabricMeasureInWindow,
44 - measureLayout as fabricMeasureLayout,
45 -} from 'FabricUIManager';
45 + measure: fabricMeasure,
46 + measureInWindow: fabricMeasureInWindow,
47 + measureLayout: fabricMeasureLayout,
48 +} = nativeFabricUIManager;
49 +
50 +const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
51
52 // Counter for uniquely identifying views.
53 // % 10 === 1 means it is a rootTag.
packages/react-native-renderer/src/ReactNativeAttributePayload.js
+4 -2
@@ -8,8 +8,10 @@
8 */
9
10 // Modules provided by RN:
11 -import deepDiffer from 'deepDiffer';
12 -import flattenStyle from 'flattenStyle';
11 +import {
12 + deepDiffer,
13 + flattenStyle,
14 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
15
16 import type {AttributeConfiguration} from './ReactNativeTypes';
17
packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js
+8 -4
@@ -13,13 +13,17 @@ import {
13 accumulateDirectDispatches,
14 } from 'events/EventPropagators';
15 import type {TopLevelType} from 'events/TopLevelEventTypes';
16 -import {
16 +import SyntheticEvent from 'events/SyntheticEvent';
17 +import invariant from 'shared/invariant';
18 +
19 +// Module provided by RN:
20 +import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
21 +
22 +const {
23 customBubblingEventTypes,
24 customDirectEventTypes,
25 eventTypes,
20 -} from 'ReactNativeViewConfigRegistry';
21 -import SyntheticEvent from 'events/SyntheticEvent';
22 -import invariant from 'shared/invariant';
26 +} = ReactNativeViewConfigRegistry;
27
28 const ReactNativeBridgeEventPlugin = {
29 eventTypes: eventTypes,
packages/react-native-renderer/src/ReactNativeComponent.js
+4 -2
@@ -18,8 +18,10 @@ import type {
18
19 import React from 'react';
20 // Modules provided by RN:
21 -import TextInputState from 'TextInputState';
22 -import UIManager from 'UIManager';
21 +import {
22 + TextInputState,
23 + UIManager,
24 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
25
26 import {create} from './ReactNativeAttributePayload';
27 import {mountSafeCallback_NOT_REALLY_SAFE} from './NativeMethodsMixinUtils';
packages/react-native-renderer/src/ReactNativeFiberHostComponent.js
+4 -2
@@ -17,8 +17,10 @@ import type {
17 import type {Instance} from './ReactNativeHostConfig';
18
19 // Modules provided by RN:
20 -import TextInputState from 'TextInputState';
21 -import UIManager from 'UIManager';
20 +import {
21 + TextInputState,
22 + UIManager,
23 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
24
25 import {create} from './ReactNativeAttributePayload';
26 import {
packages/react-native-renderer/src/ReactNativeFiberInspector.js
+1 -1
@@ -17,7 +17,7 @@ import getComponentName from 'shared/getComponentName';
17 import {HostComponent} from 'shared/ReactWorkTags';
18 import invariant from 'shared/invariant';
19 // Module provided by RN:
20 -import UIManager from 'UIManager';
20 +import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
21
22 import {getClosestInstanceFromNode} from './ReactNativeComponentTree';
23
packages/react-native-renderer/src/ReactNativeGlobalResponderHandler.js
+1 -1
@@ -8,7 +8,7 @@
8 */
9
10 // Module provided by RN:
11 -import UIManager from 'UIManager';
11 +import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
12
13 const ReactNativeGlobalResponderHandler = {
14 onChange: function(from: any, to: any, blockNativeResponder: boolean) {
packages/react-native-renderer/src/ReactNativeHostConfig.js
+7 -3
@@ -13,10 +13,12 @@ import type {ReactEventComponentInstance} from 'shared/ReactTypes';
13 import invariant from 'shared/invariant';
14
15 // Modules provided by RN:
16 -import UIManager from 'UIManager';
17 -import deepFreezeAndThrowOnMutationInDev from 'deepFreezeAndThrowOnMutationInDev';
16 +import {
17 + ReactNativeViewConfigRegistry,
18 + UIManager,
19 + deepFreezeAndThrowOnMutationInDev,
20 +} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
21
19 -import {get as getViewConfigForType} from 'ReactNativeViewConfigRegistry';
22 import {create, diff} from './ReactNativeAttributePayload';
23 import {
24 precacheFiberNode,
@@ -25,6 +27,8 @@ import {
27 } from './ReactNativeComponentTree';
28 import ReactNativeFiberHostComponent from './ReactNativeFiberHostComponent';
29
30 +const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
31 +
32 export type Type = string;
33 export type Props = Object;
34 export type Container = number;
packages/react-native-renderer/src/ReactNativeInjection.js
+1 -1
@@ -20,7 +20,7 @@ import ReactNativeGlobalResponderHandler from './ReactNativeGlobalResponderHandl
20 import ResponderEventPlugin from 'events/ResponderEventPlugin';
21
22 // Module provided by RN:
23 -import RCTEventEmitter from 'RCTEventEmitter';
23 +import {RCTEventEmitter} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
24
25 /**
26 * Register the event emitter with the native bridge
packages/react-native-renderer/src/ReactNativeInjectionShared.js
+1 -1
@@ -14,7 +14,7 @@
14 * TODO: require this in packager, not in React #10932517
15 */
16 // Module provided by RN:
17 -import 'InitializeCore';
17 +import 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore';
18
19 import {injection as EventPluginHubInjection} from 'events/EventPluginHub';
20 import ResponderEventPlugin from 'events/ResponderEventPlugin';
packages/react-native-renderer/src/ReactNativeRenderer.js
+1 -1
@@ -33,7 +33,7 @@ import {
33 } from 'events/ReactGenericBatching';
34 import ReactVersion from 'shared/ReactVersion';
35 // Module provided by RN:
36 -import UIManager from 'UIManager';
36 +import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
37
38 import NativeMethodsMixin from './NativeMethodsMixin';
39 import ReactNativeComponent from './ReactNativeComponent';
packages/react-native-renderer/src/ReactNativeRendererSharedExports.js
+1 -1
@@ -13,7 +13,7 @@ import {warnForStyleProps} from './NativeMethodsMixinUtils';
13 import warningWithoutStack from 'shared/warningWithoutStack';
14
15 // Module provided by RN:
16 -import UIManager from 'UIManager';
16 +import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
17
18 export function setNativeProps(handle: any, nativeProps: Object): void {
19 if (handle._nativeTag == null) {
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/BatchedBridge.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ExceptionsManager.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js renamed
+1 -1
@@ -172,4 +172,4 @@ const RCTFabricUIManager = {
172 }),
173 };
174
175 -module.exports = RCTFabricUIManager;
175 +global.nativeFabricUIManager = RCTFabricUIManager;
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/Platform.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/RCTEventEmitter.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js renamed
+2
@@ -3,6 +3,8 @@
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 + *
7 + * @flow strict
8 */
9
10 'use strict';
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js new
+41
@@ -0,0 +1,41 @@
1 +/**
2 + * Copyright (c) Facebook, Inc. and its affiliates.
3 + *
4 + * This source code is licensed under the MIT license found in the
5 + * LICENSE file in the root directory of this source tree.
6 + *
7 + * @flow strict-local
8 + */
9 +
10 +module.exports = {
11 + get BatchedBridge() {
12 + return require('./BatchedBridge.js');
13 + },
14 + get ExceptionsManager() {
15 + return require('./ExceptionsManager');
16 + },
17 + get Platform() {
18 + return require('./Platform');
19 + },
20 + get RCTEventEmitter() {
21 + return require('./RCTEventEmitter');
22 + },
23 + get ReactNativeViewConfigRegistry() {
24 + return require('./ReactNativeViewConfigRegistry');
25 + },
26 + get TextInputState() {
27 + return require('./TextInputState');
28 + },
29 + get UIManager() {
30 + return require('./UIManager');
31 + },
32 + get deepDiffer() {
33 + return require('./deepDiffer');
34 + },
35 + get deepFreezeAndThrowOnMutationInDev() {
36 + return require('./deepFreezeAndThrowOnMutationInDev');
37 + },
38 + get flattenStyle() {
39 + return require('./flattenStyle');
40 + },
41 +};
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ReactNativeViewConfigRegistry.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/TextInputState.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/UIManager.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/deepDiffer.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/deepFreezeAndThrowOnMutationInDev.js renamed
packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/flattenStyle.js renamed
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+112 -68
@@ -16,7 +16,6 @@ let ReactFeatureFlags;
16 let createReactClass;
17 let createReactNativeComponentClass;
18 let UIManager;
19 -let FabricUIManager;
19 let StrictMode;
20 let NativeMethodsMixin;
21
@@ -31,28 +30,25 @@ describe('ReactFabric', () => {
30 beforeEach(() => {
31 jest.resetModules();
32
33 + require('react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager');
34 +
35 React = require('react');
36 StrictMode = React.StrictMode;
37 ReactFeatureFlags = require('shared/ReactFeatureFlags');
38 ReactFeatureFlags.warnAboutDeprecatedSetNativeProps = true;
39 ReactFabric = require('react-native-renderer/fabric');
39 - FabricUIManager = require('FabricUIManager');
40 - UIManager = require('UIManager');
40 + UIManager = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
41 + .UIManager;
42 createReactClass = require('create-react-class/factory')(
43 React.Component,
44 React.isValidElement,
45 new React.Component().updater,
46 );
46 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
47 - .register;
47 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
48 + .ReactNativeViewConfigRegistry.register;
49 NativeMethodsMixin =
50 ReactFabric.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
51 .NativeMethodsMixin;
51 -
52 - global.nativeFabricUIManager = {
53 - measure: FabricUIManager.measure,
54 - measureInWindow: FabricUIManager.measureInWindow,
55 - };
52 });
53
54 it('should be able to create and render a native component', () => {
@@ -62,9 +58,9 @@ describe('ReactFabric', () => {
58 }));
59
60 ReactFabric.render(<View foo="test" />, 1);
65 - expect(FabricUIManager.createNode).toBeCalled();
66 - expect(FabricUIManager.appendChild).not.toBeCalled();
67 - expect(FabricUIManager.completeRoot).toBeCalled();
61 + expect(nativeFabricUIManager.createNode).toBeCalled();
62 + expect(nativeFabricUIManager.appendChild).not.toBeCalled();
63 + expect(nativeFabricUIManager.completeRoot).toBeCalled();
64 });
65
66 it('should be able to create and update a native component', () => {
@@ -75,20 +71,24 @@ describe('ReactFabric', () => {
71
72 const firstNode = {};
73
78 - FabricUIManager.createNode.mockReturnValue(firstNode);
74 + nativeFabricUIManager.createNode.mockReturnValue(firstNode);
75
76 ReactFabric.render(<View foo="foo" />, 11);
77
82 - expect(FabricUIManager.createNode).toHaveBeenCalledTimes(1);
78 + expect(nativeFabricUIManager.createNode).toHaveBeenCalledTimes(1);
79
80 ReactFabric.render(<View foo="bar" />, 11);
81
86 - expect(FabricUIManager.createNode).toHaveBeenCalledTimes(1);
87 - expect(FabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(1);
88 - expect(FabricUIManager.cloneNodeWithNewProps.mock.calls[0][0]).toBe(
82 + expect(nativeFabricUIManager.createNode).toHaveBeenCalledTimes(1);
83 + expect(nativeFabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(
84 + 1,
85 + );
86 + expect(nativeFabricUIManager.cloneNodeWithNewProps.mock.calls[0][0]).toBe(
87 firstNode,
88 );
91 - expect(FabricUIManager.cloneNodeWithNewProps.mock.calls[0][1]).toEqual({
89 + expect(
90 + nativeFabricUIManager.cloneNodeWithNewProps.mock.calls[0][1],
91 + ).toEqual({
92 foo: 'bar',
93 });
94 });
@@ -100,39 +100,57 @@ describe('ReactFabric', () => {
100 }));
101
102 ReactFabric.render(<Text foo="a">1</Text>, 11);
103 - expect(FabricUIManager.cloneNode).not.toBeCalled();
104 - expect(FabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
105 - expect(FabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
106 - expect(FabricUIManager.cloneNodeWithNewChildrenAndProps).not.toBeCalled();
103 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
104 + expect(nativeFabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
105 + expect(nativeFabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
106 + expect(
107 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
108 + ).not.toBeCalled();
109
110 // If no properties have changed, we shouldn't call cloneNode.
111 ReactFabric.render(<Text foo="a">1</Text>, 11);
110 - expect(FabricUIManager.cloneNode).not.toBeCalled();
111 - expect(FabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
112 - expect(FabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
113 - expect(FabricUIManager.cloneNodeWithNewChildrenAndProps).not.toBeCalled();
112 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
113 + expect(nativeFabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
114 + expect(nativeFabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
115 + expect(
116 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
117 + ).not.toBeCalled();
118
119 // Only call cloneNode for the changed property (and not for text).
120 ReactFabric.render(<Text foo="b">1</Text>, 11);
117 - expect(FabricUIManager.cloneNode).not.toBeCalled();
118 - expect(FabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
119 - expect(FabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(1);
120 - expect(FabricUIManager.cloneNodeWithNewChildrenAndProps).not.toBeCalled();
121 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
122 + expect(nativeFabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
123 + expect(nativeFabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(
124 + 1,
125 + );
126 + expect(
127 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
128 + ).not.toBeCalled();
129
130 // Only call cloneNode for the changed text (and no other properties).
131 ReactFabric.render(<Text foo="b">2</Text>, 11);
124 - expect(FabricUIManager.cloneNode).not.toBeCalled();
125 - expect(FabricUIManager.cloneNodeWithNewChildren).toHaveBeenCalledTimes(1);
126 - expect(FabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(1);
127 - expect(FabricUIManager.cloneNodeWithNewChildrenAndProps).not.toBeCalled();
132 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
133 + expect(
134 + nativeFabricUIManager.cloneNodeWithNewChildren,
135 + ).toHaveBeenCalledTimes(1);
136 + expect(nativeFabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(
137 + 1,
138 + );
139 + expect(
140 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
141 + ).not.toBeCalled();
142
143 // Call cloneNode for both changed text and properties.
144 ReactFabric.render(<Text foo="c">3</Text>, 11);
131 - expect(FabricUIManager.cloneNode).not.toBeCalled();
132 - expect(FabricUIManager.cloneNodeWithNewChildren).toHaveBeenCalledTimes(1);
133 - expect(FabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(1);
145 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
146 expect(
135 - FabricUIManager.cloneNodeWithNewChildrenAndProps,
147 + nativeFabricUIManager.cloneNodeWithNewChildren,
148 + ).toHaveBeenCalledTimes(1);
149 + expect(nativeFabricUIManager.cloneNodeWithNewProps).toHaveBeenCalledTimes(
150 + 1,
151 + );
152 + expect(
153 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
154 ).toHaveBeenCalledTimes(1);
155 });
156
@@ -148,10 +166,12 @@ describe('ReactFabric', () => {
166 </Text>,
167 11,
168 );
151 - expect(FabricUIManager.cloneNode).not.toBeCalled();
152 - expect(FabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
153 - expect(FabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
154 - expect(FabricUIManager.cloneNodeWithNewChildrenAndProps).not.toBeCalled();
169 + expect(nativeFabricUIManager.cloneNode).not.toBeCalled();
170 + expect(nativeFabricUIManager.cloneNodeWithNewChildren).not.toBeCalled();
171 + expect(nativeFabricUIManager.cloneNodeWithNewProps).not.toBeCalled();
172 + expect(
173 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps,
174 + ).not.toBeCalled();
175
176 ReactFabric.render(
177 <Text foo="a" bar="b">
@@ -159,10 +179,14 @@ describe('ReactFabric', () => {
179 </Text>,
180 11,
181 );
162 - expect(FabricUIManager.cloneNodeWithNewProps.mock.calls[0][1]).toEqual({
182 + expect(
183 + nativeFabricUIManager.cloneNodeWithNewProps.mock.calls[0][1],
184 + ).toEqual({
185 bar: 'b',
186 });
165 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
187 + expect(
188 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
189 + ).toMatchSnapshot();
190
191 ReactFabric.render(
192 <Text foo="b" bar="b">
@@ -171,11 +195,13 @@ describe('ReactFabric', () => {
195 11,
196 );
197 expect(
174 - FabricUIManager.cloneNodeWithNewChildrenAndProps.mock.calls[0][1],
198 + nativeFabricUIManager.cloneNodeWithNewChildrenAndProps.mock.calls[0][1],
199 ).toEqual({
200 foo: 'b',
201 });
178 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
202 + expect(
203 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
204 + ).toMatchSnapshot();
205 });
206
207 it('should not call UIManager.updateView from ref.setNativeProps', () => {
@@ -327,7 +353,7 @@ describe('ReactFabric', () => {
353 });
354
355 [View, Subclass, CreateClass].forEach(Component => {
330 - FabricUIManager.measure.mockClear();
356 + nativeFabricUIManager.measure.mockClear();
357
358 let viewRef;
359 ReactFabric.render(
@@ -339,10 +365,10 @@ describe('ReactFabric', () => {
365 11,
366 );
367
342 - expect(FabricUIManager.measure).not.toBeCalled();
368 + expect(nativeFabricUIManager.measure).not.toBeCalled();
369 const successCallback = jest.fn();
370 viewRef.measure(successCallback);
345 - expect(FabricUIManager.measure).toHaveBeenCalledTimes(1);
371 + expect(nativeFabricUIManager.measure).toHaveBeenCalledTimes(1);
372 expect(successCallback).toHaveBeenCalledTimes(1);
373 expect(successCallback).toHaveBeenCalledWith(10, 10, 100, 100, 0, 0);
374 });
@@ -368,7 +394,7 @@ describe('ReactFabric', () => {
394 });
395
396 [View, Subclass, CreateClass].forEach(Component => {
371 - FabricUIManager.measureInWindow.mockClear();
397 + nativeFabricUIManager.measureInWindow.mockClear();
398
399 let viewRef;
400 ReactFabric.render(
@@ -380,10 +406,10 @@ describe('ReactFabric', () => {
406 11,
407 );
408
383 - expect(FabricUIManager.measureInWindow).not.toBeCalled();
409 + expect(nativeFabricUIManager.measureInWindow).not.toBeCalled();
410 const successCallback = jest.fn();
411 viewRef.measureInWindow(successCallback);
386 - expect(FabricUIManager.measureInWindow).toHaveBeenCalledTimes(1);
412 + expect(nativeFabricUIManager.measureInWindow).toHaveBeenCalledTimes(1);
413 expect(successCallback).toHaveBeenCalledTimes(1);
414 expect(successCallback).toHaveBeenCalledWith(10, 10, 100, 100);
415 });
@@ -396,7 +422,7 @@ describe('ReactFabric', () => {
422 }));
423
424 [View].forEach(Component => {
399 - FabricUIManager.measureLayout.mockClear();
425 + nativeFabricUIManager.measureLayout.mockClear();
426
427 let viewRef;
428 let otherRef;
@@ -417,11 +443,11 @@ describe('ReactFabric', () => {
443 11,
444 );
445
420 - expect(FabricUIManager.measureLayout).not.toBeCalled();
446 + expect(nativeFabricUIManager.measureLayout).not.toBeCalled();
447 const successCallback = jest.fn();
448 const failureCallback = jest.fn();
449 viewRef.measureLayout(otherRef, successCallback, failureCallback);
424 - expect(FabricUIManager.measureLayout).toHaveBeenCalledTimes(1);
450 + expect(nativeFabricUIManager.measureLayout).toHaveBeenCalledTimes(1);
451 expect(successCallback).toHaveBeenCalledTimes(1);
452 expect(successCallback).toHaveBeenCalledWith(1, 1, 100, 100);
453 });
@@ -447,7 +473,7 @@ describe('ReactFabric', () => {
473 });
474
475 [Subclass, CreateClass].forEach(Component => {
450 - FabricUIManager.measureLayout.mockReset();
476 + nativeFabricUIManager.measureLayout.mockReset();
477
478 let viewRef;
479 let otherRef;
@@ -484,7 +510,7 @@ describe('ReactFabric', () => {
510 },
511 );
512
487 - expect(FabricUIManager.measureLayout).not.toBeCalled();
513 + expect(nativeFabricUIManager.measureLayout).not.toBeCalled();
514 expect(UIManager.measureLayout).not.toBeCalled();
515 });
516 });
@@ -530,10 +556,14 @@ describe('ReactFabric', () => {
556 const after = 'mxhpgwfralkeoivcstzy';
557
558 ReactFabric.render(<Component chars={before} />, 11);
533 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
559 + expect(
560 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
561 + ).toMatchSnapshot();
562
563 ReactFabric.render(<Component chars={after} />, 11);
536 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
564 + expect(
565 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
566 + ).toMatchSnapshot();
567 });
568
569 it('recreates host parents even if only children changed', () => {
@@ -565,14 +595,18 @@ describe('ReactFabric', () => {
595 </View>,
596 11,
597 );
568 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
598 + expect(
599 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
600 + ).toMatchSnapshot();
601
602 // Call setState() so that we skip over the top-level host node.
603 // It should still get recreated despite a bailout.
604 ref.current.setState({
605 chars: after,
606 });
575 - expect(FabricUIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot();
607 + expect(
608 + nativeFabricUIManager.__dumpHierarchyForJestTestsOnly(),
609 + ).toMatchSnapshot();
610 });
611
612 it('calls setState with no arguments', () => {
@@ -597,12 +631,12 @@ describe('ReactFabric', () => {
631 }));
632
633 const snapshots = [];
600 - FabricUIManager.completeRoot.mockImplementation(function(
634 + nativeFabricUIManager.completeRoot.mockImplementation(function(
635 rootTag,
636 newChildSet,
637 ) {
638 snapshots.push(
605 - FabricUIManager.__dumpChildSetForJestTestsOnly(newChildSet),
639 + nativeFabricUIManager.__dumpChildSetForJestTestsOnly(newChildSet),
640 );
641 });
642
@@ -704,11 +738,21 @@ describe('ReactFabric', () => {
738
739 ReactFabric.render(<View onTouchStart={touchStart} />, 11);
740
707 - expect(FabricUIManager.createNode.mock.calls.length).toBe(1);
708 - expect(FabricUIManager.registerEventHandler.mock.calls.length).toBe(1);
741 + expect(nativeFabricUIManager.createNode.mock.calls.length).toBe(1);
742 + expect(nativeFabricUIManager.registerEventHandler.mock.calls.length).toBe(
743 + 1,
744 + );
745
710 - let [, , , , instanceHandle] = FabricUIManager.createNode.mock.calls[0];
711 - let [dispatchEvent] = FabricUIManager.registerEventHandler.mock.calls[0];
746 + let [
747 + ,
748 + ,
749 + ,
750 + ,
751 + instanceHandle,
752 + ] = nativeFabricUIManager.createNode.mock.calls[0];
753 + let [
754 + dispatchEvent,
755 + ] = nativeFabricUIManager.registerEventHandler.mock.calls[0];
756
757 let touchEvent = {
758 touches: [],
packages/react-native-renderer/src/__tests__/ReactFabricAndNative-test.internal.js
+5 -3
@@ -19,17 +19,19 @@ let createReactNativeComponentClass;
19 describe('ReactFabric', () => {
20 beforeEach(() => {
21 jest.resetModules();
22 + require('react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager');
23 ReactNative = require('react-native-renderer');
23 - UIManager = require('UIManager');
24 jest.resetModules();
25 + UIManager = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
26 + .UIManager;
27 jest.mock('shared/ReactFeatureFlags', () =>
28 require('shared/forks/ReactFeatureFlags.native-oss'),
29 );
30
31 React = require('react');
32 ReactFabric = require('react-native-renderer/fabric');
31 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
32 - .register;
33 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
34 + .ReactNativeViewConfigRegistry.register;
35 });
36
37 it('find Fabric nodes with the RN renderer', () => {
packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js
+2 -2
@@ -25,8 +25,8 @@ describe('ReactNativeError', () => {
25
26 React = require('react');
27 ReactNative = require('react-native-renderer');
28 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
29 - .register;
28 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
29 + .ReactNativeViewConfigRegistry.register;
30 computeComponentStackForErrorReporting =
31 ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
32 .computeComponentStackForErrorReporting;
packages/react-native-renderer/src/__tests__/ReactNativeEvents-test.internal.js
+6 -4
@@ -64,13 +64,15 @@ beforeEach(() => {
64 jest.resetModules();
65
66 PropTypes = require('prop-types');
67 - RCTEventEmitter = require('RCTEventEmitter');
67 + RCTEventEmitter = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
68 + .RCTEventEmitter;
69 React = require('react');
70 ReactNative = require('react-native-renderer');
71 ResponderEventPlugin = require('events/ResponderEventPlugin').default;
71 - UIManager = require('UIManager');
72 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
73 - .register;
72 + UIManager = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
73 + .UIManager;
74 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
75 + .ReactNativeViewConfigRegistry.register;
76 });
77
78 it('fails if unknown/unsupported event types are dispatched', () => {
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+4 -3
@@ -34,14 +34,15 @@ describe('ReactNative', () => {
34 ReactFeatureFlags = require('shared/ReactFeatureFlags');
35 ReactFeatureFlags.warnAboutDeprecatedSetNativeProps = true;
36 ReactNative = require('react-native-renderer');
37 - UIManager = require('UIManager');
37 + UIManager = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
38 + .UIManager;
39 createReactClass = require('create-react-class/factory')(
40 React.Component,
41 React.isValidElement,
42 new React.Component().updater,
43 );
43 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
44 - .register;
44 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
45 + .ReactNativeViewConfigRegistry.register;
46 NativeMethodsMixin =
47 ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
48 .NativeMethodsMixin;
packages/react-native-renderer/src/__tests__/createReactNativeComponentClass-test.internal.js
+2 -2
@@ -18,8 +18,8 @@ describe('createReactNativeComponentClass', () => {
18 beforeEach(() => {
19 jest.resetModules();
20
21 - createReactNativeComponentClass = require('ReactNativeViewConfigRegistry')
22 - .register;
21 + createReactNativeComponentClass = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
22 + .ReactNativeViewConfigRegistry.register;
23 React = require('react');
24 ReactNative = require('react-native-renderer');
25 });
packages/react-reconciler/src/forks/ReactFiberErrorDialog.native.js
+1 -1
@@ -10,7 +10,7 @@
10 import type {CapturedError} from '../ReactCapturedValue';
11
12 // Module provided by RN:
13 -import ExceptionsManager from 'ExceptionsManager';
13 +import {ExceptionsManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
14
15 /**
16 * Intercept lifecycle errors and ensure they are shown with the correct stack
scripts/flow/react-native-host-hooks.js
+92 -123
@@ -18,137 +18,119 @@ import type {
18 } from 'react-native-renderer/src/ReactNativeTypes';
19 import type {RNTopLevelEventType} from 'events/TopLevelEventTypes';
20
21 -declare module 'deepDiffer' {
22 - declare module.exports: (one: any, two: any) => boolean;
23 -}
24 -declare module 'deepFreezeAndThrowOnMutationInDev' {
25 - declare module.exports: <T>(obj: T) => T;
26 -}
27 -declare module 'flattenStyle' {
28 -}
29 -declare module 'InitializeCore' {
30 -}
31 -declare module 'RCTEventEmitter' {
32 - declare function register(mixed): void;
33 -}
34 -declare module 'TextInputState' {
35 - declare function blurTextInput(object: any): void;
36 - declare function focusTextInput(object: any): void;
37 -}
38 -declare module 'ExceptionsManager' {
39 - declare function handleException(error: Error, isFatal: boolean): void;
40 -}
41 -declare module 'Platform' {
42 - declare var OS: string;
21 +declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' {
22 + declare export function deepDiffer(one: any, two: any): boolean;
23 + declare export function deepFreezeAndThrowOnMutationInDev<T>(obj: T): T;
24 + declare export function flattenStyle(style: any): any;
25 + declare export var RCTEventEmitter: {
26 + register: (eventEmitter: mixed) => void,
27 + };
28 + declare export var TextInputState: {
29 + blurTextInput: (object: any) => void,
30 + focusTextInput: (object: any) => void,
31 + };
32 + declare export var ExceptionsManager: {
33 + handleException: (error: Error, isFatal: boolean) => void,
34 + };
35 + declare export var Platform: {
36 + OS: string,
37 + };
38 + declare export var UIManager: {
39 + customBubblingEventTypes: Object,
40 + customDirectEventTypes: Object,
41 + createView: (
42 + reactTag: number,
43 + viewName: string,
44 + rootTag: number,
45 + props: ?Object,
46 + ) => void,
47 + manageChildren: (
48 + containerTag: number,
49 + moveFromIndices: Array<number>,
50 + moveToIndices: Array<number>,
51 + addChildReactTags: Array<number>,
52 + addAtIndices: Array<number>,
53 + removeAtIndices: Array<number>,
54 + ) => void,
55 + measure: (hostComponent: mixed, callback: Function) => void,
56 + measureInWindow: (nativeTag: ?number, callback: Function) => void,
57 + measureLayout: (
58 + nativeTag: mixed,
59 + nativeNode: number,
60 + onFail: Function,
61 + onSuccess: Function,
62 + ) => void,
63 + removeRootView: (containerTag: number) => void,
64 + removeSubviewsFromContainerWithID: (containerId: number) => void,
65 + replaceExistingNonRootView: () => void,
66 + setChildren: (containerTag: number, reactTags: Array<number>) => void,
67 + updateView: (reactTag: number, viewName: string, props: ?Object) => void,
68 + __takeSnapshot: (
69 + view?: 'window' | Element<any> | number,
70 + options?: {
71 + width?: number,
72 + height?: number,
73 + format?: 'png' | 'jpeg',
74 + quality?: number,
75 + },
76 + ) => Promise<any>,
77 + setJSResponder: (reactTag: number, blockNativeResponder: boolean) => void,
78 + clearJSResponder: () => void,
79 + };
80 + declare export var BatchedBridge: {
81 + registerCallableModule: (name: string, module: Object) => void,
82 + };
83 + declare export var ReactNativeViewConfigRegistry: {
84 + customBubblingEventTypes: Object,
85 + customDirectEventTypes: Object,
86 + eventTypes: Object,
87 +
88 + register: (name: string, callback: ViewConfigGetter) => string,
89 + get: (name: string) => ReactNativeBaseComponentViewConfig,
90 + };
91 }
44 -declare module 'UIManager' {
45 - declare var customBubblingEventTypes: Object;
46 - declare var customDirectEventTypes: Object;
47 - declare function createView(
48 - reactTag: number,
49 - viewName: string,
50 - rootTag: number,
51 - props: ?Object,
52 - ): void;
53 - declare function manageChildren(
54 - containerTag: number,
55 - moveFromIndices: Array<number>,
56 - moveToIndices: Array<number>,
57 - addChildReactTags: Array<number>,
58 - addAtIndices: Array<number>,
59 - removeAtIndices: Array<number>,
60 - ): void;
61 - declare function measure(hostComponent: mixed, callback: Function): void;
62 - declare function measureInWindow(
63 - nativeTag: ?number,
64 - callback: Function,
65 - ): void;
66 - declare function measureLayout(
67 - nativeTag: mixed,
68 - nativeNode: number,
69 - onFail: Function,
70 - onSuccess: Function,
71 - ): void;
72 - declare function removeRootView(containerTag: number): void;
73 - declare function removeSubviewsFromContainerWithID(containerId: number): void;
74 - declare function replaceExistingNonRootView(): void;
75 - declare function setChildren(
76 - containerTag: number,
77 - reactTags: Array<number>,
78 - ): void;
79 - declare function updateView(
80 - reactTag: number,
81 - viewName: string,
82 - props: ?Object,
83 - ): void;
84 - declare function __takeSnapshot(
85 - view?: 'window' | Element<any> | number,
86 - options?: {
87 - width?: number,
88 - height?: number,
89 - format?: 'png' | 'jpeg',
90 - quality?: number,
91 - },
92 - ): Promise<any>;
93 - declare function setJSResponder(
94 - reactTag: number,
95 - blockNativeResponder: boolean,
96 - ): void;
97 - declare function clearJSResponder(): void;
92 +
93 +declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore' {
94 }
95
100 -declare module 'FabricUIManager' {
101 - declare function createNode(
96 +// This is needed for a short term solution.
97 +// See https://github.com/facebook/react/pull/15490 for more info
98 +declare var nativeFabricUIManager: {
99 + createNode: (
100 reactTag: number,
101 viewName: string,
102 rootTag: number,
103 props: ?Object,
104 eventTarget: Object,
107 - ): Object;
108 - declare function cloneNode(node: Object): Object;
109 - declare function cloneNodeWithNewChildren(node: Object): Object;
110 - declare function cloneNodeWithNewProps(
111 - node: Object,
112 - newProps: ?Object,
113 - ): Object;
114 - declare function cloneNodeWithNewChildrenAndProps(
115 - node: Object,
116 - newProps: ?Object,
117 - ): Object;
118 - declare function appendChild(node: Object, childNode: Object): void;
105 + ) => Object,
106 + cloneNode: (node: Object) => Object,
107 + cloneNodeWithNewChildren: (node: Object) => Object,
108 + cloneNodeWithNewProps: (node: Object, newProps: ?Object) => Object,
109 + cloneNodeWithNewChildrenAndProps: (node: Object, newProps: ?Object) => Object,
110 + appendChild: (node: Object, childNode: Object) => void,
111
120 - declare function createChildSet(rootTag: number): Object;
121 - declare function appendChildToSet(childSet: Object, childNode: Object): void;
122 - declare function completeRoot(rootTag: number, childSet: Object): void;
123 - declare function registerEventHandler(
112 + createChildSet: (rootTag: number) => Object,
113 + appendChildToSet: (childSet: Object, childNode: Object) => void,
114 + completeRoot: (rootTag: number, childSet: Object) => void,
115 + registerEventHandler: (
116 callback: (
117 eventTarget: null | Object,
118 type: RNTopLevelEventType,
119 payload: Object,
120 ) => void,
129 - ): void;
121 + ) => void,
122
131 - declare function measure(
132 - node: Node,
133 - callback: MeasureOnSuccessCallback,
134 - ): void;
135 - declare function measureInWindow(
123 + measure: (node: Node, callback: MeasureOnSuccessCallback) => void,
124 + measureInWindow: (
125 node: Node,
126 callback: MeasureInWindowOnSuccessCallback,
138 - ): void;
139 - declare function measureLayout(
127 + ) => void,
128 + measureLayout: (
129 node: Node,
130 relativeNode: Node,
131 onFail: () => void,
132 onSuccess: MeasureLayoutOnSuccessCallback,
144 - ): void;
145 -}
146 -
147 -// This is needed for a short term solution.
148 -// See https://github.com/facebook/react/pull/15490 for more info
149 -declare var nativeFabricUIManager: {
150 - measure(node: Node, callback: MeasureOnSuccessCallback): void,
151 - measureInWindow(node: Node, callback: MeasureInWindowOnSuccessCallback): void,
133 + ) => void,
134 };
135
136 declare module 'View' {
@@ -175,16 +157,3 @@ declare module 'RTManager' {
157
158 declare function completeUpdates(): void;
159 }
178 -
179 -declare module 'BatchedBridge' {
180 - declare function registerCallableModule(name: string, module: Object): void;
181 -}
182 -
183 -declare module 'ReactNativeViewConfigRegistry' {
184 - declare var customBubblingEventTypes: Object;
185 - declare var customDirectEventTypes: Object;
186 - declare var eventTypes: Object;
187 -
188 - declare function register(name: string, callback: ViewConfigGetter): string;
189 - declare function get(name: string): ReactNativeBaseComponentViewConfig;
190 -}
scripts/rollup/bundles.js
+4 -52
@@ -204,38 +204,14 @@ const bundles = [
204 moduleType: RENDERER,
205 entry: 'react-native-renderer',
206 global: 'ReactNativeRenderer',
207 - externals: [
208 - 'ExceptionsManager',
209 - 'InitializeCore',
210 - 'Platform',
211 - 'RCTEventEmitter',
212 - 'TextInputState',
213 - 'UIManager',
214 - 'FabricUIManager',
215 - 'deepDiffer',
216 - 'deepFreezeAndThrowOnMutationInDev',
217 - 'flattenStyle',
218 - 'ReactNativeViewConfigRegistry',
219 - ],
207 + externals: ['react-native'],
208 },
209 {
210 bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING],
211 moduleType: RENDERER,
212 entry: 'react-native-renderer',
213 global: 'ReactNativeRenderer',
226 - externals: [
227 - 'ExceptionsManager',
228 - 'InitializeCore',
229 - 'Platform',
230 - 'RCTEventEmitter',
231 - 'TextInputState',
232 - 'UIManager',
233 - 'FabricUIManager',
234 - 'deepDiffer',
235 - 'deepFreezeAndThrowOnMutationInDev',
236 - 'flattenStyle',
237 - 'ReactNativeViewConfigRegistry',
238 - ],
214 + externals: ['react-native'],
215 },
216
217 /******* React Native Fabric *******/
@@ -244,38 +220,14 @@ const bundles = [
220 moduleType: RENDERER,
221 entry: 'react-native-renderer/fabric',
222 global: 'ReactFabric',
247 - externals: [
248 - 'ExceptionsManager',
249 - 'InitializeCore',
250 - 'Platform',
251 - 'RCTEventEmitter',
252 - 'TextInputState',
253 - 'UIManager',
254 - 'FabricUIManager',
255 - 'deepDiffer',
256 - 'deepFreezeAndThrowOnMutationInDev',
257 - 'flattenStyle',
258 - 'ReactNativeViewConfigRegistry',
259 - ],
223 + externals: ['react-native'],
224 },
225 {
226 bundleTypes: [RN_OSS_DEV, RN_OSS_PROD, RN_OSS_PROFILING],
227 moduleType: RENDERER,
228 entry: 'react-native-renderer/fabric',
229 global: 'ReactFabric',
266 - externals: [
267 - 'ExceptionsManager',
268 - 'InitializeCore',
269 - 'Platform',
270 - 'RCTEventEmitter',
271 - 'TextInputState',
272 - 'UIManager',
273 - 'FabricUIManager',
274 - 'deepDiffer',
275 - 'deepFreezeAndThrowOnMutationInDev',
276 - 'flattenStyle',
277 - 'ReactNativeViewConfigRegistry',
278 - ],
230 + externals: ['react-native'],
231 },
232
233 /******* React Test Renderer *******/
scripts/rollup/modules.js
+1 -1
@@ -14,7 +14,7 @@ const HAS_NO_SIDE_EFFECTS_ON_IMPORT = false;
14 // const HAS_SIDE_EFFECTS_ON_IMPORT = true;
15 const importSideEffects = Object.freeze({
16 'prop-types/checkPropTypes': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
17 - deepFreezeAndThrowOnMutationInDev: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
17 + 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
18 scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
19 'scheduler/tracing': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
20 });