React Native List View : Animate Rows While Scrolling Using FlatList
In my previous post I have written about how to use React Native FlatList and we have seen the issues we face with pagination also how to add a loading indicator in the footer of FlatList. You can first read about it Link In this post we will see how to animate the rows while scrolling a FlatList.
Animating Rows In React Native FlatList :
To achieve animation for FlatList Rows, you have to install an npm module react-native-animatable, which provides variety of smooth animations for List Rows.
Installation of npm module:
$ npm install react-native-animatable --save
To make a continuous animation do this
<Animatable.Text animation="slideInDown" iterationCount={5} direction="alternate">Up and down you go</Animatable.Text> <Animatable.Text animation="pulse" easing="ease-out" iterationCount="infinite" style={{ textAlign: 'center' }}>❤</Animatable.Text>
To animate rows in FlatList Rows do this
import * as Animatable from 'react-native-animatable'; class FlatListRow extends Component { render(){ return( <Animatable.View animation='fadeInUp'>; <TouchableWithoutFeedback>; // here your row component </TouchableWithoutFeedback>; </Animatable.View>; ); } }
Variety of animations are supported in this React Native Animation library