Fix for SafeArea management on iOS Failing test case - LabelShouldSizeProperlyOnCollectionView #30682
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.
PR - #30629 Failing test case details :
Root Cause
The root cause of the layout freeze on iPhone XS is a microscopic floating-point precision error in
UIKit’s SafeAreaInsetsreporting. Instead of returning a clean zero, iPhone XS provides a non-zero value (3.5527136788005009e-15) for the left inset.This value is treated by the layout system as a legitimate inset change, triggering a layout re-evaluation. Since the value never stabilizes to an exact zero, the system enters an infinite layout loop.
Other iPhone models such as iPhone 11 and iPhone 16 return precise
{0,0,0,0}insets and are not affected.Description of Change
This change applies a strict floating-point threshold (1e-14) to treat such negligible values as zero before passing them into the layout system. The chosen tolerance is precise enough to eliminate false positives without suppressing valid sub-pixel safe area insets on high-resolution displays.
This ensures stable layout behavior across devices while preserving layout precision for real safe area adjustments.
Issues Fixed
Fixes #30629 failing test case - LabelShouldSizeProperlyOnCollectionView
Tested the behaviour in the following platforms
Output Video
BeforeFix.mov
AfterFix.mov