1.0.2 • Published 5 years ago

react-native-slider-circular-drag v1.0.2

Weekly downloads
3
License
ISC
Repository
-
Last release
5 years ago

react-native-slider-circular-drag

This is a continuation of the work from the user marcelobarbosaO, who made the initial component;
https://github.com/marcelobarbosaO/react-native-slider-circular-drag

Installation

The project requires react-native-svg to render, so follow these steps to get it up and running:

npm install --save react-native-svg

After it has installed, you must link it:

react-native link react-native-svg

And finally install react-native-slider-circular-drag

npm install --save react-native-slider-circular-drag

Features

  • Gradient integration
  • Scalable design
  • Customizable start location
  • Many configurable options

Usage

import CircleSlider from 'react-native-slider-circular-drag';
...
...
render() {
	return (
		<CircleSlider 
			arcDirection={'CW'}
            backgroundColor={"white"}
            btnRadius={20}
            sliderRadius={130}
            sliderWidth={25}
            startDegree={0}
            maxValue={360}
            onPressInnerCircle={(value) => console.log(`Inner: ${value}`)}
            onPressOuterCircle={(value) => console.log(`Outer: ${value}`)}
            onValueChange={(value) => console.log(`Changed: ${value}`)}
            endGradient={"#A6FFCB"}
            startGradient={"#12D8FA"}
		/>
	)
} 

Props

NameDefaultDescriptionType
arcDirection"CW"Determines direction of the slider, clockwise or counterclockwise.string "CW", "CCW"
backgroundColor"white"Determines the colour of the sliders background.string
btnRadius13Determines the radius of the slider button.number
decimalPlaces0Determines the amount of decimals in the value.number
endGradient"#A6FFCB"Determines the end gradient of the slider.string
maxValue360Determines the max value of the slider.number
onPressInnerCircle(value) =>Callback with value as a parameter when the inner circle is pressed.callback
onPressOuterCircle(value) =>Callback with value as a parameter when the outer circle is pressed.callback
onValueChange(value) =>Callback with value as a parameter when the value changes.callbackcallback
showValuetrueDetermines if the value will be shown as text in the inner circle.boolean
sliderRadius130Determines the radius of the slider.number
sliderWidth25Determines the width of the slider.number
startDegree0Determines the starting position of the slider.number
startGradient"#12D8FA"Determines the starting gradient of the slider.string
textColor"white"Determines the colour of the inner circle text.string
textSize50Determines the size of the inner circle text.number
value0Determines the current value for the slider.number