Detect swipe left in React Native
I've found that react-native-swipe-gestures
isn't stable (swipes works randomly on android) and react-native-gesture-handler
is overcomplicated (too much efforts to just add to project).
Simplified solution based on Kuza Grave's answer, who's solution works perfect and very simple:
<View
onTouchStart={e=> this.touchY = e.nativeEvent.pageY}
onTouchEnd={e => {
if (this.touchY - e.nativeEvent.pageY > 20)
console.log('Swiped up')
}}
style={{height: 300, backgroundColor: '#ccc'}}
/>
There is an existing component react-native-swipe-gestures
for handling swipe gestures in up, down, left and right direction, see https://github.com/glepur/react-native-swipe-gestures