Git Product home page Git Product logo

farshidsanati / react-native-radial-slider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simformsolutionspvtltd/react-native-radial-slider

0.0 0.0 0.0 15.1 MB

React Native component to select or highlight a specific value from a range of values ๐Ÿ‘Œ โœจ

License: MIT License

Shell 0.30% JavaScript 2.38% Ruby 1.40% Objective-C 0.32% Kotlin 7.67% TypeScript 84.22% Swift 2.76% Starlark 0.95%

react-native-radial-slider's Introduction

Radial Slider - Simform

react-native-radial-slider

npm version Android iOS MIT


This is a pure javascript and react-native-svg based library that provides many variants of Radial Slider and Speedo Meter including default, radial-circle-slider, speedometer and speedometer-marker

Radial Slider allows you to select any specific value from a range of values. It comes with two variants, one is default and which allows selection on a 180-degree arc and the second one is 360-degree which allows selection of values on a complete circle. It can be used to select/set goals, vision, range, etc.

The Speedo Meter allows you to highlight a specific value from a range of values. It comes with two variants, the default one shows a needle and another one shows marking values with a needle. It can be used to display the speed of the internet, vehicle, fan, etc.

This library is easy to use and provides you full customization, so you can customize components based on your need.

๐ŸŽฌ Preview


RadialSlider SpeedoMeter
alt RadialSlider alt SpeedoMeter

Quick Access

Installation | RadialSlider | SpeedoMeter | Properties | Example | License

Installation

1. Install library and react-native-svg
$ npm install react-native-radial-slider react-native-svg
# --- or ---
$ yarn add react-native-radial-slider react-native-svg
2. Install cocoapods in the ios project
cd ios && pod install
Know more about react-native-svg

RadialSlider

  • RadialSlider has two different variants, default one and radial-circle-slider
  • RadialSlider can be used to select / set goal, vision, range etc

Default RadialSlider

๐ŸŽฌ Preview


Default RadialSlider

Usage


import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const RadialVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider value={speed} min={0} max={200} onChange={setSpeed} />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default RadialVariant;

Radial Circle Silder

๐ŸŽฌ Preview


Default RadialCircleSlider

Usage


import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const RadialVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'radial-circle-slider'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default RadialVariant;

SpeedoMeter

The speedometer will not take user inputs, when we need to update dynamic values at that time we can use it

  • SpeedoMeter has two different variants, speedometer and speedometer-marker
  • SpeedoMeter can be used to display the speed of an internet, vehicle, fan etc

SpeedoMeter

๐ŸŽฌ Preview


Default SpeedoMeter

Usage


import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const SpeedoMeterVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'speedometer'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default SpeedoMeterVariant;

SpeedoMeter Marker

๐ŸŽฌ Preview


Default SpeedoMeterMarker

Usage


import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { RadialSlider } from 'react-native-radial-slider';

const SpeedoMeterVariant = () => {
  const [speed, setSpeed] = useState(0);

  return (
    <View style={styles.container}>
      <RadialSlider
        variant={'speedometer-marker'}
        value={speed}
        min={0}
        max={200}
        onChange={setSpeed}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
});

export default SpeedoMeterVariant;

Properties

Prop Default Type Description RadialSlider SpeedoMeter
min* 0 number Minimum value โœ… โœ…
max* 100 number Maximum value โœ… โœ…
value* 0 numbe Show selection upto this value โœ… โœ…
onChange* - function Callback function which fired on change in track โœ… โœ…
radius 100 number Size of component โœ… โœ…
step 1 number Step value for component โœ… โŒ
markerValue - number Show marker on specific number โœ… โœ…
title - string Title for component โœ… โŒ
subTitle Goal string Subtitle for component โœ… โŒ
unit RadilaSlider: 'kCal', SpeedoMeter: 'MB/S' string Unit for component โœ… โœ…
thumbRadius 18 number Radius for thumb โœ… โŒ
thumbColor #008ABC string Color for thumb โœ… โŒ
thumbBorderWidth 5 number Width for thumb โœ… โŒ
thumbBorderColor #FFFFFF string Border Color for thumb โœ… โŒ
markerLineSize 50 number Size of marker line โœ… โœ…
sliderWidth 18 number Width of slider โœ… โœ…
sliderTrackColor #E5E5E5 string Color of unselected slider track โœ… โœ…
lineColor #E5E5E5 string Color of unselected lines โœ… โœ…
lineSpace 3 number Space between each line โœ… โœ…
linearGradient [ { offset: '0%', color:'#ffaca6' }, { offset: '100%', color: '#EA4800' }] object Gradient color of selected track โœ… โœ…
onComplete - function Callback function which defines what to do after completion โœ… โœ…
centerContentStyle {} object Center content style โœ… โŒ
titleStyle {} object Status title container style โœ… โŒ
subTitleStyle {} object Status subtitle text style โœ… โŒ
valueStyle {} object Center value style โœ… โœ…
buttonContainerStyle {} object Button container style โœ… โŒ
leftIconStyle {} object Left Icon style โœ… โŒ
rightIconStyle {} object Right Icon style โœ… โŒ
contentStyle {} object Whole content style โœ… โœ…
unitStyle {} object Unit text style โœ… โœ…
style {} object Inner container style โœ… โœ…
openingRadian RadialSlider: Math.PI / 3 , SpeedoMeter:0.057 number Radian of component โœ… โœ…
disabled false boolean If true, buttons will be in disabled state โœ… โŒ
isHideSlider false boolean If true, slider will be hidden โœ… โœ…
isHideCenterContent false boolean If true, center content will be hidden โœ… โœ…
isHideTitle false boolean If true, title will be hidden โœ… โŒ
isHideSubtitle false boolean If true, subtitle will be hidden โœ… โŒ
isHideValue false boolean If true, value will be hidden โœ… โœ…
isHideTailText false boolean If true, tail text will be hidden โœ… โœ…
isHideButtons false boolean If true, buttons will be hidden โœ… โŒ
isHideLines false boolean If true,slider lines will be hidden โœ… โœ…
isHideMarkerLine false boolean If true, marked lines will be hidden โœ… โœ…
fixedMarker false boolean If true, marked value will be hidden โœ… โœ…
variant default string Different component variants radial-circle-slider, speedometer, speedometer-marker โœ… โœ…
onPress {} function Based on click value will be increased or decreased โœ… โŒ
stroke '#008ABC' string Color for button icon โœ… โŒ
unitValueContentStyle {} object Unit value content style โŒ โœ…
markerCircleSize 15 number Size for marker circle โŒ โœ…
markerCircleColor #E5E5E5 string Color for marker circle โŒ โœ…
markerPositionY 20 number Marker position for up and down โŒ โœ…
markerPositionX 20 number Marker position for right and left โŒ โœ…
needleBackgroundColor #A020F0 string Background color for needle โŒ โœ…
needleColor #175BAD string Color for needle โŒ โœ…
needleBorderWidth 1.5 number Width of needle border โŒ โœ…
needleHeight 30 number Height of needle โŒ โœ…
markerValueInterval 10 number Show number of value in sequence โŒ โœ…
markerValueColor #333333 string Color for marker value โŒ โœ…
strokeLinecap butt string Line terminations, can be butt, line, or square โŒ โœ…

Example

A full working example project is here Example

$ yarn
$ yarn example ios   // For ios
$ yarn example android   // For Android

Find this library useful? โค๏ธ

Support it by joining stargazers for this repository.โญ

๐Ÿค How to Contribute

We'd love to have you improve this library or fix a problem ๐Ÿ’ช Check out our Contributing Guide for ideas on contributing.

Bugs / Feature requests / Feedbacks

For bugs, feature requests, and discussion please use GitHub Issues

License

react-native-radial-slider's People

Contributors

mukesh-simform avatar parth-simform avatar simform-solutions avatar

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.