Skip to content

Commit

Permalink
fix: add isChildPublicInstance to ReactNativeTypes (#27788) (#41807)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #41807

Changelog: [Internal]

Follow-up on facebook/react#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 facebook/react@c29ca23.

Test Plan: Sandcastle tests

Reviewed By: kassens

Differential Revision: D51849040

Pulled By: hoxyq

fbshipit-source-id: f75593e44c114289ad4c6fb8b4b37c4c5fd6d3d4
  • Loading branch information
hoxyq authored and facebook-github-bot committed Dec 6, 2023
1 parent 73d0cf5 commit 616a907
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noformat
* @flow strict
* @nolint
* @generated SignedSource<<1836a1b6639552dce12199ef2c85f63d>>
* @generated SignedSource<<30640e7dd83e22e14db1648ca63f4316>>
*/

import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
Expand Down Expand Up @@ -193,6 +193,10 @@ export type ReactNativeType = {
findNodeHandle<TElementType: ElementType>(
componentOrHandle: ?(ElementRef<TElementType> | number),
): ?number,
isChildPublicInstance(
parent: PublicInstance | HostComponent<mixed>,
child: PublicInstance | HostComponent<mixed>,
): boolean,
dispatchCommand(
handle: ElementRef<HostComponent<mixed>>,
command: string,
Expand Down Expand Up @@ -231,6 +235,7 @@ export type ReactFabricType = {
command: string,
args: Array<mixed>,
): void,
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
sendAccessibilityEvent(
handle: ElementRef<HostComponent<mixed>>,
eventType: string,
Expand Down

0 comments on commit 616a907

Please sign in to comment.