From 2f7cc0f3b5b1f0835081846a3dca3b5418974e00 Mon Sep 17 00:00:00 2001 From: hoxyq Date: Tue, 5 Dec 2023 06:15:52 -0800 Subject: [PATCH] fix: add isChildPublicInstance to ReactNativeTypes (#27788) Summary: Changelog: [Internal] Follow-up on https://github.com/facebook/react/pull/27783. React Native is actually using `ReactNativeTypes`, which are synced from this repo. In order to make `isChildPublicInstance` visible for renderers inside React Native repository, we need to list it in `ReactNativeTypes`. Because of current circular dependency between React Native and React, it is impossible to actually type it properly: - Can't import any types in `ReactNativeTypes` from local files, because it will break React Native, once synced. - Implementations can't use real types in their definitions, because it will break these checks: https://github.com/facebook/react/blob/223db40d5a04dc3311f963f5296675f7f43139e8/packages/react-native-renderer/fabric.js#L12-L13 https://github.com/facebook/react/blob/223db40d5a04dc3311f963f5296675f7f43139e8/packages/react-native-renderer/index.js#L12-L14 DiffTrain build for commit https://github.com/facebook/react/commit/c29ca23af91d8aeb9e175c08a0866ba54286f0f3. Differential Revision: D51849040 --- .../Libraries/Renderer/shims/ReactNativeTypes.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js index e994301ee60..cf96ea78f14 100644 --- a/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js @@ -7,7 +7,7 @@ * @noformat * @flow strict * @nolint - * @generated SignedSource<<1836a1b6639552dce12199ef2c85f63d>> + * @generated SignedSource<<30640e7dd83e22e14db1648ca63f4316>> */ import type {ElementRef, ElementType, Element, AbstractComponent} from 'react'; @@ -193,6 +193,10 @@ export type ReactNativeType = { findNodeHandle( componentOrHandle: ?(ElementRef | number), ): ?number, + isChildPublicInstance( + parent: PublicInstance | HostComponent, + child: PublicInstance | HostComponent, + ): boolean, dispatchCommand( handle: ElementRef>, command: string, @@ -231,6 +235,7 @@ export type ReactFabricType = { command: string, args: Array, ): void, + isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean, sendAccessibilityEvent( handle: ElementRef>, eventType: string,