Skip to content

maintainVisibleContentPosition fixes on Android#46247

Open
janicduplessis wants to merge 1 commit intofacebook:mainfrom
janicduplessis:@janic/mvcp-zindex-fix
Open

maintainVisibleContentPosition fixes on Android#46247
janicduplessis wants to merge 1 commit intofacebook:mainfrom
janicduplessis:@janic/mvcp-zindex-fix

Conversation

@janicduplessis
Copy link
Copy Markdown
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
@YanDjin
Copy link
Copy Markdown

YanDjin commented Mar 31, 2025

I have this same problem on Android.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added Stale There has been a lack of activity on this issue and it may be closed soon. and removed Stale There has been a lack of activity on this issue and it may be closed soon. labels Sep 28, 2025
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.

4 participants