Show Timeline using React Native Timeline ListView

Show Timeline using React Native Timeline ListView

This is an Example to Show Timeline using React Native Timeline ListView in Android and IOS. Timeline is very useful to show event activity or progress. Timeline list can be used in many places. For this example, we have used Timeline component provided by react-native-timeline-flatlist.

As ListView has been deprecated in React Native 0.60+ we have updated this example for the FlatList. Enjoy 🙂

If we think about the practical use of Timeline then the best example which comes in my mind is the delivery process of any product from online purchase to doorstep delivery. Other than that you can also use Timeline to make a School event calendar or any function calendar with dates and time. Ther can be many more places where we can use Timeline. If you want to share some more places where we can use Timeline then comment below to help other readers.

Now coming back to the example. In this example, we are making a view with buttons in a horizontal scroll view on top and the main view which will hold the different type of Timeline components. On click of the top buttons, we will change the component in the main area. It is kind of an Activity holding different fragments for those who have no idea about the last line don’t worry you can visit How to Make a View Like Android Fragment in React Native to have an idea about that.

The post contains the following things:

  1. Basic TimeLine.
  2. Custom TimeLine.
  3. Dot TimeLine.
  4. Icon TimeLine.
  5. Override Render TimeLine.
  6. Refresh and Load More data in TimeLine.
  7. Right  Side Single TimeLine.
  8. Template TimeLine.
  9. Capture onPress on the TimeLine.
  10. Two Column TimeLine.

So let’s start with the example.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run

npm install -g react-native-cli

Run the following commands to create a new React Native project

react-native init ProjectName

If you want to start a new project with a specific React Native version, you can use the --version argument:

react-native init ProjectName --version X.XX.X
react-native init ProjectName --version react-native@next

This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use Timeline we need to install react-native-timeline-flatlist dependency.

To install this open the terminal and jump into your project using

Run the following command to install

This command will copy all the dependency into your node_module directory. –save is optional, it is just to update the react-native-timeline-flatlist dependency in your package.json file.

As the example has 10 different screens and is very long I am making an App.js which will be the main screen and other screens are like independent components so I’ll post the code and then a screenshot of it. If you are facing any issue with that then you can comment below so that I can update the post accordingly.

Project Structure

For this project, you have to create a project structure as shown below. You can also download the files from here.

App.js

This will be our main landing screen which has some buttons on the top in the horizontal scroll view. On pressing the buttons, we are returning different views to show.

After creating the main screen now you can see the screenshot and the code for different Timeline.

BasicTimeLine.js

CustomTimeLine.js

DotTimeLine.js

IconTimeLine.js

OverrideRenderTimeLine.js

RefreshLoadMoreTimeLine.js

  

SingleRightTimeLine.js

TemplateTimeLine.js

TimeLinePress.js

TwoColumnTmeLine.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).


This is how you can show Timeline using React Native Timeline ListView / Flatlist in Android and IOS. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

8 thoughts on “Show Timeline using React Native Timeline ListView”

    • Hello Ayodele,
      They do not provide that much customization. So if you want to add those things you have to create your own.
      Can you please clarify what you want. maybe I can help you to make your own component.

  1. [13:05:51] E | ReactNativeJS ▶︎ ListView has been removed from React Native. See https://fb.me/nolistview for more information or use deprecated-react-native-listview.

    [13:05:52] E | ReactNativeJS ▶︎ Module AppRegistry is not a registered callable module (calling runApplication)

    show this err sir

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.