Support rn_rootThreshold
on IntersectionObserver (viewAreaCoveragePercentThreshold)
#47908
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Add support for
rn_rootThreshold
.rn_rootThreshold
is a custom IntersectionObserver option and not part of the IntersectionObserver spec. We are adding it because it covers a specific use-case for measuring viewability that is robust fortarget
s that are larger than the viewport or specifiedroot
.The threshold ratio is of the intersection area (of
root
andtarget
) to the total area of theroot
.{F1960832959}
Source - EX314979
rn_rootThreshold
is an optional threshold and can be combined with thethresholds
option. An intersection will fire if any specified thresholds is met.Note: If you use specify a
rn_rootThreshold
, the defaultthreshold
is no longer appliedThe main use case of
rn_rootThreshold
is being able to specify a level of viewability independent oftarget
size. For example, atarget
that is larger than theroot
(commonly the viewport) will not trigger the IntersectionObserver for athreshold
of1
. Settingrn_rootThreshold
of1
, will trigger once the item takes full size of theroot
.';Reviewed By: yungsters
Differential Revision: D66031119