Skip to content

Fix virtualization logic with horizontal RTL lists#38529

Closed
NickGerleman wants to merge 2 commits into
facebook:mainfrom
NickGerleman:export-D46586420
Closed

Fix virtualization logic with horizontal RTL lists#38529
NickGerleman wants to merge 2 commits into
facebook:mainfrom
NickGerleman:export-D46586420

Conversation

@NickGerleman
Copy link
Copy Markdown
Contributor

Summary:
VirtualizedList internally represents metrics along the scrolling axis using offset (x, y), and length (width, height). This one dimensional representation allows the list to be generic to being horizontal or vertical.

Right now offset conversion directly takes the x or y axis value, but this is not correct when we are using an inverted FlatList, or a horizontal FlatList in RTL.

This change converts most VirtualizedList code handling offset,length coordinates consistently flow from start to end, including in horizontal RTL and in inverted FlatList.

This is paired with a fix to Android native code in D47627115. With these together, basic Horizontal FlatList scenarios should work correctly when laid out in RTL.

Differential Revision: D46586420

@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 Jul 20, 2023
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jul 20, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,884,779 +1,426
android hermes armeabi-v7a 7,935,320 +1,167
android hermes x86 9,281,488 +1,061
android hermes x86_64 9,184,883 +1,339
android jsc arm64-v8a 9,473,655 +588
android jsc armeabi-v7a 8,417,015 +596
android jsc x86 9,456,415 +603
android jsc x86_64 9,772,612 +581

Base commit: d380bb8
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

1 similar comment
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

NickGerleman and others added 2 commits July 27, 2023 14:57
Summary: This changes the logic we use to correct scroll position on RTL ScrollView content change, to a new more generalized strategy of keeping a constant right-edge offset on layout change. This includes first layout, so that the initial scroll position is correct.

Differential Revision: D47627115

fbshipit-source-id: c8964046dcb4cf33424a593e1372a3a8dd3a91df
Summary:
Pull Request resolved: facebook#38529

VirtualizedList internally represents metrics along the scrolling axis using `offset` (x, y), and `length` (width, height). This one dimensional representation allows the list to be generic to being horizontal or vertical.

Right now offset conversion directly takes the `x` or `y` axis value, but  this is not correct when we are using a horizontal FlatList in RTL.

This change converts most VirtualizedList code handling  `offset,length` coordinates consistently flow from start to end, including in horizontal RTL and in inverted FlatList.

This is paired with a fix to Android native code in D47627115. With these together, basic Horizontal FlatList scenarios should work correctly when laid out in RTL.

Changelog:
[General][Fixed] - Fix virtualization logic with horizontal RTL lists

Reviewed By: vincentriemer

Differential Revision: D46586420

fbshipit-source-id: 6224fc310035766f7b2473adfd170093119524a7
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

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

This pull request has been merged in 8b39bfa.

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. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants