Giter Site home page Giter Site logo

trthtai / react-native-simple-gauge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nerdyfactory/react-native-simple-gauge

0.0 1.0 0.0 1.34 MB

Gauge progress module for React Native (iOS and Android)

License: MIT License

JavaScript 46.74% Java 9.15% Objective-C 21.97% Ruby 11.98% Starlark 10.16%

react-native-simple-gauge's Introduction

react-native-simple-gauge

Gauge progress module for React Native

Based on react-native-circular-progress

image

Requirement

RN 0.60+

  • RN <= 0.59 supported by 0.1.11
  • RN <= 0.44 supported by 0.1.2

Install

  1. npm i --save react-native-simple-gauge
  2. Link the ART library to your ReactNative project for ios add below line to ios/Podfile
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART'

and run pod install in ios directory

Usage

import { AnimatedGaugeProgress, GaugeProgress } from 'react-native-simple-gauge';
<AnimatedGaugeProgress
  size={200}
  width={15}
  fill={100}
  rotation={90}
  cropDegree={90}
  tintColor="#4682b4"
  delay={0}
  backgroundColor="#b0c4de"
  stroke={[2, 2]} //For a equaly dashed line
  strokeCap="circle" />

Use cropDegree to vary the size of arc

Refer to below example to add something inside gauge.

const size = 200;
const width = 15;
const cropDegree = 90;
const textOffset = width;
const textWidth = size - (textOffset*2);
const textHeight = size*(1 - cropDegree/360) - (textOffset*2);
      <GaugeProgress
        size={size}
        width={width}
        fill={this.state.fill}
        cropDegree={cropDegree}
        ......
      >
        <View style={styles.textView}>
          <Text style={styles.text}>hello</Text>
        </View>
      </GaugeProgress>
  textView: {
    position: 'absolute',
    top: textOffset,
    left: textOffset,
    width: textWidth,
    height: textHeight,
    alignItems: 'center',
    justifyContent: 'center',
  },
  text: {
    fontSize: 20,
  },

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.