react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

Glitch on drag end

Open fabrizio-bianchi opened this issue 10 months ago • 23 comments

This package has external dependencies of react-native-reanimated and react-native-gesture-handler which must be installed separately. Before opening an issue related to animations or gestures please verify that you have completed ALL installation steps, including the changes to MainActivity.

Describe the bug A glitch occurs on drag end when the data is updated.

https://github.com/user-attachments/assets/2e77d8ab-c3c6-40e2-a7ae-9a20443e4de8

To Reproduce Just run the code example shown on the readme page.

Platform & Dependencies Please list any applicable dependencies in addition to those below (react-navigation etc).

  • react-native-draggable-flatlist version: 4.0.1
  • Platform: iOS 18 (iPhone 15 Pro Max) and iPadOS 18 (iPad Pro) via Expo Go
  • React Native or Expo version: 52.0.7
  • Reanimated version: 3.16.1
  • React Native Gesture Handler version: 2.20.2

Thank you for your help.

fabrizio-bianchi avatar Jan 22 '25 18:01 fabrizio-bianchi

Hi @fabrizio-bianchi ! Try this library. Works correctly and is updated regularly.

Fjort avatar Jan 22 '25 18:01 Fjort

This package has external dependencies of react-native-reanimated and react-native-gesture-handler which must be installed separately. Before opening an issue related to animations or gestures please verify that you have completed ALL installation steps, including the changes to MainActivity.

Describe the bug A glitch occurs on drag end when the data is updated.

ScreenRecording_01-22-2025.19-05-00_1.MP4 To Reproduce Just run the code example shown on the readme page.

Platform & Dependencies Please list any applicable dependencies in addition to those below (react-navigation etc).

  • react-native-draggable-flatlist version: 4.0.1
  • Platform: iOS 18 (iPhone 15 Pro Max) and iPadOS 18 (iPad Pro) via Expo Go
  • React Native or Expo version: 52.0.7
  • Reanimated version: 3.16.1
  • React Native Gesture Handler version: 2.20.2

Thank you for your help.

The same for me!

a33nazarenko avatar Jan 23 '25 07:01 a33nazarenko

I have this issue too. I forked the repository here: https://github.com/kilian/react-native-draggable-flatlist and applied the changes from https://github.com/computerjazz/react-native-draggable-flatlist/pull/550 and https://github.com/computerjazz/react-native-draggable-flatlist/pull/551 in the hope that updating support for reanimated 3 fixed the issue but unfortunately it doesn't. It does however fix the enter and exit animations.

This issue is a duplicate from https://github.com/computerjazz/react-native-draggable-flatlist/issues/434 where blame is essentially (and imo incorrectly) placed on performance, but as @fabrizio-bianchi found out, it easily replicates in the example.

Also a duplicate from https://github.com/computerjazz/react-native-draggable-flatlist/issues/561

@computerjazz I know this library is essentially in maintenance mode for you, but you are probably the person to resolve this fastest.

Kilian avatar Jan 29 '25 16:01 Kilian

Applying (the changes made in) this patch fixes this specific glitch: https://github.com/computerjazz/react-native-draggable-flatlist/issues/561#issuecomment-2511831441 but now occasionally after drag the cells either animate out of view or jump around in a different manner, so it's not quite a fix either.

Kilian avatar Jan 29 '25 16:01 Kilian

@Kilian @Fjort @a33nazarenko @fabrizio-bianchi Same issues here. Looks like we are all looking for either a fix or an alternative. Maybe we can help each other out. @Fjort already mentioned react-native-reorderable-list as alternative. I tried using it, but so far it makes the glitches even worse or I am not using it correctly. In the issue I opened there, you guys can find my code diff if you are interested. So far I do not know why it is not working. Maybe related to Expo Go.

@Kilian I would like to try your fork. Any news there? Could you publish an npm package?

tomwaitforitmy avatar Feb 16 '25 11:02 tomwaitforitmy

My fork doesn't fix this issue but it does fix all the reanimated issues. You can use it from GitHub directly by setting the version to "kilian/react-native-draggable-flatlist", like so:

"react-native-draggable-flatlist": "kilian/react-native-draggable-flatlist",

Kilian avatar Feb 17 '25 08:02 Kilian

Thanks, I will give that a try.

tomwaitforitmy avatar Feb 17 '25 20:02 tomwaitforitmy

@Kilian the author of react-native-reorderable-list fixed my issue. I was inserting an array of strings. Instead an array of objects with an extra id was required which makes sense for sorting things I suppose. Now everything works super smoothly. It did even fix two bugs me (I was not always able to drag the first item and I had to leave a margin at the right to be able to scroll smoothly with this package here). I would recommend switching packages.

