Guides
Plan-enterprise-icon
Expo Application Services
API Reference

GestureHandler

An API for handling complex gestures. From the project's README:
Info-icon
This library provides an API that exposes mobile platform specific native capabilities of touch & gesture handling and recognition. It allows for defining complex gesture handling and recognition logic that runs 100% in native thread and is therefore deterministic.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Status-success-iconStatus-success-iconStatus-success-iconStatus-success-iconStatus-success-icon

Installation

Terminal
→ npx expo install react-native-gesture-handler

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

API

Add this import to the top of your app entry file, such as App.js:
import 'react-native-gesture-handler';
This will ensure that appropriate event handlers are registered with React Native. Now, you can import gesture handlers wherever you need them:
import { TapGestureHandler, RotationGestureHandler } from 'react-native-gesture-handler';

class ComponentName extends Component {
  render() {
    return (
      <TapGestureHandler>
        <RotationGestureHandler>...</RotationGestureHandler>
      </TapGestureHandler>
    );
  }
}

Usage

Read the react-native-gesture-handler docs for more information on the API and usage.
  • Message-iconAsk a question on the forums about GestureHandler
  • Github-iconView open bug reports for GestureHandler
  • Code-iconView source code for GestureHandler
  • Build-iconView package in npm Registry
  • Edit-iconEdit this page

Was this doc helpful?