Skip to content

Commit

Permalink
Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch (
Browse files Browse the repository at this point in the history
…facebook#42094)

Summary:

Fabric fixed this a while back with facebook@9ca460f

Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment)

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

Reviewed By: lenaic

Differential Revision: D52451602
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jan 3, 2024
1 parent b81a081 commit 53f0e11
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react-native/React/Views/ScrollView/RCTScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 53f0e11

Please sign in to comment.