Skip to content

Commit 56c0aff

Browse files
committed
fix: add isChildPublicInstance to ReactNativeTypes (#27788)
Follow-up on #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 c29ca23.
1 parent de3fc70 commit 56c0aff

File tree

10 files changed

+29
-20
lines changed

10 files changed

+29
-20
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25474,7 +25474,7 @@ if (__DEV__) {
2547425474
return root;
2547525475
}
2547625476

25477-
var ReactVersion = "18.3.0-canary-5ab6bbb4b-20231204";
25477+
var ReactVersion = "18.3.0-canary-c29ca23af-20231205";
2547825478

2547925479
// Might add PROFILE later.
2548025480

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9083,7 +9083,7 @@ var devToolsConfig$jscomp$inline_1033 = {
90839083
throw Error("TestRenderer does not support findFiberByHostInstance()");
90849084
},
90859085
bundleType: 0,
9086-
version: "18.3.0-canary-5ab6bbb4b-20231204",
9086+
version: "18.3.0-canary-c29ca23af-20231205",
90879087
rendererPackageName: "react-test-renderer"
90889088
};
90899089
var internals$jscomp$inline_1226 = {
@@ -9114,7 +9114,7 @@ var internals$jscomp$inline_1226 = {
91149114
scheduleRoot: null,
91159115
setRefreshHandler: null,
91169116
getCurrentFiber: null,
9117-
reconcilerVersion: "18.3.0-canary-5ab6bbb4b-20231204"
9117+
reconcilerVersion: "18.3.0-canary-c29ca23af-20231205"
91189118
};
91199119
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91209120
var hook$jscomp$inline_1227 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9509,7 +9509,7 @@ var devToolsConfig$jscomp$inline_1075 = {
95099509
throw Error("TestRenderer does not support findFiberByHostInstance()");
95109510
},
95119511
bundleType: 0,
9512-
version: "18.3.0-canary-5ab6bbb4b-20231204",
9512+
version: "18.3.0-canary-c29ca23af-20231205",
95139513
rendererPackageName: "react-test-renderer"
95149514
};
95159515
var internals$jscomp$inline_1267 = {
@@ -9540,7 +9540,7 @@ var internals$jscomp$inline_1267 = {
95409540
scheduleRoot: null,
95419541
setRefreshHandler: null,
95429542
getCurrentFiber: null,
9543-
reconcilerVersion: "18.3.0-canary-5ab6bbb4b-20231204"
9543+
reconcilerVersion: "18.3.0-canary-c29ca23af-20231205"
95449544
};
95459545
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95469546
var hook$jscomp$inline_1268 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-canary-5ab6bbb4b-20231204";
27+
var ReactVersion = "18.3.0-canary-c29ca23af-20231205";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
580580
exports.useTransition = function () {
581581
return ReactCurrentDispatcher.current.useTransition();
582582
};
583-
exports.version = "18.3.0-canary-5ab6bbb4b-20231204";
583+
exports.version = "18.3.0-canary-c29ca23af-20231205";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/cjs/React-profiling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ exports.useSyncExternalStore = function (
576576
exports.useTransition = function () {
577577
return ReactCurrentDispatcher.current.useTransition();
578578
};
579-
exports.version = "18.3.0-canary-5ab6bbb4b-20231204";
579+
exports.version = "18.3.0-canary-c29ca23af-20231205";
580580
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
581581
"function" ===
582582
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5ab6bbb4b058e22658fc6d4734db5acfbf393345
1+
c29ca23af91d8aeb9e175c08a0866ba54286f0f3

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.fb.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<685bf7c576463dfbb4cf704d94b8c71b>>
10+
* @generated SignedSource<<86b0cafe89bf505872d503a476664cf5>>
1111
*/
1212

1313
"use strict";
@@ -27829,7 +27829,7 @@ to return true:wantsResponderID| |
2782927829
return root;
2783027830
}
2783127831

27832-
var ReactVersion = "18.3.0-canary-ad95fe0f";
27832+
var ReactVersion = "18.3.0-canary-e53565aa";
2783327833

2783427834
function createPortal$1(
2783527835
children,
@@ -28711,7 +28711,9 @@ to return true:wantsResponderID| |
2871128711
internalInstanceHandle.stateNode && // $FlowExpectedError[incompatible-use]
2871228712
internalInstanceHandle.stateNode.node
2871328713
);
28714-
} // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN.
28714+
} // Should have been PublicInstance from ReactFiberConfigFabric
28715+
// Should have been PublicInstance from ReactFiberConfigNative
28716+
// Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN.
2871528717

