Skip to content

Commit

Permalink
Fix on demand mounting in RTL
Browse files Browse the repository at this point in the history
Summary:
Changelog: [internal]

When calculating on demand views, RTL layout needs to be considered.

Reviewed By: JoshuaGross

Differential Revision: D28510293

fbshipit-source-id: 5e7b08fcc5c55fa1a978024a9bfedda705ce1702
  • Loading branch information
sammy-SC authored and facebook-github-bot committed May 18, 2021
1 parent 6844b8e commit e173bbe
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,11 @@ - (void)_remountChildren
return;
}

CGRect visibleFrame = CGRect{_scrollView.contentOffset, _scrollView.bounds.size};
CGRect visibleFrame = [_scrollView convertRect:_scrollView.bounds toView:_containerView];
visibleFrame = CGRectInset(visibleFrame, -kClippingLeeway, -kClippingLeeway);

CGFloat scale = 1.0 / _scrollView.zoomScale;
// `zoomScale` is negative in RTL. Absolute value is needed.
CGFloat scale = 1.0 / std::abs(_scrollView.zoomScale);
visibleFrame.origin.x *= scale;
visibleFrame.origin.y *= scale;
visibleFrame.size.width *= scale;
Expand Down

0 comments on commit e173bbe

Please sign in to comment.