From f608fcc0241302b464d0be6c811d7f993cdfce6e Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Thu, 28 Dec 2023 17:09:03 -0800 Subject: [PATCH] Fix horiozntal scrollview scrollTo coordinate space in RTL on oldarch (#42094) Summary: 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 horiozntal scrollview scrollTo coordinate space in RTL on oldarch Differential Revision: D52451602 --- packages/react-native/React/Views/ScrollView/RCTScrollView.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollView.m b/packages/react-native/React/Views/ScrollView/RCTScrollView.m index 3ad69069ef15d9..1aead514ac3fa5 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollView.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollView.m @@ -568,6 +568,10 @@ - (void)scrollToOffset:(CGPoint)offset - (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),