| id | handlers |
|---|---|
| title | Gesture Handlers |
Here are a gesture recognizers currently available in the package:
TapGestureHandlerLongPressGestureHandlerPanGestureHandlerPinchGestureHandlerRotationGestureHandlerFlingGestureHandlerForceTouchGestureHandler
Whenever you use a native component that should handle touch events you can either wrap it with NativeViewGestureHandler or import wrapper component exported by the library instead of importing it from react-native package. Here is the list of available components:
ScrollViewSwitchTextInputToolbarAndroid(Android only)DrawerLayoutAndroid(Android only)
Library exports a State object that provides a number of constants used to express the state of the handler. Here are the available constants:
State.UNDETERMINED- default and initial stateState.FAILED- handler failed recognition of the gestureState.BEGAN- handler has initiated recognition but have not enough data to tell if it has recognized or notState.CANCELLED- handler has been cancelled because of other handler (or a system) stealing the touch streamState.ACTIVE- handler has recognizedState.END- gesture has completed
idenabledshouldCancelWhenOutsidesimultaneousHandlerswaitForhitSlop(accepts only negative values on iOS)onGestureEventonHandlerStateChangeonBeganonFailedonCancelledonActivatedonEnded
maxDurationMsmaxDelayMsnumberOfTaps
shouldActivateOnStartdisallowInterruption
minDurationMsmaxDist
minDeltaXminDeltaYmaxDeltaXmaxDeltaYminOffsetXminOffsetYminDistminVelocityminVelocityXminVelocityYminPointersmaxPointersavgTouches(Android only)
directionnumberOfPointers
If you want to create a gesture handler wrapper for your own custom component, you can use this utility function. For example, if you want to use Slider with gesture handler, then you can implement it like this:
const WrappedSlider = createNativeWrapper(Slider, {
shouldCancelWhenOutside: false,
shouldActivateOnStart: true,
disallowInterruption: true,
});The second argument is a config object of type NativeViewGestureHandlerProperties which accepts a list of properties you want to pass to the underlying gesture handler wrapper.