Replies: 2 comments 1 reply
-
Closest i could get is this. Here i use 2 gestures. With tap gesture i handle the regular onPress events. And with pan i am trying to handle the hold and release stuff. Problems are, 1.If i trigger
With this below, i reached somewhere but not exactly how i want. Sometimes i start holding but tap gesture fires instead. Sometimes even if i hold my finger on the screen and try to swipe gesture cancels itself.
|
Beta Was this translation helpful? Give feedback.
-
Hi @Bayramito! Wouldn't something like this work? import { View } from 'react-native';
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
} from 'react-native-gesture-handler';
export default function App() {
const tap = Gesture.Tap().onEnd(() => console.log('Show hint'));
const longPress = Gesture.LongPress()
.onStart(() => console.log('Start recording'))
.onEnd(() => console.log('End recording'));
const pan = Gesture.Pan()
.onEnd(() => console.log('Cancel recording'))
.minDistance(30);
const g = Gesture.Race(tap, longPress, pan);
return (
<GestureHandlerRootView>
<GestureDetector gesture={g}>
<View
style={{
width: 200,
height: 200,
backgroundColor: 'crimson',
borderRadius: 100,
}}
/>
</GestureDetector>
</GestureHandlerRootView>
);
} Of course you'd have to adjust |
Beta Was this translation helpful? Give feedback.
-
How can I make Whatsapp like. voice recording button gesture?
In whatsapp, if the input is empty, by default there is a voice button.
This button has 3 gestures combines.
Does anyone knows how to achieve such behavior ?
Beta Was this translation helpful? Give feedback.
All reactions