7 Animations

 

This chapter covers

  • Creating basic animations using Animated.timing
  • Using interpolation with animated values
  • Creating animations and in parallel
  • Staggering animations using Animated.stagger
  • Using the native driver to offload animations to the native UI thread

One of the great things about React Native is the ability to easily create animations using the Animated API. This is one of the more stable and easy to use React Native APIs, and it’s one of the few places in the React Native ecosystem where, unlike areas such as navigation and state management, there’s almost 100% agreement on how a problem should be solved.

Animations are usually used to enhance the UI of an application and bring more life to the existing design. Sometimes, the difference between an average and above-average user experience can be attributed to using the right animations at the right time, thus setting an app apart from other, similar apps.

Real-world use cases that we cover in this chapter include the following:

  • Expanding user inputs that animate when focused
  • Animated welcome screens that have more life than a basic static welcome screen
  • A custom animated loading indicator

In this chapter, we dive deeply into how to create animations. We’ll cover everything you need to know to take full advantage of the Animated API.

7.1 Introducing the Animated API

 
 
 

7.2 Animating a form input to expand on focus

 

7.3 Creating a custom loading animation using interpolation

 
 

7.4 Creating multiple parallel animations

 
 
 

7.5 Creating an animated sequence

 
 
 

7.6 Using Animated.stagger to stagger animation start times

 
 

7.7 Other useful tips for using the Animated library

 
 
 

7.7.1 Resetting an animated value

 
 

7.7.2 Invoking a callback

 
 

7.7.3 Offloading animations to the native thread

 
 
 

7.7.4 Creating a custom animatable component using createAnimatedComponent

 
 
 
 

Summary

 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest