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

maintainVisibleContentPosition fixes on Android #46247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

janicduplessis
Copy link
Contributor

@janicduplessis janicduplessis commented Aug 28, 2024

Summary:

We've noticed some cases of content jumping when using maintainVisibleContentPosition on Android when used for bidirectional pagination.

This makes some improvements to the maintainVisibleContent position implementation on Android to reduce cases of content jumping.

  1. When using z-index Fabric re-orders the views so we can no longer rely on the ordering of the views to find the first visible view, we must go through all views and find the one that is bigger than the scroll position, but also has the smallest position.

  2. This changes the approach to calculating the first visible view. Previously this was done in the Fabric willMountItems lifecycle, but there were cases where it would result in an incorrect update to the first visible view. Instead this changes the calculation to happen on scroll, which is actually when the first visible view can change.

  3. This also does minor refactoring of the method names in MaintainVisibleScrollPositionHelper.java to better reflect the Fabric lifecycle names and what Android view lifecycle events they are called from.

Changelog:

[ANDROID] [FIXED] - maintainVisibleContentPosition fixes on Android

Test Plan:

Tested in the Expensify app to make sure this reduces cases of content jumping in the chats while scrolling and items are added at the start of the list on Android.

@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. Contributor A React Native contributor. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Aug 28, 2024
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. Contributor A React Native contributor. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants