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

Add experimentalMaintainTopContentPosition support to FlashList #772

Closed
wants to merge 6 commits into from

Conversation

friyiajr
Copy link
Contributor

Description

Fixes (#547)

This pull request adds experimental support for a prop called experimentalMaintainTopContentPosition. This prop will maintain the position of the list when items are added from the top down. Unlike maintainVisibleContentPosition in React-Native we don't allow the user to specify a target for where they want the anchor to be. We always specify it as the top.

Reviewers’ hat-rack 🎩

Run tests in release mode. In debug mode there can be some flashing from clearGaps

  • Make sure nothing regressed in how FlashList worked before
  • Turn on experimentalMaintainTopContentPosition, add a keyExtractor and make sure you can maintain the position of the list when adding items to the front of the array
  • Make sure this works Vertically and Horizontally

Here is an example of the playground I was using for testing List.tsx
ListDebugPlayground.txt

Screenshots or videos (if needed)

The app working Vertically:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-02-25.at.11.15.58.mp4

The app working Horizontally:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-02-25.at.11.19.40.mp4

Checklist

@friyiajr friyiajr changed the title Maintain position ios v2 Add experimentalMaintainTopContentPosition support to FlashList Feb 25, 2023
@arthurgeron-work
Copy link

Great work! This is exactly what I need. I don't see any android code changes, is this iOS only prop?

@friyiajr
Copy link
Contributor Author

friyiajr commented Mar 3, 2023

@arthurgeron-work for now yes it is. We are currently working on Android

@batuhansahan
Copy link

batuhansahan commented Mar 26, 2023

Great work! Does this work with inverted={true}

@zulfio
Copy link

zulfio commented Apr 6, 2023

and this is what i need, thanks for creating this PR man

@geo-vi
Copy link

geo-vi commented Apr 6, 2023

ETA for when this will be merged?

Awesome PR!

@friyiajr
Copy link
Contributor Author

Closed in favor of this PR which addresses iOS and Android #824

@friyiajr friyiajr closed this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants