React Native Timeline ListView FlatList Android iOS Component Example Tutorial

Timeline component is one of the most popular custom components used in many e-commerce mobile applications and web applications. Timeline component is used to show a particular activity with each step on mobile screen. We have seen in many eCommerce apps to show each activity to their users like where product is packed, product is ready to be shipped, product is shipped, product is near your delivery location etc. In react native there is no inbuilt Timeline component is available but using the Custom component known as react-native-timeline-flatlist we can easily setup Timeline component in our react native app. So in this tutorial we would create React Native Timeline ListView FlatList Android iOS Component Example Tutorial. Show Timeline component in react native app.

Contents in this project React Native Timeline ListView FlatList Android iOS Component Example Tutorial:

1. Before getting started with code we have to install the react-native-timeline-flatlist package in our react native project. So Open your react native project root folder in Command Prompt or Terminal and execute below command to install the NPM package.

Screenshot of CMD:


Screenshot of CMD after done installation:

2. Open your projects main App.js file and import StyleSheet, View and Text component.

3. Import Timeline package form react-native-timeline-flatlist.

4. Creating our main export default class App extends Component. This is our main class.

5. Creating constructor(), Now we would make a this type class type variable named as data. Using this variable we would assign multiple type of data like time stamp, title and description. We would use this data to make the Timeline component with different values.

6. Creating render’s return block in your app, Now we would make a Root parent view.

7. Creating Timeline component in Root View component.

  • data : Is used to hold the data shown in Timeline component.
  • separator : Used to show a horizontal separator line between each data.
  • circleSize : Used to set the Timeline circle size.
  • circleColor : Used to set the timeline circle color.
  • lineColor : Used to set the Timeline color.
  • timeStyle : Used to set the Time stamp styling.
  • style : To apply style on Timeline component.
  • descriptionStyle : Used to set the timeline description text styling.

8. Creating Style.

9. Complete Source Code for App.js file:

Screenshots:

React Native Timeline ListView FlatList Android iOS Component Example Tutorial