Skip to content

ReanimatedSwipeable: onSwipeableClose is triggered when onSwipeableOpen is not set #3475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
febis001 opened this issue Apr 5, 2025 · 1 comment · May be fixed by #3478
Open

ReanimatedSwipeable: onSwipeableClose is triggered when onSwipeableOpen is not set #3475

febis001 opened this issue Apr 5, 2025 · 1 comment · May be fixed by #3478
Labels
Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS

Comments

@febis001
Copy link

febis001 commented Apr 5, 2025

Description

I’ve observed unexpected behavior in the ReanimatedSwipeable component. When the onSwipeableOpen prop is not provided, the onSwipeableClose callback is triggered even after the component has opened. This is based on the code (see snippet below and ReanimatedSwipeable.tsx#L362). The dispatchEndEvents function dispatches onSwipeableClose when the previous conditions fail due to not set onSwipeableOpen.

I'm not sure if this is a bug or the intentional behavior, but this leads to a confusing situation where an onSwipeableClose event is fired right after opening, which is not intuitive.

Steps to reproduce

  1. Render the Swipeable component without passing an onSwipeableOpen callback, but with an onSwipeableClose callback.
  2. Open the Swipeable element.
  3. Observe that onSwipeableClose is triggered immediately after opening.

Snack or a link to a repository

N.A.

Gesture Handler version

2.25.0

React Native version

0.77

Platforms

iOS, Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Copy link

github-actions bot commented Apr 5, 2025

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS labels Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS
Projects
None yet
1 participant