2871628718
function isChildPublicInstance(parentInstance, childInstance) {
2871728719
{
@@ -28733,11 +28735,11 @@ to return true:wantsResponderID| |
2873328735
return false;
2873428736
}
2873528737

28736-
var parentInternalInstanceHandle =
28738+
var parentInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric.
2873728739
ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance(
2873828740
parentInstance
2873928741
);
28740-
var childInternalInstanceHandle =
28742+
var childInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric.
2874128743
ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance(
2874228744
childInstance
2874328745
); // Fabric

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<d24e5265ff25936497dfc29885a7ed06>>
10+
* @generated SignedSource<<d78568faa845f2ded9fe23a625f144a4>>
1111
*/
1212

1313
"use strict";
@@ -28270,7 +28270,7 @@ to return true:wantsResponderID| |
2827028270
return root;
2827128271
}
2827228272

28273-
var ReactVersion = "18.3.0-canary-6d7633fe";
28273+
var ReactVersion = "18.3.0-canary-07e71c82";
2827428274

2827528275
function createPortal$1(
2827628276
children,
@@ -28994,7 +28994,9 @@ to return true:wantsResponderID| |
2899428994
internalInstanceHandle.stateNode && // $FlowExpectedError[incompatible-use]
2899528995
internalInstanceHandle.stateNode.node
2899628996
);
28997-
} // Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN.
28997+
} // Should have been PublicInstance from ReactFiberConfigFabric
28998+
// Should have been PublicInstance from ReactFiberConfigNative
28999+
// Remove this once Paper is no longer supported and DOM Node API are enabled by default in RN.
2899829000

2899929001
function isChildPublicInstance(parentInstance, childInstance) {
2900029002
{
@@ -29016,11 +29018,11 @@ to return true:wantsResponderID| |
2901629018
return false;
2901729019
}
2901829020

29019-
var parentInternalInstanceHandle =
29021+
var parentInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric.
2902029022
ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance(
2902129023
parentInstance
2902229024
);
29023-
var childInternalInstanceHandle =
29025+
var childInternalInstanceHandle = // $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric.
2902429026
ReactNativePrivateInterface.getInternalInstanceHandleFromPublicInstance(
2902529027
childInstance
2902629028
); // Fabric

compiled-rn/facebook-fbsource/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeTypes.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noformat
88
* @flow strict
99
* @nolint
10-
* @generated SignedSource<<1836a1b6639552dce12199ef2c85f63d>>
10+
* @generated SignedSource<<30640e7dd83e22e14db1648ca63f4316>>
1111
*/
1212

1313
import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
@@ -193,6 +193,10 @@ export type ReactNativeType = {
193193
findNodeHandle<TElementType: ElementType>(
194194
componentOrHandle: ?(ElementRef<TElementType> | number),
195195
): ?number,
196+
isChildPublicInstance(
197+
parent: PublicInstance | HostComponent<mixed>,
198+
child: PublicInstance | HostComponent<mixed>,
199+
): boolean,
196200
dispatchCommand(
197201
handle: ElementRef<HostComponent<mixed>>,
198202
command: string,
@@ -231,6 +235,7 @@ export type ReactFabricType = {
231235
command: string,
232236
args: Array<mixed>,
233237
): void,
238+
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
234239
sendAccessibilityEvent(
235240
handle: ElementRef<HostComponent<mixed>>,
236241
eventType: string,

0 commit comments

Comments
 (0)