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

Support react-native-reanimated 2

Open nelsonprsousa opened this issue 5 years ago • 20 comments
trafficstars

Describe the solution you'd like We could take advantages of the new react-native-reanimated 2, already using Turbo Modules.

nelsonprsousa avatar Nov 21 '20 15:11 nelsonprsousa

The same problem

lh9403 avatar Mar 05 '21 08:03 lh9403

@computerjazz is there any plans to rewrite the lib with reanimated v2, now that it is stable?

nelsonprsousa avatar Mar 10 '21 12:03 nelsonprsousa

@nelsonprsousa @computerjazz Hello, please take a look at this request. https://github.com/computerjazz/react-native-draggable-flatlist/pull/270

pirroman avatar Mar 14 '21 14:03 pirroman

Can't wait. Thanks for this cool lib.

chanlito avatar Mar 18 '21 03:03 chanlito

@pirroman Just checked that #270 was merged, however we still have warnings using REA v2 (it is working nevertheless)

nelsonprsousa avatar Apr 12 '21 20:04 nelsonprsousa

@nelsonprsousa I saw those warnings. This is because Animated.createAnimatedComponent method is being used. It returns components with legacy references. I couldn't fix it quickly, but it shouldn't affect the work itself.

pirroman avatar Apr 12 '21 21:04 pirroman

Okay, thank you @pirroman It would be awesome to see a real migration to v2 to take advantage of turbo modules, maybe the author can do it someday 😜

nelsonprsousa avatar Apr 12 '21 21:04 nelsonprsousa

;)

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

computerjazz avatar Apr 12 '21 21:04 computerjazz

;)

#276

Wow, you rock 🚀

nelsonprsousa avatar Apr 12 '21 22:04 nelsonprsousa

UPDATE: While migrating to reanimated 2 is in the long-term plan, v2 currently has performance issues when rendering lots of nodes. Until these are addressed, this package (as well as react-native-swipeable-item) will stick to the v1 implementation, which is much more performant.

see: https://github.com/software-mansion/react-native-reanimated/issues/1710 https://github.com/software-mansion/react-native-reanimated/issues/1635 https://github.com/software-mansion/react-native-reanimated/discussions/1632

computerjazz avatar May 22 '21 21:05 computerjazz

UPDATE: While migrating to reanimated 2 is in the long-term plan, v2 currently has performance issues when rendering lots of nodes. Until these are addressed, this package (as well as react-native-swipeable-item) will stick to the v1 implementation, which is much more performant.

see: software-mansion/react-native-reanimated#1710 software-mansion/react-native-reanimated#1635 software-mansion/react-native-reanimated#1632

Will there be a beta using v2 that we can use if we want?

nelsonprsousa avatar May 22 '21 21:05 nelsonprsousa

