google / flexbox-layout

Flexbox for Android
Apache License 2.0
18.25k stars 1.8k forks source link

Items disappear when using recyclerview with ItemTouchHelper for drag & drop using FlexboxLayoutManager #459

Open muzammilhussnain14 opened 6 years ago

muzammilhussnain14 commented 6 years ago

I am trying to implement item reordering by drag and drop in a RecyclerView using FlexboxLayoutManager. I attach ItemTouchHelper to my RecyclerView and than on function onItemMove I do following in my RecyclerView.AdapterImplementation

      override fun onMove(recyclerView: RecyclerView, fromVH: RecyclerView.ViewHolder, toVH: RecyclerView.ViewHolder){
        // swapping words in shuffled array
        Collections.swap(wordsShuffled, fromVH.adapterPosition, toVH.adapterPosition)
        // calling notify item moved to update UI
        notifyItemMoved(fromVH.adapterPosition, toVH.adapterPosition)
         //It messes up UI after notifyItemMoved some time few items disappear and sometime comeback in random order
    }

It messes up UI after notifyItemMoved some time few items disappear and sometime comeback in random order

gregkorossy commented 5 years ago

Any news about this?

zhaocheng19940105 commented 5 years ago

FlexboxLayoutManager notifyItemMoved(startIndex, endIndex) Item disappears Any news about this?

zhaocheng19940105 commented 5 years ago

There is no reply to this question?

navyifanr commented 2 years ago

@muzammilhussnain14 Do you have some solution for this bug?