Skip to content

Conversation

j-piasecki
Copy link
Member

Description

Should fix #2160

This PR changes the logic of responder by splitting it in two: one for sound and one for touch exclusivity. Button can become the touch responder when setPressed method is called with pressed set to true and it also is the touch responder. The sound responder is freed in the performClick method - after that point setPressed should only be called with pressed set to false for existing pointers. This prevents the sound effect from being played more than one time when pressing on nested buttons.

It also adds more ways to free the responder: it reverts a change from a while back that frees responder on gesture end and frees the responder when button holding it receives POINTER_CANCEL event. Because of that, the responder should always be freed correctly, preventing the buttons from becoming unresponsive.

Test plan

Tested on the example app (using the new and existing example) and on the code from the issue.

@hirbod
Copy link

hirbod commented Sep 24, 2022

Looks like the fix works @j-piasecki - can we get this shipped quickly please? But I am still not sure if it fixed the issue in general. Its happen sporadically and I can't say with 100% confidence that it has fixed all occurrences , because casual RectButtons have been breaking as well. (even when not nested etC)

@j-piasecki j-piasecki marked this pull request as ready for review October 3, 2022 07:06
…me' of github.com:software-mansion/react-native-gesture-handler into @jpiasecki/fix-android-nested-buttons-seriously-this-time
Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@j-piasecki j-piasecki merged commit e0f2293 into main Oct 3, 2022
@j-piasecki j-piasecki deleted the @jpiasecki/fix-android-nested-buttons-seriously-this-time branch October 3, 2022 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<RectButton> becomes unresponsive when used within a List
3 participants