Preparing the PanHandlers

- [Instructor] The first thing we need to do…to implement the swiping of the deal images feature…is the 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 imageIndex,…and this starts from zero,…and in here, instead of hard coding the first element here,…we'll read the image from this.state.imageIndex.…

Let me format everything.…So this should not really change anything…except now we have the ability of…changing the image index and that will change the image.…In fact, we can 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 Animated, because we know we need to use…Animated as well.…

So we have PanResponder and Animated.…And we'll create a PanResponder object.…I'm going to name it imagePanResponder.…This is a PanResponder.create call,…

Resume Transcript Auto-Scroll

Author

Released

11/10/2017

React Native allows you to build native mobile apps using JavaScript and React. In this project-based course, learn how to use React Native to build production-ready, native mobile apps on both iOS and Android. To help acquaint you with the fundamentals of React Native, instructor Samer Buna takes a hands-on approach, showing how to build applications from scratch. He first walks through how to build a simple math game, and then demonstrates how to build a data-driven app. Along the way, he shows how to debug and solve common problems, and shares practical knowledge about testing and packaging your apps.