Custom Material Style Star Rating Bar component in React Native iOS Android

Rating Bar component is used to give rating or review to a user specific product in star formats. We have seen Star Rating Bar on many applications and even the Google Play Stores uses the Rating bar technique to accept opinions from users in star from. There are 5 Stars presents in Rating bar and user can select between 1 to 5 starts rating to your app or product. React Native currently dose not support Rating Bar component like we have seen in Android app development, but we can create our own Custom Material Style Star Rating Bar component in React Native android iOS App example tutorial. So let’s get started 🙂 .

Note: I am using two types of images in this tutorial first one is Filled Star image and Second one is Star with Border image, You can see the image below. These images is created by myself in Photoshop and you can download them and use it anywhere for professional and personal use without my permission, Enjoy 🙂 .

Contents in this project Custom Material Style Star Rating Bar component in React Native iOS Android App:

1. Import StyleSheet, View, Platform, Text, Image and TouchableOpacity component in your project.

2. Create constructor() in your project’s class. We would make 2 States named as Default_Rating and Max_Rating. Default_Rating is the default automatically select value of stars and Max_Rating is 5 which is the maximum starts shows inside rating bar widget. We would also make 2 this variables to hold both star filled and star with border image.

3. Create a function named as UpdateRating(). This function is used to set Default_Rating State value as send key from selected image.

4. Create a array named as React_Native_Rating_Bar in render’s block locally. This array is used to print Stars on screen. Now we would use the for loop technique to print Stars on screen. We would dynamically insert starts in array. We are adding TouchableOpacity component in with Image component inside the array. So when user select high number of starts then it filled them automatically by placing the filled star image and when user select lower number star then it will remove the filled starts and shows the border start image instead.

5. Create a Root View in render’s return block. We would make a Child View in root view and call the React_Native_Rating_Bar local array in child view. This would print all the starts dynamically at run time on screen. We would also showing the number of selected stats using State below.

6. Create Style.

7. Complete source code for App.js File :

Screenshots in Android device:

Custom Material Style Star Rating Bar component Screenshots in iOS device:


  1. Its shows Default rating only even after i provided 5 stars , how can i make it dynamic ?

  2. how can we use the local image instead of the given links of the star?
    i tried but didn’t work

Leave a Reply

Your email address will not be published. Required fields are marked *