tomwaitforitmy avatar Feb 22 '25 15:02 tomwaitforitmy

Hi @fabrizio-bianchi ! Try this library. Works correctly and is updated regularly.

not works with horizontal lists 😢

hlus avatar Mar 26 '25 18:03 hlus

@Kilian the author of react-native-reorderable-list fixed my issue. I was inserting an array of strings. Instead an array of objects with an extra id was required which makes sense for sorting things I suppose. Now everything works super smoothly. It did even fix two bugs me (I was not always able to drag the first item and I had to leave a margin at the right to be able to scroll smoothly with this package here). I would recommend switching packages.

Hey @tomwaitforitmy, could you please comment the code diff after your issue is fixed?

rohit9625 avatar Apr 06 '25 08:04 rohit9625

I've tracked the bug down and I've opened a PR for the fix. This is the patch.

callaars avatar Apr 23 '25 14:04 callaars

@rohit9625 Not sure what exactly are you asking. I assume you are asking me which part in my code I changed, to fix my issue: Checkout this change set. Somehow react-native-draggable-flatlist was able to work with the array index as key property while react-native-reorderable-list does not work with that. You need another/better key.

tomwaitforitmy avatar May 02 '25 12:05 tomwaitforitmy

@rohit9625 Not sure what exactly are you asking. I assume you are asking me which part in my code I changed, to fix my issue: Checkout this change set. Somehow react-native-draggable-flatlist was able to work with the array index as key property while react-native-reorderable-list does not work with that. You need another/better key.

Oh! my bad. So you were talking about the issue with reorderable-list and I thought you were saying that @Kilian helped you to solve this flicker issue. Sorry to bother you :(

rohit9625 avatar May 02 '25 12:05 rohit9625

Ah, nope sorry. I just wanted to notify others here, that I was able to exchange the package.

tomwaitforitmy avatar May 02 '25 12:05 tomwaitforitmy

I ran into the same issue. I originally tested it with image boxes, but even after debugging and gradually simplifying it down to the example code, the issue still remains. Iphone 16 pro ios: 18.3.1 expo: "^52.0.0", react-native-draggable-flatlist : 4.0.2 react-native-reanimated: 3.16.7

https://github.com/user-attachments/assets/f808048a-977e-4eb7-93f4-1e877021bf42

shuvitRan avatar May 06 '25 03:05 shuvitRan

Would you mind retesting from the main branch? A PR solving this issue just got merged.

rohit9625 avatar May 06 '25 04:05 rohit9625

I ran into the same issue. I originally tested it with image boxes, but even after debugging and gradually simplifying it down to the example code, the issue still remains. Iphone 16 pro ios: 18.3.1 expo: "^52.0.0", react-native-draggable-flatlist : 4.0.2 react-native-reanimated: 3.16.7

Screen.Recording.2025-05-05.at.11.40.38.PM.mov

Updated: the 4.0.3 solved my issue

shuvitRan avatar May 07 '25 00:05 shuvitRan

But that version isn't released yet. Where did you find it?

rohit9625 avatar May 07 '25 02:05 rohit9625

it is released

Image

shuvitRan avatar May 07 '25 03:05 shuvitRan

Oh, okay. Got it. The screenshot is from the npm website. I was looking at the GitHub release page. Thanks BTW @shuvitRan

rohit9625 avatar May 07 '25 03:05 rohit9625

I still meet this issue. I use ver 4.0.3 - the last version

huynhhq avatar May 13 '25 04:05 huynhhq

Could you show me a little screen recording, I'll have a look!

callaars avatar May 13 '25 12:05 callaars

still got the issue with 4.0.3

Brma1048 avatar Jun 23 '25 13:06 Brma1048

I tested with v4.0.3 and I’m still experiencing some glitches when the drag ends.

A while ago I opened a PR to improve the component’s reliability — it’s still up to date as of today, except I rolled back commit b780c49 because it reintroduced some unwanted glitches:

https://github.com/computerjazz/react-native-draggable-flatlist/pull/469

I’m using that version in an Expo 52 project (old architecture) and it works without issues.

Leaving it here in case it helps anyone — along with a real-world usage example:

https://github.com/outaTiME/ambito-dolar/blob/master/packages/client/screens/CustomizeRatesScreen.js#L94

outaTiME avatar Jul 03 '25 14:07 outaTiME

Same issue in 4.0.3

Sydney-o9 avatar Jul 26 '25 11:07 Sydney-o9

same issue in 4.0.3

krishnan-456 avatar Sep 23 '25 15:09 krishnan-456

can we fix this next version ?

krishnan-456 avatar Sep 23 '25 15:09 krishnan-456