Skip to content

Commit 9cd8825

Browse files
idefacebook-github-bot
authored andcommitted
ReactPrivate, an explicit interface between the renderer and RN (facebook#24782)
Summary: This introduces a new library named "ReactPrivate" that defines an explicit interface between the React renderers generated by the React repo and the code within RN. Previously, the React renderers would reach into RN internals via Haste wormholes. With this commit, there is now an explicit module (`ReactNativePrivateInterface`) that the renderers use to access RN internals. Motivation: The main goal is to move one step closer to turning off Haste for RN (facebook#24316). Since the generated renderers currently use Haste, this commit sets the foundation for giving them a path-based interface to access RN internals. Additionally, this approach inverts abstraction control since RN needs to intentionally export its internals via the private interface instead of React reaching in via Haste. There will also need to be a corresponding commit to the React repo to make the renderers use this new interface. This RN commit needs to land before the React commit. ## Changelog [General] [Changed] - Add a private interface (do not use) between the renderer and RN Pull Request resolved: facebook#24782 Differential Revision: D15413477 Pulled By: cpojer fbshipit-source-id: 3766ad4cf129fad0c82f0ddc7a485a4ba313b2c4
1 parent 3ccfbd6 commit 9cd8825

12 files changed

+45
-127
lines changed

Libraries/Animated/release/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/lib/
21
/dist/
32
/node_modules/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
JS modules in this folder are forwarding modules to allow React to require React Native internals as node dependencies.
1+
JS modules in this folder are forwarding modules to allow React to require React Native internals.

lib/View.js renamed to Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,4 @@
88
* @flow strict-local
99
*/
1010

11-
'use strict';
12-
13-
// This is a forwarding module to allow React to require React Native internals
14-
// as node dependency
15-
module.exports = require('View');
11+
import '../Core/InitializeCore';
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
* @format
8+
* @flow strict-local
9+
*/
10+
11+
// flowlint unsafe-getters-setters:off
12+
module.exports = {
13+
get BatchedBridge() {
14+
return require('../BatchedBridge/BatchedBridge.js');
15+
},
16+
get ExceptionsManager() {
17+
return require('../Core/ExceptionsManager');
18+
},
19+
get Platform() {
20+
return require('../Utilities/Platform');
21+
},
22+
get RCTEventEmitter() {
23+
return require('../EventEmitter/RCTEventEmitter');
24+
},
25+
get ReactNativeViewConfigRegistry() {
26+
return require('../Renderer/shims/ReactNativeViewConfigRegistry');
27+
},
28+
get TextInputState() {
29+
return require('../Components/TextInput/TextInputState');
30+
},
31+
get UIManager() {
32+
return require('../ReactNative/UIManager');
33+
},
34+
get deepDiffer() {
35+
return require('../Utilities/differ/deepDiffer');
36+
},
37+
get deepFreezeAndThrowOnMutationInDev() {
38+
return require('../Utilities/deepFreezeAndThrowOnMutationInDev');
39+
},
40+
get flattenStyle() {
41+
return require('../StyleSheet/flattenStyle');
42+
},
43+
};

lib/InitializeJavaScriptAppEngine.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/RCTEventEmitter.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/TextInputState.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/UIManager.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/UIManagerStatTracker.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/deepDiffer.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/deepFreezeAndThrowOnMutationInDev.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

lib/flattenStyle.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)