From the course: React Native Essential Training
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Handling swipe gestures - React Native Tutorial
From the course: React Native Essential Training
Handling swipe gestures
- [Instructor] We are swiping left and right, but we now need to handle the swipe. What is going to happen when a swipe is complete? And if you remember, we can do operations after an animation is complete using the callback argument for the start method. So in here, this is the function we're going to handle the swipe. So I'll go ahead and write a new function for handling swipe. We'll call this function handleSwipe, and I'll just call it here. And eventually the handleSwipe is going to be different if we're swiping left and right, but let's start with a simple handle swipe left. We'll define handleSwipe. This is a function, in this function, we want to do two things. First, we want to update the state and change the image index that makes the view change its content, and then we want to animate the same view that is holding the image that we swiped completely to the left, we want to animate it from the right. So…
Contents
-
-
-
-
-
-
-
(Locked)
Preparing for swiping1m 17s
-
(Locked)
The Animated and Easing APIs4m 19s
-
(Locked)
Creating an animation loop6m 31s
-
(Locked)
Considering the device dimensions6m 50s
-
(Locked)
The PanResponder API3m 51s
-
(Locked)
Preparing the PanHandlers3m 46s
-
(Locked)
Swiping left and right6m 9s
-
(Locked)
Handling swipe gestures7m 44s
-
(Locked)
Opening URLs2m 57s
-
(Locked)
-
-