Understanding React Native Gesture Handler
React Native Gesture Handler is a third-party library that completely replaces the built-in gesture responder system while offering more control and higher performance.
React Native Gesture Handler works best in combination with Reanimated 2 because it was written by the same team and relies on the worklets provided by Reanimated 2.
Information
This book refers to React Native Gesture Handler version 2.0. Version 1 is also used in a lot of projects.
The React Native Gesture Handler 2 API is based on GestureDetectors
and Gestures
. While it does also support the API from version 1, I would recommend using the new API, as it is easier to read and understand.
Let’s create the draggable circle example from the previous section, but this time we use React Native Gesture Handler and Reanimated 2:
const CIRCLE_SIZE = 50; export default props => { const dimensions = useWindowDimensions(); const...