镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Allow partially visible items to be picked as scroll anchors for maintainVisibleContentPosition - #43203

Closed
RandomEngy wants to merge 1 commit into
react:mainfrom
RandomEngy:export-D54223244
Closed

RandomEngy wants to merge 1 commit into
react:mainfrom
RandomEngy:export-D54223244

Conversation

@RandomEngy

Copy link
Copy Markdown

Summary:
The current behavior for maintainVisibleContentPosition on ScrollView is to pick the first fully visible item as the scroll anchor. This has a number of disadvantages:

  • It causes problems for lists with loading indicators and large items. The loading glimmer can be picked as the anchor and pull the scroll down too quickly. This is the case for Marketplace.
  • It's inconsistent with the CSS Scroll Anchoring behavior, which is to pick the first partially visible view.

This change will switch to picking the first partially visible view as the anchor, to align with the CSS implementation.

Discussed the change with yungsters, NickGerleman, and cipolleschi and agreed about the change in behavior.

This also enables maintainVisibleContentPosition for Android. After adding it to validAttributes for Android it appears to be working well. Previously it was not functional at all on Android, as the property change from React was not passed to ReactScrollViewManager.java.

Changelog:

[General] [Changed] - maintainVisibleContentPosition property on ScrollView now selects the first partially visible view as the anchor, rather than the first fully visible view.

Differential Revision: D54223244

@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 labels Feb 27, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@analysis-bot

analysis-bot commented Feb 27, 2024 •

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,898,646 -67
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,257,001 -10
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 15f0895
Branch: main

@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

…tainVisibleContentPosition

Summary:
The current behavior for `maintainVisibleContentPosition` on ScrollView is to pick the first fully visible item as the scroll anchor. This has a number of disadvantages:

* It causes problems for lists with loading indicators and large items. The loading glimmer can be picked as the anchor and pull the scroll down too quickly. This is the case for Marketplace.
* It's inconsistent with the [CSS Scroll Anchoring](https://www.w3.org/TR/css-scroll-anchoring-1/) behavior, which is to pick the first partially visible view.

This change will switch to picking the first partially visible view as the anchor, to align with the CSS implementation.

Discussed the change with yungsters, NickGerleman, and cipolleschi and agreed about the change in behavior.

This also enables `maintainVisibleContentPosition` for Android. After adding it to `validAttributes` for Android it appears to be working well. Previously it was not functional at all on Android, as the property change from React was not passed to ReactScrollViewManager.java.

## Changelog:
[General] [Changed] - maintainVisibleContentPosition property on ScrollView now selects the first partially visible view as the anchor, rather than the first fully visible view.

Reviewed By: NickGerleman

Differential Revision: D54223244
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@cortinico

Copy link
Copy Markdown
Contributor

252ef19

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