-
Notifications
You must be signed in to change notification settings - Fork 33
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 does not work correctly with multiple instances of a Flatlist #16
Comments
After debugging the native module I think I found something around the native ui listeners. Since I always have a |
After more days of debugging, I believe I have found the root cause and a possible solution (still testing). So the problem with the current native implementation is that it will only work if you only ever have one instance of a |
Hey @jbernhardt23 I have got around to looking into this issue yet. But yeah, if you have some PR for it, that would be great :) Thanks!! |
I have forked the project and applied those changes there. That work is still being reviewed and tested on my team, once it gets approved I will open a PR. |
Hey @jbernhardt23, any update on PR for this ? |
hey @bradnorman5490 ! yes, we have finished doing extensive testing around this on our side so I will be opening a PR shortly (tomorrow or starting next week) |
Fantastic news! Looking forward to it |
@jbernhardt23 thats nice to hear. Love it how open source contributions are helping the community :) |
@bradnorman5490 PR was submitted #21 |
THanks @bradnorman5490 I will take a look tomorrow :) |
I'm currently facing an issue where the
<Flatlist/>
component is failing to maintain its position when being used as a common component between multiple other components. My use case goes the following way. I have a common component<Feed/>
that holds common logic and renders this package<Flatlist/>
. This<Feed/>
component is being used from 2 other components, so there are<Home/>
and<Verticals/>
, both have an instance of<Feed/>
in their render functions. The<Home/>
is always mounted, meaning that it is only being unmounted when the app is killed, but the<Verticals/>
one is unmounted when the user navigates back from that specific screen and mounted when tapping that screen. The Flatlist works as expected and maintains its position only at the<Home/>
screen. When I navigate to the<Verticals/>
and update the content for that list, the view is not being maintained.I noticed that if I do not render the
<Feed/>
component inside the<Home/>
screen and only in the<Verticals/>
screen, the list behaves as expected and the view is maintained. I tried to do some debugging but I couldn't find anything useful for me to find a solution (so far). I did inspectflRef.current.getScrollableNode()
for the<Verticals/>
list and I saw that the values were different for those scenarios. Meaning that when I first loaded the Home list screen and then navigate to the Verticals screen that value was different if I only render the Vertical list screen (when is actually working).Edit:
One more thing, If I go to the main list in the
Home
screen (currently working), go to the other instance of the list in theVertical
screen (not working) and then go back to theHome
screen, now the list in theHome
screen does not mantains its position.This is the configuration for the list in the common
<Feed/>
The text was updated successfully, but these errors were encountered: