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
…#42094)

Summary:
Pull Request resolved: #42094

Fabric fixed this a while back with 9ca460f

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

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

Reviewed By: lenaic

Differential Revision: D52451602

fbshipit-source-id: f41d8248c7f6ab23965800b09ca1082fd1a15151
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jan 3, 2024
1 parent b81a081 commit e809e0a
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 e809e0a

Please sign in to comment.