diff --git a/packages/react-native-renderer/src/ReactNativePublicCompat.js b/packages/react-native-renderer/src/ReactNativePublicCompat.js index 38e820dc30f0c..c38165f956ba3 100644 --- a/packages/react-native-renderer/src/ReactNativePublicCompat.js +++ b/packages/react-native-renderer/src/ReactNativePublicCompat.js @@ -8,8 +8,6 @@ */ import type {Node, HostComponent} from './ReactNativeTypes'; -import type {PublicInstance as FabricPublicInstance} from './ReactFiberConfigFabric'; -import type {PublicInstance as PaperPublicInstance} from './ReactFiberConfigNative'; import type {ElementRef, ElementType} from 'react'; // Modules provided by RN: @@ -225,6 +223,11 @@ export function getNodeFromInternalInstanceHandle( ); } +// Should have been PublicInstance from ReactFiberConfigFabric +type FabricPublicInstance = mixed; +// Should have been PublicInstance from ReactFiberConfigNative +type PaperPublicInstance = HostComponent; + // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN. export function isChildPublicInstance( parentInstance: FabricPublicInstance | PaperPublicInstance, @@ -251,8 +254,10 @@ export function isChildPublicInstance( } const parentInternalInstanceHandle = + // $FlowExpectedError[incompatible-call] PublicInstance from ReactNativeTypes is opaque, treat it as PublicInstance from ReactFiberConfigFabric. getInternalInstanceHandleFromPublicInstance(parentInstance); const childInternalInstanceHandle = + // $FlowExpectedError[incompatible-call] PublicInstance from ReactNativeTypes is opaque, treat it as PublicInstance from ReactFiberConfigFabric. getInternalInstanceHandleFromPublicInstance(childInstance); // Fabric diff --git a/packages/react-native-renderer/src/ReactNativeTypes.js b/packages/react-native-renderer/src/ReactNativeTypes.js index f2ae65a82c380..c61ee86be4f86 100644 --- a/packages/react-native-renderer/src/ReactNativeTypes.js +++ b/packages/react-native-renderer/src/ReactNativeTypes.js @@ -191,6 +191,10 @@ export type ReactNativeType = { findNodeHandle( componentOrHandle: ?(ElementRef | number), ): ?number, + isChildPublicInstance( + parent: PublicInstance | HostComponent, + child: PublicInstance | HostComponent, + ): boolean, dispatchCommand( handle: ElementRef>, command: string, @@ -229,6 +233,7 @@ export type ReactFabricType = { command: string, args: Array, ): void, + isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean, sendAccessibilityEvent( handle: ElementRef>, eventType: string,