mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Remove direct references to the global and untyped nativeFabricUIManager
Summary: We shouldn't be accessing `nativeFabricUIManager` directly because it's untyped and makes it harder to mock the values. This migrates all existing usages to the `FabricUIManager` module. In the long term, we should refactor this global binding as a TurboModule. Changelog: [internal] Reviewed By: yungsters Differential Revision: D44029301 fbshipit-source-id: d8300acb5dabe4ba27c7f0242230e203c0e8c674
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea57c923b4
commit
aee7d96fcd
@@ -10,13 +10,13 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {Spec as FabricUIManagerSpec} from '../ReactNative/FabricUIManager';
|
||||
import type {
|
||||
LayoutAnimationConfig as LayoutAnimationConfig_,
|
||||
LayoutAnimationProperty,
|
||||
LayoutAnimationType,
|
||||
} from '../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
import FabricUIManager from '../ReactNative/FabricUIManager';
|
||||
import ReactNativeFeatureFlags from '../ReactNative/ReactNativeFeatureFlags';
|
||||
import Platform from '../Utilities/Platform';
|
||||
|
||||
@@ -77,9 +77,8 @@ function configureNext(
|
||||
|
||||
// In Fabric, LayoutAnimations are unconditionally enabled for Android, and
|
||||
// conditionally enabled on iOS (pending fully shipping; this is a temporary state).
|
||||
const FabricUIManager: FabricUIManagerSpec = global?.nativeFabricUIManager;
|
||||
if (FabricUIManager?.configureNextLayoutAnimation) {
|
||||
global?.nativeFabricUIManager?.configureNextLayoutAnimation(
|
||||
FabricUIManager.configureNextLayoutAnimation(
|
||||
config,
|
||||
onAnimationComplete,
|
||||
onAnimationDidFail ??
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
*/
|
||||
|
||||
import type {RootTag} from '../Types/RootTagTypes';
|
||||
import type {Spec as FabricUIManagerSpec} from './FabricUIManager';
|
||||
import type {Spec} from './NativeUIManager';
|
||||
|
||||
import MaybeFabricUIManager from './FabricUIManager';
|
||||
import nullthrows from 'nullthrows';
|
||||
|
||||
export interface UIManagerJSInterface extends Spec {
|
||||
+getViewManagerConfig: (viewManagerName: string) => Object;
|
||||
+hasViewManagerConfig: (viewManagerName: string) => boolean;
|
||||
@@ -57,8 +59,7 @@ const UIManager = {
|
||||
) => void,
|
||||
): void {
|
||||
if (isFabricReactTag(reactTag)) {
|
||||
const FabricUIManager: FabricUIManagerSpec =
|
||||
global?.nativeFabricUIManager;
|
||||
const FabricUIManager = nullthrows(MaybeFabricUIManager);
|
||||
const shadowNode =
|
||||
FabricUIManager.findShadowNodeByTag_DEPRECATED(reactTag);
|
||||
if (shadowNode) {
|
||||
@@ -84,8 +85,7 @@ const UIManager = {
|
||||
) => void,
|
||||
): void {
|
||||
if (isFabricReactTag(reactTag)) {
|
||||
const FabricUIManager: FabricUIManagerSpec =
|
||||
global?.nativeFabricUIManager;
|
||||
const FabricUIManager = nullthrows(MaybeFabricUIManager);
|
||||
const shadowNode =
|
||||
FabricUIManager.findShadowNodeByTag_DEPRECATED(reactTag);
|
||||
if (shadowNode) {
|
||||
@@ -113,8 +113,7 @@ const UIManager = {
|
||||
) => void,
|
||||
): void {
|
||||
if (isFabricReactTag(reactTag)) {
|
||||
const FabricUIManager: FabricUIManagerSpec =
|
||||
global?.nativeFabricUIManager;
|
||||
const FabricUIManager = nullthrows(MaybeFabricUIManager);
|
||||
const shadowNode =
|
||||
FabricUIManager.findShadowNodeByTag_DEPRECATED(reactTag);
|
||||
const ancestorShadowNode =
|
||||
@@ -155,8 +154,7 @@ const UIManager = {
|
||||
console.warn(
|
||||
'RCTUIManager.measureLayoutRelativeToParent method is deprecated and it will not be implemented in newer versions of RN (Fabric) - T47686450',
|
||||
);
|
||||
const FabricUIManager: FabricUIManagerSpec =
|
||||
global?.nativeFabricUIManager;
|
||||
const FabricUIManager = nullthrows(MaybeFabricUIManager);
|
||||
const shadowNode =
|
||||
FabricUIManager.findShadowNodeByTag_DEPRECATED(reactTag);
|
||||
if (shadowNode) {
|
||||
|
||||
Reference in New Issue
Block a user