React Native Loading Indicator Example

React Native

Nicesnippets

98

03-07-2020


Hi Guys,

In this blog, I will explain you how to create loading indicator in react native. You can easily create loading indicator in react native. First i will import namespace ActivityIndicator

, after I will make loading indicator using ActivityIndicator tag in react native.

Here, I will give you full example for simply display loading indicator using react native as bellow.

Step 1 - Create project

In the first step Run the following command for create project.

expo init LoadingIndicator

Step 2 - App.js

In this step, You will open App.js file and put the code.

import React from "react";

import { ActivityIndicator, StyleSheet, Text, View } from "react-native";

export default function App() {

return (

<View style={[styles.container, styles.horizontal]}>

<ActivityIndicator size="large" color="#000000" />

</View>

);

}

const styles = StyleSheet.create({

container: {

flex: 1,

justifyContent: "center"

},

horizontal: {

flexDirection: "row",

justifyContent: "space-around",

padding: 10

}

});

Step 3 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...


Recommended Posts