-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
By multi-touch views I mean something like:
<View
onTouchStart={() => { console.log('pressing left button'); }}
onTouchEnd={() => { console.log('releasing left button'); }}
>
{...}
</View>
<View
onTouchStart={() => { console.log('pressing right button'); }}
onTouchEnd={() => { console.log('releasing right button'); }}
>
{...}
</View>
The idea is the user has to hold both the left and right button for something to be triggered (the bit that waits for both to be pressed isn't in the example above, but I want to make clear that the two touchables are separate elements).
This works fine on iOS but not on Android: related to facebook/react-native#10068.
So, was hoping I could use this library to work around that issue. Doesn't seem to work however -- replacing the above with
<BaseButton
onActiveStateChange={(isActive) => {
if (isActive) {
console.log('pressing left button');
} else {
console.log('releasing left button');
}
}}
>
{...}
</BaseButton>
<BaseButton
onActiveStateChange={(isActive) => {
if (isActive) {
console.log('pressing right button');
} else {
console.log('releasing right button');
}
}}
>
{...}
</BaseButton>
But this results in the same issue as using View: once one button is held, pressing the other triggers the original button's handler (on Android).
Is there any way to use simultaneousHandlers here?
dohvis, kmagiera, dgreensp, tyao1, martinezguillaume and 2 more