software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

[web] Gesture.Pan() fires `onStart` when toggling `enabled` #3074

Closed frankcalise closed 2 months ago

frankcalise commented 2 months ago

Description

When running on web with a Gesture.Pan(), there is an issue where the onStart callback will be fired if you toggled the enabled property from false to true. It does not occur if you leave it out (true by default).

Another observation, that unlike when you actually start making a dragging gesture, onBegin is not fired in this toggle of enabled case.

Seems to be similar in terms of side effects in https://github.com/software-mansion/react-native-gesture-handler/issues/1223#issuecomment-755026018 but for web

Screen Capture

https://github.com/user-attachments/assets/e85d829b-9689-4bc5-8517-c058eb93f1fc

Steps to reproduce

  1. git clone git@github.com:frankcalise/flash-list-drag-order
  2. yarn
  3. yarn ios or yarn android (observer that toggling does not put the floating row on screen)
  4. yarn web observe the issue described above

Snack or a link to a repository

https://github.com/frankcalise/flash-list-drag-order

Gesture Handler version

2.16.2

React Native version

0.74.5

Platforms

Web

JavaScript runtime

Hermes

Workflow

Expo managed workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

None

Device model

No response

Acknowledgements

Yes

latekvo commented 2 months ago

Hi @frankcalise, Thank you for reporting this issue.

Please let me know if this PR fixes your issue.