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.

Preparing the PanHandlers

Preparing the PanHandlers - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

Preparing the PanHandlers

- [Instructor] The first thing we need to do to implement the swiping of the deal images feature is to make the active image index part of the component state because we want to change the image index and have the image changes. So let's do that first. I'll name it image index. And this starts from zero and in here, instead of hard coding the first element here we'll read the image from this.state.image index. Let me format everything. So this should not really change anything, except now we have the ability of changing the image index and that would change the image. In fact, we could test that from the developer tool. So I'll look for the detail view, go in here, change the image index to one and see the image changes. The next thing we can do is to define the PanResponder. So from React Native we'll import PanResponder. We'll also import Animated 'cause we know we need to use Animated as well. So we have PanResponder…

Contents