nuclearpasta / react-native-drax

A drag-and-drop system for React Native
MIT License
554 stars 68 forks source link

Update underlying react-native-gesture-handler from 1.8 to 2.x #140

Open bitkiller42 opened 2 years ago

bitkiller42 commented 2 years ago

The 2.x version of react-native-gesture-handler has some breaking changes with react-native-drax. Using the old 1.x version of react-native-gesture-handler is sometimes difficult in projects, e.g. Expo.

Known warnings and errors

[react-native-gesture-handler] Seems like you're using an old API with gesture components, check out new Gestures system!
at node_modules/react-native-gesture-handler/src/handlers/createHandler.ts:128:4 in showRngh2NoticeIfNeeded
at node_modules/react-native-gesture-handler/src/handlers/createHandler.ts:176:31 in Handler#constructor
at node_modules/react/cjs/react.development.js:384:2 in Component.prototype.forceUpdate
EventEmitter.removeListener('change', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.
at node_modules/react-native/Libraries/vendor/emitter/_EventEmitter.js:164:4 in EventEmitter#removeListener
at node_modules/react-native/Libraries/Utilities/Dimensions.js:122:4 in removeEventListener
at node_modules/react/cjs/react.development.js:384:2 in Component.prototype.forceUpdate
at node_modules/react-native/Libraries/WebSocket/WebSocket.js:242:8 in _eventEmitter.addListener$argument_1
at node_modules/react-native/Libraries/vendor/emitter/_EventEmitter.js:150:10 in EventEmitter#emit

UPDATE: EventEmitter solved with PR https://github.com/nuclearpasta/react-native-drax/pull/125 , so not part of this issue

Workaround

This makes react-native-drax usable with react-native-gesture-handler 2.x, but you will see warnings and it feels slow.

Surround the drax/DraxProvider with gesture-handler/GestureHandlerRootView

Related issues

lafiosca commented 2 years ago

It may be time for someone to revise this entire library to bring it up to modern standards. I have not had the availability to work on it in any depth for quite a while now, as much as I would love to see that. I sadly cannot make any commitments as to when I will be able to address this.

ammarahm-ed commented 2 years ago

The library still seems to work great with latest react native version. I have been using it in a project recently and everything seems to work. The performance is average. The new gesture handler api + reanimated could be the perfect recipe for the next version of this amazing library. It still is the best implementation in the ecosystem.