1.2.0 • Published 4 years ago

react-native-arc-progress-bar v1.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

react-native-arc-progress-bar

Customizable progress arc with an animated cursor to modify the progress in it. This project is in continuous development, and new functionalities will be considered if an issue is opened.

Behaviour is consistent in both Android and iOS.

ezgif.com-crop5a80f8b0da1dab2d.gif

Features

  • Easy to use
  • Consistent look and feel on iOS and Android
  • Customizable font size, colors, and overall components dimensions and behaviour
  • Dynamic dropdown size and position
  • Configurable styles and views for numbers and texts

Installation

npm install --save react-native-arc-progress-bar react-native-svg

Usage

import React, { useState } from 'react';
import { View } from 'react-native';
import ArcProgressBar, { resolveNewValue } from 'react-native-arc-progress-bar';

const Example = () => {
    const [state, setState] = useState(250);

    const [scrollableMax, absoluteMax] = [800, 2000];
    const onChange = ([alpha, beta]) => {
        setState(resolveNewValue(alpha, beta, absoluteMax, scrollableMax));
    }

    return (
        <>
        <View style={{flex: 1}}>
            <ArcProgressBar
                rectangularSize={250}
                lowerValue={100}
                stackedValue={state}
                maxValue={scrollableMax}
                absoluteMaxValue={absoluteMax}
                showCursor
                showMinMax
                minStyle={{textAlign: "center"}}
                maxStyle={{textAlign: "center"}}
                caption1Text={"MAX\n"}
                caption2Text={"\nMIN"}
                showMin
                showMax
                onChange={onChange}
            />
        </View>
        <View style={{flex: 1}} />
        </>
    );
};

export default Example;

Properties

namedescriptiontypedefault
rectangularSize*Size of the componentNumber-
strokeWidthWidth of the barNumber-
containerStyleStyles for container viewObject-
progressStyleStyles for arc bar viewObject-
minMaxStyleStyles for minmax viewObject-
captionStyleStyles for component caption viewObject-
cursorStyleStyles for animated cursor viewObject-
maxStyleStyles for inner upper caption viewObject-
minStyleStyles for inner lower caption viewObject-
maxNumberStyleStyles for inner upper numberObject-
minNumberStyleStyles for inner lower numberObject-
showMinMaxShow full inner captionBooleanFalse
showCursorShow animated cursor (if false, no onChange function should be addedBooleanTrue
showMaxShow max captionBooleanFalse
showMinShow min captionBooleanFalse
absoluteMaxValue*Max value of the whole barNumber-
lowerValue*Lower value of the animated barNumber-
stackedValue*Current value of the animated barNumber-
maxValueMax possible value of the animated barNumber-
maxTextText for inner upper captionString-
minTextText for inner lower captionString-
primaryColorColor for animated barHex color#047FF9
shadowColorColor for the shadow of the animated barHex color#BFDEFD
onChangeCallback with new cursor value (args: value)Function-

Copyright

Copyright 2019-2020 Alberto Hernandez. All rights reserved.