1.1.2 • Published 3 years ago

@syed.developer/react-native-circle-slider v1.1.2

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

Language Platforms Donate

React Native Circle Slider

React native circle slider using react-native-svg and PanResponder.

Install

This component is built with React Native 0.39+ and works for Android and iOS.

Install with npm:

npm i --save react-native-circle-slider

Install with yarn:

$ yarn add react-native-circle-slider

Usage

Basic Usage(github file)

import React, { Component } from "react";
import { View } from "react-native";
import CircleSlider from "react-native-circle-slider";

export default class CircleSliderContainer extends Component {
	render() {
		return (
			<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
				<CircleSlider value={90} />
			</View>
		);
	}
}

Properties

Property nameTypeDefaultDescription
btnRadiusnumber15The radius of the small button
dialRadiusnumber130The radius of the circle slider
dialWidthnumber5The width of the slider line
meterColorstring'#0cd'The color of slider line
fillColorstring'none'The color of circle fill
onValueChangefunctionx => xValue to print on button (x=degrees)
textColorstring'#fff'The color of the button text
textSizenumber10The size of the button text
strokeColorstring'#fffThe color of stroke above the line
strokeWidthnumber0.5The size of stroke above the line
valuenumber0The value of the slider (degrees)
minnumber0The min limit of the slider (degrees)
maxnumber359The max limit of the slider (degrees)
xCenternumberScreen centerThe x coordinates of rotation center
yCenternumberScreen centerThe y coordinates of rotation center

Notes

There seems to be an error in the React Native code where locationX and locationY do not update themselves and stay as the coordinates of the first touch. A small work-around was used for now by setting the coordinates for the rotation center.

License

GNU General Public License v3.0