From the course: React Native Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The PanResponder API

The PanResponder API - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

The PanResponder API

- [Instructor] React Native has a built in gesture recognizing system called the PanResponder. We can use it to detect when the screen is being touched and released, and we can read the accumulated distance between the first touch and the release. So it's not just when the screen is touched, but also where the touch gesture is going and where it ended. So we can easily implement features like drag and drop or swipe left and right with this API. We can also recognize multitouch features like pinch, zoom, or shrink. Our example will be a simple one. We want to recognize these swipe left and right gesture and do something when they are detected. One thing to understand is that the PanResponder itself does not make any changes to the UI. It is used to only detect fingers on screen movements. This is why the PanResponder is usually used with the Animated API so that we can do actual changes to the UI in response to detected…

Contents