0.1.2 • Published 5 years ago

react-native-range-slider v0.1.2

Weekly downloads
350
License
MIT
Repository
github
Last release
5 years ago

Note: This slider can also be used as a normal slider with only one handle.

Getting Started

  1. Installation

    • Using npm: npm install --save react-native-range-slider
    • Using yarn: yarn add react-native-range-slider
  2. Link

Usage

If you want a working example you can check this example, otherwise you can use the following example as a starting point.

import RangeSlider from 'react-native-range-slider'
<View style={{flex: 1, flexDirection: 'row'}}>
  <RangeSlider
    minValue={0}
    maxValue={100}
    tintColor={'#da0f22'}
    handleBorderWidth={1}
    handleBorderColor="#454d55"
    selectedMinimum={20}
    selectedMaximum={40}
    style={{ flex: 1, height: 70, padding: 10, backgroundColor: '#ddd' }}
    onChange={ (data)=>{ console.log(data);} }
  />
</View>

API

PropertyDescriptionType
disableRangewhen set to true, the slider will mimic a normal slider with only one handle and the slider value will be stored in selectedMaximumBoolean, false by default
minValuethe minimum value for the sliderNumber(float)
maxValuethe maximum value for the sliderNumber(float)
selectedMinimumthe selected minimum value, it shouldn't be less than minValueNumber(float)
selectedMaximumthe selected maximum value, it shouldn't be bigger than maxValueNumber(float)
onChangea callback that will be called with slider data once the values changeCallback
tintColorthe color for the slider bar and the two handlersString(MUST BE A HEX VALUE)
handleColorthe color for both selectedMinimum and selectedMaximum handlersString(MUST BE A HEX VALUE)
handleBorderColorthe color for the slider handle borderString(MUST BE A HEX VALUE)
handleBorderWidththe width for the slider handle borderNumber(float)
handleDiameterthe diameter for the slider handleNumber(float) default 16.0
tintColorBetweenHandlesthe color of the slider bar between the selectedMinimum and selectedMaximum handlersString(MUST BE A HEX VALUE)
minLabelColourthe color of the min label on top of selectedMinimum handlerString(MUST BE A HEX VALUE)
maxLabelColourthe color of the max label on top of selectedMaximum handlerString(MUST BE A HEX VALUE)
lineHeightthe height for slider barNumber(float) default 1.0)
preffixthe string to be prepended to min and max labels valuesString
suffixthe string to be appended to min and max labels valuesString
hideLabelsa boolean to determine handle labels visibility, if set to true range labels will be hiddenBoolean

Todo

  • Add possibility to update handlers related properties.
  • Impliment other necessary methods.
  • Improve the documentation.
  • Make the module cooler.
  • Add android support.

Acknowledgement

  • TTRangeSlider, which this module is based on.

How to contribute ?

You are interested and want to contribute? Awesome, just consider the following steps:

  1. Fork this repository.
  2. Add and test the fixes/improvements you worked on to a seperate branch.
  3. Submit your pull request(PR).