-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] ScrollView content offset RTL - fix #29469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses an RTL (right-to-left) scrolling offset issue in iOS by introducing a conditional layout rearrangement when the UI direction is RTL.
- Added conditional block in LayoutSubviews to adjust content arrangement and offset based on EffectiveUserInterfaceLayoutDirection
- Sets the content offset to ensure correct scrolling behavior in RTL environments
crossPlatformLayout.CrossPlatformArrange(new Rect(new Point(crossPlatformBounds.Width - contentSize.Width, 0), crossPlatformBounds)); | ||
SetContentOffset(new CGPoint(contentSize.Width - crossPlatformBounds.Width, 0), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the expression 'crossPlatformBounds.Width - contentSize.Width' into a variable to avoid duplication and enhance readability.
crossPlatformLayout.CrossPlatformArrange(new Rect(new Point(crossPlatformBounds.Width - contentSize.Width, 0), crossPlatformBounds)); | |
SetContentOffset(new CGPoint(contentSize.Width - crossPlatformBounds.Width, 0), false); | |
var horizontalOffset = crossPlatformBounds.Width - contentSize.Width; | |
crossPlatformLayout.CrossPlatformArrange(new Rect(new Point(horizontalOffset, 0), crossPlatformBounds)); | |
SetContentOffset(new CGPoint(-horizontalOffset, 0), false); |
Copilot uses AI. Check for mistakes.
5e146c9
to
0a3f75a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was a "Asking a question" button, but I have to pick an option or the bots bug me to pick something.
But, it appears the layout for RTL uses the right of the visible area, so a negative left offset will move the content or move the start and show the content?
/rebase |
* [iOS] ScrollView content offset RTL fix * Added a UITest
* [iOS] ScrollView content offset RTL fix * Added a UITest
* [iOS] ScrollView content offset RTL fix * Added a UITest
* [iOS] ScrollView content offset RTL fix * Added a UITest
* [iOS] ScrollView content offset RTL fix * Added a UITest
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issues Fixed
Fixes #29458
Screen.Recording.2025-05-13.at.15.46.46.mov
Screen.Recording.2025-05-13.at.15.45.31.mov