0.0.32 • Published 11 months ago

react-native-radial-slider2 v0.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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


RadialSliderSpeedoMeter
alt RadialSlideralt 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

PropDefaultTypeDescriptionRadialSliderSpeedoMeter
min*0numberMinimum value
max*100numberMaximum value
value*0numbeShow selection upto this value
onChange*-functionCallback function which fired on change in track
radius100numberSize of component
step1numberStep value for component
markerValue-numberShow marker on specific number
title-stringTitle for component
subTitleGoalstringSubtitle for component
unitRadilaSlider: 'kCal', SpeedoMeter: 'MB/S'stringUnit for component
thumbRadius18numberRadius for thumb
thumbColor#008ABCstringColor for thumb
thumbBorderWidth5numberWidth for thumb
thumbBorderColor#FFFFFFstringBorder Color for thumb
markerLineSize50numberSize of marker line
sliderWidth18numberWidth of slider
sliderTrackColor#E5E5E5stringColor of unselected slider track
lineColor#E5E5E5stringColor of unselected lines
lineSpace3numberSpace between each line
linearGradient { offset: '0%', color:'#ffaca6' }, { offset: '100%', color: '#EA4800' }objectGradient color of selected track
onComplete-functionCallback function which defines what to do after completion
centerContentStyle{}objectCenter content style
titleStyle{}objectStatus title container style
subTitleStyle{}objectStatus subtitle text style
valueStyle{}objectCenter value style
buttonContainerStyle{}objectButton container style
leftIconStyle{}objectLeft Icon style
rightIconStyle{}objectRight Icon style
contentStyle{}objectWhole content style
unitStyle{}objectUnit text style
style{}objectInner container style
openingRadianRadialSlider: Math.PI / 3 , SpeedoMeter:0.057numberRadian of component
disabledfalsebooleanIf true, buttons will be in disabled state
isHideSliderfalsebooleanIf true, slider will be hidden
isHideCenterContentfalsebooleanIf true, center content will be hidden
isHideTitlefalsebooleanIf true, title will be hidden
isHideSubtitlefalsebooleanIf true, subtitle will be hidden
isHideValuefalsebooleanIf true, value will be hidden
isHideTailTextfalsebooleanIf true, tail text will be hidden
isHideButtonsfalsebooleanIf true, buttons will be hidden
isHideLinesfalsebooleanIf true,slider lines will be hidden
isHideMarkerLinefalsebooleanIf true, marked lines will be hidden
fixedMarkerfalsebooleanIf true, marked value will be hidden
variantdefaultstringDifferent component variants radial-circle-slider, speedometer, speedometer-marker
onPress{}functionBased on click value will be increased or decreased
stroke'#008ABC'stringColor for button icon
unitValueContentStyle{}objectUnit value content style
markerCircleSize15numberSize for marker circle
markerCircleColor#E5E5E5stringColor for marker circle
markerPositionY20numberMarker position for up and down
markerPositionX20numberMarker position for right and left
needleBackgroundColor#A020F0stringBackground color for needle
needleColor#175BADstringColor for needle
needleBorderWidth1.5numberWidth of needle border
needleHeight30numberHeight of needle
markerValueInterval10numberShow number of value in sequence
markerValueColor#333333stringColor for marker value
strokeLinecapbuttstringLine 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

0.0.32

11 months ago

0.0.31

12 months ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago