0.0.8 • Published 3 years ago

@nassim99/react-native-gauge v0.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@Nassim99/React-Native-Gauge

Description

This is a small simple package to render gauge useing SVG, Main reason for creating this is that i needed a simple gauge to be implimented in expo project, the ones i found wasn't working on expo and some of them slows the app down.

Installation

yarn add @nassim99/react-native-gauge

or

npm install @nassim99/react-native-gauge

Usage

Import

import GaugeSVG from "@nassim99/react-native-gauge";

Fundamental Usage

const value = 40 // 40% of the gauge. min=0 max=100
    <GaugeSVG
      size={150}
      insideTextColor={'purple'}
      gaugeColor={'black'}
      gaugeValueColor={'blue'}
      gaugeStroke={3}
      gaugeValueStroke={3.5}
      value={value}
    >
        <View style={{
            justifyContent: 'center',
            alignItems: 'center',
            width: '100%',
            height: '100%',
        }}>
          <Text>{value}</Text>
        </View>
    </GaugeSVG>

Peer Dependencies

this library uses react-native-svg package you should install it in your project

yarn add react-native-svg

Configuration - Props

Required

PropertyTypeDefaultDescription
valuenumberundefinednumber of the value between 0 a 100

Customization (Optionals)

PropertyTypeDefaultDescription
gaugeColorstring#ff0changes the color of the gauge
gaugeValueColorstring"#666"change the color of the gauge value
gaugeStrokenumber2changes the gauge stroke
gaugeValueStrokenumber2.5changes the gauge value stroke
insideTextColorstring#999changes the color of the text in the center of the gauge, not applicable if gauge have children like the example above
sizenumber150changes the width and height of the gauge

Future Plans

  • LICENSE
  • Add animation
  • Add tests

Change Log

Author

Nassim Redwan, https://github.com/nassim99

License

@nassim/react-native-gauge is available under the MIT license. See the LICENSE file for more info.