Fix iOS Paper Scroll Event RTL check (#40751)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40751

In D48379915 I fixed inverted `contentOffset` in `onScroll` events on iOS. I thought I tested on Paper, but I think this was during a period where the Paper route in Catalyst was actually launching Fabric (oops).

In Paper, at least under `forceRTL` and English, `[UIApplication sharedApplication].userInterfaceLayoutDirection` is not set to RTL. We instead have a per-view `reactLayoutDirection` we should be reading.

This sort of thing isn't currently set on Fabric, which checks application-level RTL. This seems... not right with being able to set `direction` in a subtree context, but Android does the same thing, and that would take some greater changes.

Changelog:
[iOS][Fixed] - Fix iOS Paper Scroll Event RTL check

Reviewed By: luluwu2032

Differential Revision: D50098310

fbshipit-source-id: e321fca7b2f7983e903e23237bc2d604c72f98a3
This commit is contained in:
Nick Gerleman
2023-10-10 11:43:14 -07:00
committed by Facebook GitHub Bot
parent 22a7b8dd37
commit c40fc313ca
@@ -1058,7 +1058,7 @@ RCT_SET_AND_PRESERVE_OFFSET(setScrollIndicatorInsets, scrollIndicatorInsets, UIE
}
CGPoint offset = scrollView.contentOffset;
if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
if ([self reactLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft) {
offset.x = scrollView.contentSize.width - scrollView.frame.size.width - offset.x;
}