Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

NickGerleman
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Aug 2, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47978637

@analysis-bot
Copy link

analysis-bot commented Aug 2, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,894,537 +17
android hermes armeabi-v7a 7,943,086 +13
android hermes x86 9,292,425 +9
android hermes x86_64 9,193,938 +6
android jsc arm64-v8a 9,481,330 +20
android jsc armeabi-v7a 8,422,871 +25
android jsc x86 9,465,349 +17
android jsc x86_64 9,779,581 +17

Base commit: a34ce64
Branch: main

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Aug 3, 2023
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47978637

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Aug 4, 2023
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47978637

NickGerleman and others added 2 commits August 4, 2023 10:36
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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D47978637

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Aug 4, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 5596f1c.

});
}

_scrollToParamsFromOffset(offset: number): {x?: number, y?: number} {
const {horizontal, rtl} = this._orientation();
if (horizontal && rtl) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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

NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Dec 29, 2023
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
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Dec 29, 2023
…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
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Jan 3, 2024
…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
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Jan 3, 2024
…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
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Jan 3, 2024
…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
facebook-github-bot pushed a commit that referenced this pull request Jan 3, 2024
…#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
huntie pushed a commit that referenced this pull request Jan 3, 2024
…#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
Othinn pushed a commit to Othinn/react-native that referenced this pull request Jan 9, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants