-
Notifications
You must be signed in to change notification settings - Fork 427
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
Rows disappear when changing LayoutProvider #738
Comments
Hi @davidmalis This is something that is fixed in #734 |
I'm looking into this. Thanks for raising this issue. |
I've pushed 4.1.3 with @kevin-kp 's fix. This should work fine now. |
This issue persists with v4.1.3 How to reproduce: |
I can confirm that it works for me with v4.1.3 |
@davidmalis Are you using a hooks or class based approach? I am using hooks and it does not. I can provide a code example. It does seem hooks are not officially supported. |
@timothymiller I'm using hooks, something along the lines of this: In my Redux store I have a flag for layout which can be 'grid' or 'list', and on my screen I have a button which toggles this flag in store. When the flag is toggled, the component in which I render RecyclerListView, re-renders and the RecyclerListView is provided with a new DataProvider and LayoutProvider instance (I don't have LayoutProvider in component's state). LayoutProvider, of course, has different logic depending on the before-mentioned flag. |
I am using version 4.1.1 and trying to implement a RecyclerListView with a List/Grid view switch (as mentioned in the comment of LayoutProvider).
I'm NOT using forceNonDeterministicRendering because all my items have a well known dimensions, specified in the LayoutProvider per view type.
The two LayoutProviders for List and Grid view are working as expected.
However, when trying to implement a switch which toggles the LayoutProvider, the items which are rendered currently on screen disappear. When I keep toggling, the items keep disappearing.
Let's say I have 100 rows, 15 of them are rendered (with renderAheadOffset in mind). I then replace the LayoutProvider, the first 15 items disappear, the 16th, 17th an the rest are now at the start of the scroll view. If I replace the LayoutProvider again, then the next 15 items will disappear and so on.
I tried to dig something that would help me in the ViewRenderer and I was able to find out that the items that seemingly disappear actually have a width and height dimension set to 0. I tracked where this change of dimension is coming from using DebugHandlers and got to this commit which was made 4 months ago: #705
If I remove the _forceSizeUpdate call from the lib, toggling the List/Grid view works as expected, and items don't disappear, however I'm not sure if this breaks anything else.
I kindly ask if you could check it. Thx.
edit: Using v3.0.5 works as expected. This version does not include the #705.
The text was updated successfully, but these errors were encountered: