From 56c0affa35bc8d182b17aa3c8911ba6d19d42479 Mon Sep 17 00:00:00 2001 From: hoxyq Date: Tue, 5 Dec 2023 13:05:36 +0000 Subject: [PATCH] fix: add isChildPublicInstance to ReactNativeTypes (#27788) 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. --- .../react-test-renderer/cjs/ReactTestRenderer-dev.js | 2 +- .../cjs/ReactTestRenderer-prod.js | 4 ++-- .../cjs/ReactTestRenderer-profiling.js | 4 ++-- .../js/RKJSModules/vendor/react/cjs/React-dev.js | 2 +- .../js/RKJSModules/vendor/react/cjs/React-prod.js | 2 +- .../RKJSModules/vendor/react/cjs/React-profiling.js | 2 +- .../react-native-github/Libraries/Renderer/REVISION | 2 +- .../Renderer/implementations/ReactFabric-dev.fb.js | 12 +++++++----- .../implementations/ReactNativeRenderer-dev.fb.js | 12 +++++++----- .../Libraries/Renderer/shims/ReactNativeTypes.js | 7 ++++++- 10 files changed, 29 insertions(+), 20 deletions(-) diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js index ad08f74e0c71f..53dedb9138240 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js @@ -25474,7 +25474,7 @@ if (__DEV__) { return root; } - var ReactVersion = "18.3.0-canary-5ab6bbb4b-20231204"; + var ReactVersion = "18.3.0-canary-c29ca23af-20231205"; // Might add PROFILE later. diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js index e74d1a6e3c7ba..43fcf75d6e496 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js @@ -9083,7 +9083,7 @@ var devToolsConfig$jscomp$inline_1033 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-5ab6bbb4b-20231204", + version: "18.3.0-canary-c29ca23af-20231205", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1226 = { @@ -9114,7 +9114,7 @@ var internals$jscomp$inline_1226 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-5ab6bbb4b-20231204" + reconcilerVersion: "18.3.0-canary-c29ca23af-20231205" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js index 841f9c27de6f5..2c227c963b69d 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js @@ -9509,7 +9509,7 @@ var devToolsConfig$jscomp$inline_1075 = { throw Error("TestRenderer does not support findFiberByHostInstance()"); }, bundleType: 0, - version: "18.3.0-canary-5ab6bbb4b-20231204", + version: "18.3.0-canary-c29ca23af-20231205", rendererPackageName: "react-test-renderer" }; var internals$jscomp$inline_1267 = { @@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1267 = { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.3.0-canary-5ab6bbb4b-20231204" + reconcilerVersion: "18.3.0-canary-c29ca23af-20231205" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js index 2272225e810f7..bec70e8d08f56 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js @@ -24,7 +24,7 @@ if (__DEV__) { ) { __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); } - var ReactVersion = "18.3.0-canary-5ab6bbb4b-20231204"; + var ReactVersion = "18.3.0-canary-c29ca23af-20231205"; // ATTENTION // When adding new symbols to this file, diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js index 437694e875317..fc6b53c68c61f 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-5ab6bbb4b-20231204"; +exports.version = "18.3.0-canary-c29ca23af-20231205"; diff --git a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js index 97dedade627db..9a0e758eaa5b4 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js +++ b/compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js @@ -576,7 +576,7 @@ exports.useSyncExternalStore = function ( exports.useTransition = function () { return ReactCurrentDispatcher.current.useTransition(); }; -exports.version = "18.3.0-canary-5ab6bbb4b-20231204"; +exports.version = "18.3.0-canary-c29ca23af-20231205"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION index 22ff2fc11b6a8..a6b68bfdd727b 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/REVISION @@ -1 +1 @@ -5ab6bbb4b058e22658fc6d4734db5acfbf393345 +c29ca23af91d8aeb9e175c08a0866ba54286f0f3 diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 98714c0a5dd22..179b9b4ca2f63 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<685bf7c576463dfbb4cf704d94b8c71b>> + * @generated SignedSource<<86b0cafe89bf505872d503a476664cf5>> */ "use strict"; @@ -27829,7 +27829,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-ad95fe0f"; + var ReactVersion = "18.3.0-canary-e53565aa"; function createPortal$1( children, @@ -28711,7 +28711,9 @@ to return true:wantsResponderID| | internalInstanceHandle.stateNode && // $FlowExpectedError[incompatible-use] internalInstanceHandle.stateNode.node ); - } // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN. + } // Should have been PublicInstance from ReactFiberConfigFabric + // Should have been PublicInstance from ReactFiberConfigNative + // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN. function isChildPublicInstance(parentInstance, childInstance) { { @@ -28733,11 +28735,11 @@ to return true:wantsResponderID| | return false; } - var parentInternalInstanceHandle = + var parentInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric. ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance( parentInstance ); - var childInternalInstanceHandle = + var childInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric. ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance( childInstance ); // Fabric diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 5bf6087f95747..d1231025a6370 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -28270,7 +28270,7 @@ to return true:wantsResponderID| | return root; } - var ReactVersion = "18.3.0-canary-6d7633fe"; + var ReactVersion = "18.3.0-canary-07e71c82"; function createPortal$1( children, @@ -28994,7 +28994,9 @@ to return true:wantsResponderID| | internalInstanceHandle.stateNode && // $FlowExpectedError[incompatible-use] internalInstanceHandle.stateNode.node ); - } // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN. + } // Should have been PublicInstance from ReactFiberConfigFabric + // Should have been PublicInstance from ReactFiberConfigNative + // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN. function isChildPublicInstance(parentInstance, childInstance) { { @@ -29016,11 +29018,11 @@ to return true:wantsResponderID| | return false; } - var parentInternalInstanceHandle = + var parentInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric. ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance( parentInstance ); - var childInternalInstanceHandle = + var childInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric. ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance( childInstance ); // Fabric diff --git a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeTypes.js b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeTypes.js index e994301ee60ea..cf96ea78f1421 100644 --- a/compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/compiled-rn/facebook-fbsource/xplat/js/react-native-github/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,