React Native Paper ProgressBar Example


Share:
Published By: Admin, Published On: May 21, 2021, Category: React Native

Hi Guys,

Today, I will learn you how to engender paper progressbar in react native. You can facilely engender paper progressbar in react native. First i will import stylesheet namespace from react-native-paper, after I will make paper progressbar utilizing in react native.

Here, I will give you full example for simply exhibit paper progressbar utilizing react native as bellow.

Step 1 - Create project

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

expo init PaperProgressbar
Step 2 - Install Package

In the step,I will install npm i react-native-paper package.

npm i react-native-paper
Step 3 - App.js

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

import React, { Component } from "react";
import { Text, View,StyleSheet} from 'react-native';
import { Provider ,Appbar,Card,ProgressBar,Colors} from 'react-native-paper';

const MyWebtutsComponent = () => {

  const _goBack = () => console.log('Went back');

  const _handleSearch = () => console.log('Searching');

  const _handleMore = () => console.log('Shown more');

  return (
    <Provider>
    <Appbar.Header style={styles.header}>
      <Appbar.BackAction onPress={_goBack} />
      <Appbar.Content title="My App" subtitle="Subtitle" />
      <Appbar.Action icon="magnify" onPress={_handleSearch} />
      <Appbar.Action icon="dots-vertical" onPress={_handleMore} />
    </Appbar.Header>
      <View style={styles.mainbox}>
           <Text style={styles.title}>Progres Bar</Text>
          <ProgressBar progress={0.5} color={Colors.green900} />
      </View>
    </Provider>
  );
};


const styles = StyleSheet.create({
  title:{
    margin: 10,
    fontSize: 15,
    fontSize: 20
  },
  mainbox:{
    textAlign:'center',
    justifyContent: 'space-between',
    padding: 20,
  }
});
export default MyWebtutsComponent;
Step 4 - Run project

In the last step run your project using bellow command.

npm start
Output

It will help you...

Share: