Commit 6b7ef31
fix(iOS): correct RTL ScrollView offset on recycle in Fabric (#55804)
Summary:
Fixes #55768
When a `ScrollView` is recycled in RTL mode, resetting `_scrollView.zoomScale = 1.0` inside `prepareForRecycle` causes UIKit to mutate `_containerView.frame`, pushing the content off-screen.
Because the old `_contentSize` still matches the new `contentSize`, `updateState:` hits an early return optimization and fails to correct the mutated frame.
This PR invalidates the cached `_contentSize` by setting it to `CGSizeZero` immediately after the `zoomScale` reset. This bypasses the early return and forces a correct recalculation of the frame.
*Credit: Full credit to kligarski for debugging and pinpointing the exact mechanism in the original issue.*
## Changelog:
[IOS] [FIXED] - Fixed RTL ScrollView offset bug upon recycling in Fabric
Pull Request resolved: #55804
Test Plan:
1. Ran the reproducer app provided in issue #55768.
2. Verified that navigating (Push/Pop) multiple times with a `ScrollView` in an RTL layout no longer causes the content to offset to the left of the window. The ScrollView remains correctly positioned.
Reviewed By: cipolleschi
Differential Revision: D94682107
Pulled By: javache
fbshipit-source-id: 3603824dcf37858f2924c9414a0ad4fcca2aea681 parent 0eb5e65 commit 6b7ef31
File tree
1 file changed
+3
-0
lines changed- packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView
1 file changed
+3
-0
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
687 | 690 | | |
688 | 691 | | |
689 | 692 | | |
| |||
0 commit comments