How to Generate Random Color in React Native?

Hello dev’s today Now in this post i will show you How to Generate Random Color in React Native? Here in this article i simple demonstrates of how to generate the random color in react native. Now in this tutorial i will give you a simple example of react native generate random color example. So this article i will give you a very simple example of how to implement random color in react native. So here i’m going to show you about the random color generator in react native. You just need to do some step to done this how to create random color in react native.

Step 1: Download Project

Now in the first step run the following command for create a project.

expo init ExampleApp
Step 2: CATEGORIES.js

Then First of all we need to create the Data folder inside our project. Now in this folder create CATEGORIES.js file.

So in this step, i will create the name of the object as CATEGORIEES. Export that object. we will also import this file to use this object.

after then, we will open the CATEGORIES.js file and then put the code.

Data/CATEGORIES.js

export const CATEGORIES = [
    {
        id:'1',
        category_name:'Mobile',
    },
    {
        id:'2',
        category_name:'HeadPhone',
    },
    {
        id:'3',
        category_name:'Computer',
    },
    {
        id:'4',
        category_name:'Laptop',
    },
    {
        id:'5',
        category_name:'AC',
    },
    {
        id:'6',
        category_name:'TV',
    },
    {
        id:'7',
        category_name:'Laptop',
    },
    {
        id:'8',
        category_name:'Refrigerator',
    },
    {
        id:'9',
        category_name:'Camera',
    },
    {
        id:'10',
        category_name:'Home Theater',
    },
];
Step 3: App.js

Now In this step, we will open the App.js file and then put the code.

In the last step run our project by using the below command.

expo start

Read Also: How to use Dropdown in React Native?

Thanks for read. I hope it help you. For more you can follow us on facebook

close

About Shahriar Sagor

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Shahriar Sagor →