v2 migration is on hold until the rewrite is released (https://github.com/computerjazz/react-native-draggable-flatlist/pull/281) and the above performance issues are addressed.

computerjazz avatar May 22 '21 21:05 computerjazz

@computerjazz Quite confused, since package.json requires reanimated v2.0 or higher as a peer dependency? So if the migration is not ready, why did the peer deps get bumped?

Not wanting to hijack this issue but when I use v2 I'm unable to drag on the iOS simulator on v2.6.2. Works perfectly fine with reanimated < 2.0.0

svenlombaert avatar May 25 '21 16:05 svenlombaert

v2 peer dep shouldn't have been bumped, I will revert that. This package is currently compatible with BOTH v1 and v2, and v1 will be supported for the immediate future.

The migration is completely separate from making the package compatible with v2. The purpose of the migration is to make this package actually use the new v2 apis. Since v2 is backwards compatible, we can still use the v1 apis.

Not sure about that drag issue. please open a separate issue with a snack repro.

computerjazz avatar May 25 '21 16:05 computerjazz

Now it's 2022, what's the status of this issue? I wonder if Reanimated v2 is officially supported or not.

I'm facing into the problem described by svenlombaert, which also appears in these issues:

  • https://github.com/computerjazz/react-native-draggable-flatlist/issues/304
  • https://github.com/computerjazz/react-native-draggable-flatlist/issues/314

Downgrading Reanimated to 1.13.4 worked for iOS but it breaks Android build (maybe due to compatibility with other packages), so I'm in a dead lock now.

Is the codebase tested on Reanimated v2?

yuhr avatar Mar 31 '22 09:03 yuhr

Now it's 2022, what's the status of this issue? I wonder if Reanimated v2 is officially supported or not.

I'm facing into the problem described by svenlombaert, which also appears in these issues:

Downgrading Reanimated to 1.13.4 worked for iOS but it breaks Android build (maybe due to compatibility with other packages), so I'm in a dead lock now.

Is the codebase tested on Reanimated v2?

I am using this library in the current latest version (3.0.6) with Reanimated (2.5.0) and it works. Some warnings related with react-native-gesture-handler are being generated, tho. @computerjazz know much better what's happening and the state of draggable-flatlist and REA v2 + RNGH.

nelsonprsousa avatar Mar 31 '22 10:03 nelsonprsousa

TLDR: react-native-draggable-flatlist is compatible with Reanimated v2, it's mostly an implementation detail that we're using the backwards-compatible v1 apis under the hood for better performance.

I'm curious, this seems to be a common misconception that you cannot use reanimated v2 in a project with react-native-draggable-flatlist. Is there some misleading documentation somewhere?

As far as upgrading to the v2 api ,we're in basically the same boat as we were when reanimated v2 launched. It's simply not performant enough to handle react-native-draggable-flatlist—I guarantee you would not be happy with the result if we started using the v2 api as it stands today. Feel free to make some noise on this issue that I opened a while back ;) https://github.com/software-mansion/react-native-reanimated/issues/2845

As far as the drag issue you're facing, please provide a repro snack/project and I'll look into it.

computerjazz avatar Mar 31 '22 16:03 computerjazz

Thanks, then there might be another factor I'm not aware of. I'm going to tinker around the dependencies further and try to create a repro.

I'm curious, this seems to be a common misconception that you cannot use reanimated v2 in a project with react-native-draggable-flatlist. Is there some misleading documentation somewhere?

My bad, in my case the misconception mostly came from the fact that this issue is still open and seemed to be inactive for several months. Another point is somone says “v1.13.3 is the latest working version with draggable flatlist” in the issues I listed above.

yuhr avatar Apr 01 '22 09:04 yuhr

Now it's 2022, what's the status of this issue? I wonder if Reanimated v2 is officially supported or not.

I'm facing into the problem described by svenlombaert, which also appears in these issues:

Downgrading Reanimated to 1.13.4 worked for iOS but it breaks Android build (maybe due to compatibility with other packages), so I'm in a dead lock now.

Is the codebase tested on Reanimated v2?

Back then, on that version, the peer dependencies where just pinned wrongly and I had to install with the --force flag. So I thought I had to have reanimated v2. Still works fine with 1.x now.

svenlombaert avatar Apr 01 '22 09:04 svenlombaert

Now it's 2022, what's the status of this issue? I wonder if Reanimated v2 is officially supported or not.

I'm facing into the problem described by svenlombaert, which also appears in these issues:

Downgrading Reanimated to 1.13.4 worked for iOS but it breaks Android build (maybe due to compatibility with other packages), so I'm in a dead lock now.

Is the codebase tested on Reanimated v2?

@computerjazz the issue with the item moving position on long press still exists. Note the issue only occurs after scrolling down the list. Scrolling to the top of the list and then dragging works fine. I have tried downgrading reanimated to 1.13.4 but that didn't work. Any idea?

Dependencies: "react": "^17.0.2", "react-native": "0.68.2" "react-native-gesture-handler": "^1.9.0", "react-native-reanimated": "^2.2.4", "react-native-draggable-flatlist": "^3.1.2",

Code structure example: NestableScrollContainer NestableDraggableFlatList NestableDraggableFlatList ... NestableScrollContainer

robertcreaner avatar Sep 19 '22 20:09 robertcreaner