Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch (#42094)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42094

Fabric fixed this a while back with https://github.com/facebook/react-native/commit/9ca460f06405db85d0df60cbe53c304c9127c3bf

Looks like this is still broken on Paper, and now VirtualizedList relies on it. https://github.com/facebook/react-native/pull/38737#discussion_r1437874601

Changelog:
[ios][fixed] - Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch

Reviewed By: lenaic

Differential Revision: D52451602

fbshipit-source-id: f41d8248c7f6ab23965800b09ca1082fd1a15151
This commit is contained in:
Nick Gerleman
2024-01-03 14:38:03 +00:00
committed by Alex Hunt
parent ddf0079ec5
commit 00d8389890
@@ -568,6 +568,10 @@ static inline void RCTApplyTransformationAccordingLayoutDirection(
- (void)scrollToOffset:(CGPoint)offset animated:(BOOL)animated
{
if ([self reactLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft) {
offset.x = _scrollView.contentSize.width - _scrollView.frame.size.width - offset.x;
}
if (!CGPointEqualToPoint(_scrollView.contentOffset, offset)) {
CGRect maxRect = CGRectMake(
fmin(-_scrollView.contentInset.left, 0),