Skip to content

RN: Return zero measure values in measure API when ReactRootView cannot be found in view hierarchy#51994

Open
Coiggahou2002 wants to merge 1 commit into
react:mainfrom
Coiggahou2002:main
Open

RN: Return zero measure values in measure API when ReactRootView cannot be found in view hierarchy#51994
Coiggahou2002 wants to merge 1 commit into
react:mainfrom
Coiggahou2002:main

Conversation

@Coiggahou2002

Copy link
Copy Markdown

Summary:

This PR addresses a critical issue with the measure API on iOS when used in conjunction with removeClippedSubviews in FlatList. The current implementation can lead to incorrect intersection measurements, particularly affecting components that rely on accurate view measurements for features like exposure tracking.

The root cause is that when removeClippedSubviews is enabled, views outside the visible area are removed from their superview. When measure is called on these views, it fails to properly traverse up to the RCTRootView, resulting in incorrect coordinate calculations. This leads to false positives in intersection detection, especially for components implementing exposure tracking functionality.

The fix follows Android's more robust implementation by adding proper validation to ensure measurements are always relative to RCTRootView, and returning appropriate values when this cannot be achieved.

Changelog:

[IOS] [FIXED] - Fixed incorrect measurements from measure API when used with removeClippedSubviews

Test Plan:

  1. Created a test case with a horizontal FlatList containing multiple items, each wrapped in an IntersectionObserverView
  2. Verified that with removeClippedSubviews={true}:
  3. Views outside the visible area return correct measurements (0,0,0,0) instead of false positives
  4. Views inside the visible area maintain accurate measurements
  5. Tested on both iOS simulator and physical devices

The testing video/representation is on the way.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Hi @Coiggahou2002!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 13, 2025
@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@Coiggahou2002 Coiggahou2002 marked this pull request as ready for review June 14, 2025 02:27
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jun 14, 2025
@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 11, 2025
@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Dec 11, 2025
@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Stale There has been a lack of activity on this issue and it may be closed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants