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.11k stars 980 forks source link

Right action is not visible if calling openRight on ReanimatedSwipeable #3194

Open yongwei-finesse opened 1 week ago

yongwei-finesse commented 1 week ago

Description

We are using ReanimatedSwipeable to show a right action when a cell is swiped. We may also show that action when a button is tapped by calling openRight on that swipable. When the right action is shown, if we drag that action back instead of swiping it back, calling openRight will not show the action again. Please check the attached video.

We did some investigation and found that the variable rightActionTranslate defined in ReanimatedSwipeable.ts is -10000 when the bug happens, and so the right action is actually shown out of the screen.

https://github.com/user-attachments/assets/91508e88-1847-4fd8-b24c-2617b5497944


Steps to reproduce

We have a cell contained in ReanimatedSwipeable, and a Delete button in that cell. openRight will be called when the delete button is tapped.

  1. Swipe the cell to show the right action
  2. Drag the cell to hide the right action
  3. Tap the Delete button so that openRight is called to show the right action

Snack or a link to a repository

Just use the latest code

Gesture Handler version

2.20.2

React Native version

0.74.3

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 1 week ago

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?

latekvo commented 2 days ago

Hi @yongwei-finesse, thank you for reporting this.

Could you please let me know if this issue still occurs in this PR? Unfortunately I wasn't able to replicate it on my end, neither on the main branch, and the aforementioned PR.

yongwei-finesse commented 9 hours ago

Yeah. The issue doesn't occur in the PR you mentioned. But the PR has a regression though. If we call openRight before swiping the cell, the right action won't be shown. openRight only works after the cell has been swiped at least once.