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

FlexboxLayoutManager does not recycle views with Navgraph #628

Open
ShahidAnjum opened this issue Aug 5, 2023 · 5 comments
Open

FlexboxLayoutManager does not recycle views with Navgraph #628

ShahidAnjum opened this issue Aug 5, 2023 · 5 comments

Comments

@ShahidAnjum
Copy link

Steps to reproduce

1: Create application with Navigation component (NavGraph and BottomNavigationView)
2: Create two fragments for Each tab of BottomNavigationView (HomeFragment & ListFragment)
3: Load items in (ListFragment) recycler view with pagination. Until here, there is no issue because view recycling is carried out correctly with each page's data.
4: Change the tab from ListFragment to HomeFragment, then back to ListFragment. View recycling fails at this point, and all views are created at once. However, the list's scroll state is preserved, which is handled by default when using NavGraph.

Expected behavior

View recycling should work properly even when the tab is switched, and only the list positions that are visible should be rendered. View recycling works perfectly fine when using LinearLayoutManager or GridLayoutManager

Version of the flexbox library

e.g. 3.0.0

Link to code

Github link of the sample project: https://github.com/ShahidAnjum/FlexBoxSample

@ShahidAnjum
Copy link
Author

When the list gets too big, the app sometimes crashes and causes ANR. because when you switch the fragments in the navGraph, all the items are created at once.

@thegypsydev
Copy link

I also face this similar issue, please let us know if you find any solution

@anjaliisinghh1
Copy link

Facing the same issue in my case as well. Please look into it.

@iamMehedi
Copy link

@thagikura any idea why this is happening or how it can be fixed?

@iamMehedi
Copy link

I have created a fork and updated the dependencies. The items in the grid uses DataBinding, I made a call to binding.executePendingBindings() after setting the variables in onBindViewHolder and made sure that at that point the item has a defined size. That seem to have resolved the issue for me.

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

No branches or pull requests

4 participants