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 Not Working #547

Open
1 of 2 tasks
nickcherry opened this issue Aug 4, 2022 · 21 comments · May be fixed by #824
Open
1 of 2 tasks

maintainVisibleContentPosition Not Working #547

nickcherry opened this issue Aug 4, 2022 · 21 comments · May be fixed by #824
Assignees
Labels
bug Something isn't working P1 Important but not urgent

Comments

@nickcherry
Copy link

nickcherry commented Aug 4, 2022

Current behavior

When a maintainVisibleContentPosition prop is given to a FlashList and items are prepended to the data array, the user sees the list content move. This can be observed in the video below. On the left tab, we have React Native's FlatList, which does not scroll as content is prepended to its data array. On the right tab, we have FlashList, which does scroll as content is prepended, even when providing a valid keyExtractor and a maintainVisibleContentPosition of { minIndexForVisible: 0 }.

maintain-visible-content-position.mov

See https://github.com/nickcherry/flashlist-maintain-visible-content-position for reproducible demo.

Expected behavior

I would expect FlashList to behave like FlatList and not scroll when content is prepended to its data and maintainVisibleContentPosition is not undefined.

To Reproduce

https://github.com/nickcherry/flashlist-maintain-visible-content-position

Platform:

  • iOS
  • Android

Environment

1.2.1

@nickcherry nickcherry added the bug Something isn't working label Aug 4, 2022
@naqvitalha
Copy link
Collaborator

maintainVisibleContent position is unsupported right now. We will update here once we get to it.

@hirbod
Copy link
Contributor

hirbod commented Sep 11, 2022

The last missing piece for a almost perfect library :)

@naqvitalha naqvitalha added the P1 Important but not urgent label Sep 17, 2022
@aweffr
Copy link

aweffr commented Nov 11, 2022

+1 we really need maintainVisibleContentPosition, please

@friyiajr friyiajr self-assigned this Dec 19, 2022
@zedelashvililevani
Copy link

+1 I copy repo and make custom bridge for android :/

@harrisontaee
Copy link

+1, extremely valuable prop... would perfect the library!

@xmflsct
Copy link

xmflsct commented Feb 13, 2023

👀

friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Feb 25, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
friyiajr added a commit to friyiajr/flash-list that referenced this issue Mar 30, 2023
@robertontiu
Copy link

Any news on this one?

@isaachinman
Copy link

Just ran into this myself. Might need to revert to FlatList. Would be grateful if anyone is able to work on this feature.

@irisjae
Copy link

irisjae commented May 8, 2024

FlashList as of now does not support the maintainVisibleContentPosition prop or similar functionality.

For those of you who may need similar functionality, I've published an analysis of this problem and a patch to solve it here; feel free to test it out.

Note that instead of attempting to replicate ScrollView's maintainVisibleContentPosition prop, my patch creates a new prop preserveVisiblePosition instead.

@irisjae irisjae mentioned this issue May 8, 2024
6 tasks
@Marvin-Bai
Copy link

Hey team, any updates on this issue? I see there is a fix about an experimental feature supporting MVCP from discord forked repo. Can't we merge it into this? 👀

@Rohit3523
Copy link

Rohit3523 commented May 25, 2024

Hey team, any updates on this issue? I see there is a fix about an experimental feature supporting MVCP from discord forked repo. Can't we merge it into this? 👀

Can you share the fork link @Marvin-Bai

@Marvin-Bai
Copy link

Hey team, any updates on this issue? I see there is a fix about an experimental feature supporting MVCP from discord forked repo. Can't we merge it into this? 👀

Can you share the fork link @Marvin-Bai

Here it is.
https://github.com/discord/flash-list

@irisjae
Copy link

irisjae commented May 25, 2024

If what you're referring to is this branch, the commits appear to be just a squash of this PR, which for the reasons I explain in the link from my above comment, cannot fully solve the issue (with problems like not working well during scrolling and not working if the indexes shift too much).

See if my linked fork/patch works well for you, and if it does, it would be great if you added support for my PR to get thoughts and attention of the maintainers.

P.S.
With respect to the two flaws I specifically linked to, my fork/patch addresses it respectively in:

  • Mechanism -> Details -> 'Refixing' -> Timing section (_queueLayoutRefix in the recyclerlistview code)
  • Mechanism -> Details -> List changes section (handleDatasetChange in the recyclerlistview code)

Besides these two flaws, my patch addresses a good deal of other edge cases; in the latter part of my explainer, essentially each section corresponds to the presence of an edge case, and how we have dealt with/can deal with it properly.

johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
johankasperi pushed a commit to johankasperi/flash-list that referenced this issue Jun 13, 2024
@Nasseratic
Copy link

Would be amazing to get this 🥲

@GeorgeFlorian
Copy link

Any news on this ?

@Rohit3523
Copy link

Any update?

1 similar comment
@RichardSleet
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1 Important but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.