Skip to content

Commit

Permalink
Fix iOS Paper Scroll Event RTL check (#40751)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #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
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Oct 10, 2023
1 parent 22a7b8d commit c40fc31
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ - (void)sendScrollEventWithName:(NSString *)eventName
}

CGPoint offset = scrollView.contentOffset;
if ([UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
if ([self reactLayoutDirection] == UIUserInterfaceLayoutDirectionRightToLeft) {
offset.x = scrollView.contentSize.width - scrollView.frame.size.width - offset.x;
}

Expand Down

0 comments on commit c40fc31

Please sign in to comment.