How it works...
In step 5, we set the animation values. The first line resets the initial value every time we call this method. For this example, the initial value will be the width of the device, which will move the image to the right-hand side of the screen, where we want to start our animation.
Then, we use the Animated.timing function to create an animation based on time and take two parameters. For the first parameter, we pass in animatedValue, which we created in the componentWillMount lifecycle hook in step 4. The second parameter is an object with configurations for the animation. In this case, we are going to set the end value to minus the width of the image, which will place the image on the left-hand side of the screen. We complete ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access