2.0.0 • Published 4 years ago

react-native-circular-multiple-slider v2.0.0

Weekly downloads
8
License
MIT
Repository
github
Last release
4 years ago

license Supports Android and iOS Version

react-native-circular-multiple-slider

React Native component for circular multiple slider and pie chart.

Example app:

It's an example with this package

SliderWithCircleDivider          SliderWithSquareDivider

SliderWithIconDivider          SliderWithTextDividerComponent

SliderWithoutDivider         PieChartWithTextDividerComponent         PieChartWithIconDividerComponent

Features:

  • Slider with Circle Divider
  • Slider with Square Divider
  • Slider with Bar Divider
  • Slider with Icon Divider
  • Slider with Text Divider Component
  • Slider without Divider
  • PieChart with Text Divider Component
  • PieChart with Icon Divider Component

Installation

  1. Install library and react-native-svg

    npm i --save react-native-circular-multiple-slider react-native-svg@9.7.1

  2. Link native code for SVG

    react-native link react-native-svg

    and install cocoapods in the ios project

    pod install

Usage

Import Circular Multiple Slider

import CircularSlider from 'react-native-circular-multiple-slider';

Use as follows:

<CircularMultipleSlider
  componentType={'slider'} //Default type is slider
  values={this.state.value}
  colors={['#9BBFE0', '#E8A09A', '#FBE29F', '#C6D68F']}
  onUpdate={this.onUpdate}
  dividerComponent={[
    this.getDividerComponentImage(REACT_IMAGE),
    this.getDividerComponentImage(ANGULAR_IMAGE),
    this.getDividerComponentImage(SWIFT_IMAGE),
    this.getDividerComponentImage(ANDROID_IMAGE),
  ]}
  dividerComponentSize={DIVIDER_COMPONENT_SIZE}
  slideDividerType={'circle'}
  borderColor={'#0088a0'}
  borderWidth={3}
  strokeWidth={30}
  radius={160}
  separatorColor="#171717"
  minimumStopValue={0.5}
/>

Configuration

You can configure the passing by following props:

Props


Methods


style

Used to style and layout the Multiple Circular Slider. See StyleSheet.js and ViewStylePropTypes.js for more info.

TypeRequired
View.styleNo

values

values is a mandatory prop. This an array of values which used to render the pie chart or multiple circular slider.

TypeRequiredPlatform
arrayYesiOS, Android

colors

colors is a mandatory prop. This an array of colors which used to apply the color for the pie chart or multiple circular slider.

TypeRequiredPlatform
arrayYesiOS, Android

onUpdate

onUpdate is an prop method, used to handle the updated callback for this multiple circular slider component.

TypeRequiredPlatform
funcYesiOS, Android

componentType

componentType is a type, which will decide wheather it is pie-chart or multiple circular slider component.

TypeRequiredValuesDefault ValuePlatform
stringNoSlider, Pie_ChartSlideriOS, Android

dividerComponent

dividerComponent is array of component, which used to render between the divider portions.

TypeRequiredPlatform
arrayNoiOS, Android

dividerComponentSize

dividerComponent is size of component, which is the size of the component rendered between the divider portions.

TypeRequiredDefault ValuePlatform
numberNo50iOS, Android

minimumStopValue

minimumStopValue is value of the divider progress can move until this minimum value.

TypeRequiredDefault ValuePlatform
numberNo1iOS, Android

slideDividerType

slideDividerType is a type, which will decide the type of the slide divider.

TypeRequiredValuesDefault ValuePlatform
stringNoCircle, Square, Bar, IconCircleiOS, Android

slideDividerIcon

slideDividerIcon is the icon used for the slideDivider, if the slideDividerType is icon. | Type | Required | Platform | | ---- | -------- | -------- | | any | No | iOS, Android |


hideSlideDividerType

hideSlideDividerType will decide the visibility of the SlideDivider

TypeRequiredValuesDefault ValuePlatform
boolNofalse, truefalseiOS, Android

onPanResponderGrant

onPanResponderGrant is an prop method, used to handle the slider grant callback, this method will get called whenever the slider starts sliding.

TypeRequiredPlatform
funcYesiOS, Android

onPanResponderRelease

onPanResponderRelease is an prop method, used to handle the slider release callback, this method will get called whenever the slider release from the sliding.

TypeRequiredPlatform
funcYesiOS, Android

borderColor

borderColor is the color for the border. | Type | Required | Platform | | ---- | -------- | -------- | | string | No | iOS, Android |


borderWidth

borderWidth is the width of the border.

TypeRequiredDefault ValuePlatform
numberNo3iOS, Android

strokeWidth

strokeWidth is the width of the stroke for the pie-chart or circular multiple slider.

TypeRequiredDefault ValuePlatform
numberNo30iOS, Android

radius

radius is the radius for the pie-chart or circular multiple slider.

TypeRequiredDefault ValuePlatform
numberNo120iOS, Android

separatorColor

separatorColor is the separator color for the slider arc of the pie-chart or circular multiple slider.

TypeRequiredDefault ValuePlatform
stringNo#171717iOS, Android

Methods

updateValues

updateValues is the method in this package which can be used to update the values at run time by accessing via reference of the pie-chart or circular multiple slider.

Parameter

  • values - This an array of values which used to render the pie chart or multiple circular slider.
TypeParametersPlatform
funcvaluesiOS, Android

Working with example app

With XCode

You'll find working example in the example directory of this repository. You can run it by:

git clone https://github.com/ibrahimsulai/react-native-circular-multiple-slider.git
cd  react-native-circular-multiple-slider/app/example/react_native_circular_multiple_slider_example
npm install
open ios/react_native_circular_multiple_slider_example.xcworkspace

XCode will open. Click Run button and that's it.

Author

Ibrahim Sulaiman (ibrahim.kce@icloud.com)

License

The library is released under the MIT licence. For more information see LICENSE.

1.1.1

4 years ago

1.1.0

4 years ago

1.1.2

4 years ago

2.0.0

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago