Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[Fabric/Paper]: support isChildPublicInstance api method #27783

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

hoxyq
Copy link
Contributor

@hoxyq hoxyq commented Dec 4, 2023

Adds isChildPublicInstance method to both renderers (Fabric and Paper), which will receive 2 public instances and return if first argument is an ancestor of the second, based on fibers.

This will be used as a fallback when DOM node APIs are not available: for Paper renderer or for Fabric without DOM node APIs.

How it is going to be used: to determine which AppContainer component in RN is responsible for highlighting an inspected element on the screen.

@hoxyq hoxyq requested a review from rubennorte December 4, 2023 14:14
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Dec 4, 2023
@react-sizebot
Copy link

react-sizebot commented Dec 4, 2023

Comparing: 87cb0bf...61f781b

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 175.90 kB 175.90 kB = 54.75 kB 54.76 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 177.97 kB 177.97 kB = 55.39 kB 55.39 kB
facebook-www/ReactDOM-prod.classic.js = 569.81 kB 569.81 kB = 100.29 kB 100.29 kB
facebook-www/ReactDOM-prod.modern.js = 553.67 kB 553.67 kB = 97.38 kB 97.38 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
react-native/implementations/ReactFabric-dev.js +0.71% 971.82 kB 978.67 kB +0.80% 196.05 kB 197.63 kB
react-native/implementations/ReactFabric-dev.fb.js +0.68% 1,004.30 kB 1,011.15 kB +0.78% 201.41 kB 202.99 kB

Generated by 🚫 dangerJS against 61f781b

hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Dec 4, 2023
…ublicInstance

Summary:
Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831
@hoxyq hoxyq force-pushed the react-native/ancestors-api branch 2 times, most recently from 2d7594f to 62e168a Compare December 4, 2023 15:20
@hoxyq hoxyq changed the title feat[Fabric/Paper]: support getIsOneInstanceAncestorOfAnother api method feat[Fabric/Paper]: support isChildPublicInstance api method Dec 4, 2023
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Dec 4, 2023
…ublicInstance (facebook#41786)

Summary:

Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831
@hoxyq hoxyq merged commit 1729b49 into facebook:main Dec 4, 2023
36 checks passed
@hoxyq hoxyq deleted the react-native/ancestors-api branch December 4, 2023 17:22
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Dec 4, 2023
…ublicInstance (facebook#41786)

Summary:

Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Dec 4, 2023
…ublicInstance (#41786)

Summary:
Pull Request resolved: #41786

Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831

fbshipit-source-id: c8ddf67d7ad35a670fa462c246dcb7230ba47716
hoxyq added a commit that referenced this pull request Dec 5, 2023
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
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Dec 6, 2023
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
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
…ublicInstance (facebook#41786)

Summary:
Pull Request resolved: facebook#41786

Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831

fbshipit-source-id: c8ddf67d7ad35a670fa462c246dcb7230ba47716
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
…acebook#41807)

Summary:
Pull Request resolved: facebook#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
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jan 11, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 11, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: 89c3314823370b28577c622f9484d278b5340c76
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 11, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: 835ccd994cc55ca44a5a03932dc9620594a11931
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 11, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: 1eeccd0cc5c99770cb20654ea119c340aef7d500
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance (facebook#42249)

Summary:

Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Reviewed By: sammy-SC

Differential Revision: D52697885
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: ce70c16ec90a89f79970b21391d0fa40d6ed2d05
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: e68baafbf9a7b3232375ab1db2560158c03641f8
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: 153f51e48f325aa51180effecc3ecf0a42e84c87
hoxyq added a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance (facebook#42249)

Summary:

Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Reviewed By: sammy-SC

Differential Revision: D52697885
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: e4d28d8251c25211a7b60449e0d5b9d796bd6c5a
hoxyq pushed a commit to hoxyq/react-native that referenced this pull request Jan 15, 2024
…stance

Summary:
Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Differential Revision: D52697885

fbshipit-source-id: b8dfbc641899516c7c62bb79bd21fae1a1981a0c
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Jan 15, 2024
…stance (#42249)

Summary:
Pull Request resolved: #42249

Changelog: [Internal]

Manually patching public React renderers artifacts to include `isChildPublicInstance` method, which was added in facebook/react#27783.

To identifly the required changes in code I've ran a diff for 2 commits:
1. The one with the changes
2. Its parent

FB implementation were synced in D51816108.

Reviewed By: sammy-SC

Differential Revision: D52697885

fbshipit-source-id: c62af6e89e8da3ee6f6c7264bacf6e96030e9db8
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
…k#27783)

Adds `isChildPublicInstance` method to both renderers (Fabric and
Paper), which will receive 2 public instances and return if first
argument is an ancestor of the second, based on fibers.

This will be used as a fallback when DOM node APIs are not available:
for Paper renderer or for Fabric without DOM node APIs.

How it is going to be used: to determine which `AppContainer` component
in RN is responsible for highlighting an inspected element on the
screen.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
Follow-up on facebook#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
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
Adds `isChildPublicInstance` method to both renderers (Fabric and
Paper), which will receive 2 public instances and return if first
argument is an ancestor of the second, based on fibers.

This will be used as a fallback when DOM node APIs are not available:
for Paper renderer or for Fabric without DOM node APIs.

How it is going to be used: to determine which `AppContainer` component
in RN is responsible for highlighting an inspected element on the
screen.

DiffTrain build for commit 1729b49.
tungdo194 pushed a commit to tungdo194/rn-test that referenced this pull request Apr 28, 2024
Summary:
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.

Differential Revision: D51849040
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants