-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Right align scrollToIndex in RTL #38737
Conversation
This pull request was exported from Phabricator. Differential Revision: D47978637 |
Base commit: a34ce64 |
Summary: Pull Request resolved: facebook#38737 This fixes up behavior on Android so that `scrollToIndex` aligns the right edge of the cell of the given index to the right edge of the scrollview viewport. We do not incorporate RTL on iOS which inverts x/y coordinates from scroller (but not layout). Changelog: [General][Fixed] - Right align scrollToIndex in RTL Reviewed By: lenaic Differential Revision: D47978637 fbshipit-source-id: ea75179ccd2034fe4568e7504194ffe7d1a0cedf
655171a
to
3924a7c
Compare
This pull request was exported from Phabricator. Differential Revision: D47978637 |
Summary: Pull Request resolved: facebook#38737 This fixes up behavior on Android so that `scrollToIndex` aligns the right edge of the cell of the given index to the right edge of the scrollview viewport. We do not incorporate RTL on iOS which inverts x/y coordinates from scroller (but not layout). Changelog: [General][Fixed] - Right align scrollToIndex in RTL Reviewed By: lenaic Differential Revision: D47978637 fbshipit-source-id: 638de1ab47bfa034190789d8564fafec7a17630c
3924a7c
to
4af98bf
Compare
This pull request was exported from Phabricator. Differential Revision: D47978637 |
Summary: Returned measurements from the measurements cache in RTL calculate offset as distance from the left edge of the cell to the right edge of the content, when it should instead be the distance from the right edge of the cell (the logical beginning). Changelog: [General][Fixed] - Return right edge in RTL cell metrics Differential Revision: D47978631 fbshipit-source-id: 70eb23ea2578c164832cc9f2efb060b56b10fc00
Summary: Pull Request resolved: facebook#38737 This fixes up behavior on Android so that `scrollToIndex` aligns the right edge of the cell of the given index to the right edge of the scrollview viewport. We do not incorporate RTL on iOS which inverts x/y coordinates from scroller (but not layout). Changelog: [General][Fixed] - Right align scrollToIndex in RTL Reviewed By: lenaic Differential Revision: D47978637 fbshipit-source-id: c4a37e5864f80f1750c394f9ce8a47db735a49a8
4af98bf
to
0949fa6
Compare
This pull request was exported from Phabricator. Differential Revision: D47978637 |
This pull request has been merged in 5596f1c. |
}); | ||
} | ||
|
||
_scrollToParamsFromOffset(offset: number): {x?: number, y?: number} { | ||
const {horizontal, rtl} = this._orientation(); | ||
if (horizontal && rtl) { |
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.
This change broke lists in our iOS app in RTL. We heavily rely on horizontal lists and ship to both iOS and Android in LTR and RTL. This line should've been if (horizontal && rtl && Platform.OS !== 'ios') {
. We tested that fix in our app and that has resolved things for us. @NickGerleman is Meta using large horizontal lists in any part of its localized RN surfaces? If so, is there something I'm missing here?
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.
Able to repro native scrollTo
not using right coordinate space on iOS old arch. New arch has different scrollview component, and seems to be doing the right thing.
There are a good number of changes since this one, but there was an effort to get all the events/platforms onto consistent coordinate spaces. So, no "if iOS, on Paper, do opposite".
I can make quick PR to try to fix this.
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.
Try out this change: https://github.com/facebook/react-native/pull/42094/files
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.
Can confirm that change also fixes it
Summary: Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horiozntal scrollview scrollTo coordinate space in RTL on oldarch Differential Revision: D52451602
…facebook#42094) Summary: Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horiozntal scrollview scrollTo coordinate space in RTL on oldarch Differential Revision: D52451602
…facebook#42094) Summary: Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horiozntal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602
…facebook#42094) Summary: Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horiozntal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602
…facebook#42094) Summary: Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602
…#42094) Summary: Pull Request resolved: #42094 Fabric fixed this a while back with 9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. #38737 (comment) Changelog: [ios][fixed] - Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602 fbshipit-source-id: f41d8248c7f6ab23965800b09ca1082fd1a15151
…#42094) Summary: Pull Request resolved: #42094 Fabric fixed this a while back with 9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. #38737 (comment) Changelog: [ios][fixed] - Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602 fbshipit-source-id: f41d8248c7f6ab23965800b09ca1082fd1a15151
…facebook#42094) Summary: Pull Request resolved: facebook#42094 Fabric fixed this a while back with facebook@9ca460f Looks like this is still broken on Paper, and now VirtualizedList relies on it. facebook#38737 (comment) Changelog: [ios][fixed] - Fix horizontal scrollview scrollTo coordinate space in RTL on oldarch Reviewed By: lenaic Differential Revision: D52451602 fbshipit-source-id: f41d8248c7f6ab23965800b09ca1082fd1a15151
Summary:
This fixes up behavior on Android so that
scrollToIndex
aligns the right edge of the cell of the given index to the right edge of the scrollview viewport. We do not incorporate RTL on iOS which inverts x/y coordinates from scroller (but not layout).Changelog:
[General][Fixed] - Right align scrollToIndex in RTL
Differential Revision: D47978637