Fix on demand mounting in RTL

Summary:
Changelog: [internal]

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

Reviewed By: JoshuaGross

Differential Revision: D28510293

fbshipit-source-id: 5e7b08fcc5c55fa1a978024a9bfedda705ce1702
This commit is contained in:
Samuel Susla
2021-05-18 10:02:19 -07:00
committed by Facebook GitHub Bot
parent 6844b8e0d4
commit e173bbe3bb
@@ -622,10 +622,11 @@ static void RCTSendPaperScrollEvent_DEPRECATED(UIScrollView *scrollView, NSInteg
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;