Skip to content

Commit c40fc31

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix iOS Paper Scroll Event RTL check (#40751)
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
1 parent 22a7b8d commit c40fc31

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/react-native/React/Views/ScrollView/RCTScrollView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ - (void)sendScrollEventWithName:(NSString *)eventName
10581058
}
10591059

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

0 commit comments

Comments
 (0)