expo-multi-touch
Module for getting events whenever a individual touch changes
To get started: yarn add expo-multi-touch
in your Expo project and import it with
import { MultiTouchView } from 'expo-multi-touch';
.
Components
<MultiTouchView />
Wrap your components with this component and use it to get notified whenever a touch begins, moves, ends, or cancels.
Props
Property | Type | Default | Description |
---|---|---|---|
onTouchBegan | function | function | called when a single touch begins |
onTouchMoved | function | function | called when a single touch moves |
onTouchEnded | function | function | called when a single touch ends |
onTouchCancelled | function | function | called when a single touch cancels |
onTouchesBegan | function | function | called when a touch begins (onPanResponderGrant) |
onTouchesMoved | function | function | called when a touch moves (onPanResponderMove) |
onTouchesEnded | function | function | called when a touch ends (onPanResponderRelease) |
onTouchesCancelled | function | function | called when a touch cancels (onPanResponderTerminate) |
onStartShouldSetPanResponder | () => Boolean | () => true | Ask to be the responder |
onStartShouldSetPanResponderCapture | () => Boolean | () => true | Ask to be the responder |
onMoveShouldSetPanResponder | () => Boolean | () => true | Ask to be the responder |
onMoveShouldSetPanResponderCapture | () => Boolean | () => true | Ask to be the responder |
onPanResponderTerminationRequest | () => Boolean | () => true | Should the responder terminate the request |
onShouldBlockNativeResponder | () => Boolean | () => true | Android: Should the responder block native requests |
Structure
A function is passed an event with the following structure:
event = ...eventnativeEvent {} {} gestureState
instead of
{}
Example
Snack
;;; Component { const props = { console; } { const identifier deltaX deltaY isTap isLongPress = event; console; } { console; } { } { console; } { console; } ; return <MultiTouchView style= flex: 1 ...props> <View /> </MultiTouchView> }