Skip to content

Commit 5438d58

Browse files
committed
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 #15604 (review) for more context).
1 parent 10eab79 commit 5438d58

File tree

6 files changed

+146
-114
lines changed

6 files changed

+146
-114
lines changed

packages/react-native-renderer/src/ReactFabricHostConfig.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {dispatchEvent} from './ReactFabricEventEmitter';
2626

2727
// Modules provided by RN:
2828
import {
29-
FabricUIManager,
3029
ReactNativeViewConfigRegistry,
3130
TextInputState,
3231
deepFreezeAndThrowOnMutationInDev,
@@ -46,7 +45,7 @@ const {
4645
measure: fabricMeasure,
4746
measureInWindow: fabricMeasureInWindow,
4847
measureLayout: fabricMeasureLayout,
49-
} = FabricUIManager;
48+
} = nativeFabricUIManager;
5049

5150
const {get: getViewConfigForType} = ReactNativeViewConfigRegistry;
5251

packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/FabricUIManager.js renamed to packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,4 @@ const RCTFabricUIManager = {
172172
}),
173173
};
174174

175-
module.exports = RCTFabricUIManager;
175+
global.nativeFabricUIManager = RCTFabricUIManager;

packages/react-native-renderer/src/__mocks__/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ module.exports = {
1717
get Platform() {
1818
return require('./Platform');
1919
},
20-
get FabricUIManager() {
21-
return require('./FabricUIManager');
22-
},
2320
get RCTEventEmitter() {
2421
return require('./RCTEventEmitter');
2522
},

0 commit comments

Comments
 (0)