Open ShahidAnjum opened 1 year ago
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.
I also face this similar issue, please let us know if you find any solution
Facing the same issue in my case as well. Please look into it.
@thagikura any idea why this is happening or how it can be fixed?
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.
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