1.0.5 • Published 6 years ago

@kimche/react-native-progress-bar v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-native-progress-bar

npm version npm version

Easy and customizable progress bar for react native projects.

Setup

yarn add @kimche/react-native-progress-bar

Usage

import React from "react";
import { StyleSheet, View, Button } from "react-native";
import ProgressBar from "@kimche/react-native-progress-bar";

export default class App extends React.Component {
  state = {
    progress: 50
  };
  onPressButton = () => {
    const { progress } = this.state;
    this.setState({ progress: progress + 10 });
  };

  render() {
    const { progress } = this.state;
    return (
      <View style={styles.container}>
        <ProgressBar
          hasAutoProgress={true}
          max={100}
          progress={progress}
          width={200}
          height={20}
          fontSize={15}
          title="example 1: "
          onCompleteColor="green"
        />

        <ProgressBar
          max={120}
          progress={progress}
          width={150}
          height={20}
          fontSize={12}
          progressColor="red"
          title="example 2: "
          style={{ marginTop: "10%" }}
        />

        <Button
          onPress={this.onPressButton}
          title="More!"
          color="#841584"
          accessibilityLabel="Learn more about this purple button"
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center"
  }
});

Available props

NameTypeDefaultDescription
progressnumberREQUIREDProgress value
maxnumberREQUIREDMax progress
progressColorstring'#0097ff'Color of the bar progress
backgroundColorstring'#e0e0e0'Color of the bar background
onCompleteColorstring''Color of the bar when the max is reached
initialDelaynumber500Duration in ms of bar initial animation
widthnumberREQUIREDWidth of bar
heightnumber7Height of bar
titlestring""Progress bar text
fontSizenumber7Progress bar title font size
hasAutoProgressboolfalseBool that enables the auto percentage of the progress
styleobj{}aditional styling of the bar