Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rn-range-slider

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-range-slider

React Native Range Slider for Android and iOS

  • 1.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13K
decreased by-0.99%
Maintainers
1
Weekly downloads
 
Created
Source

RangeSlider

A fully customizable high quality react native Slider component backed by custom native iOS and Android views with ability to select range of values.

Demo app

Installation

  1. Add

    • npm: npm install --save rn-range-slider
    • yarn: yarn add rn-range-slider
  2. Link

Usage

RangeSlider should have fixed width and height.

import RangeSlider from 'rn-range-slider';

...

<RangeSlider
    style={{width: 160, height: 80}}
    gravity={'center'}
    min={200}
    max={1000}
    step={20}
    selectionColor="#3df"
    blankColor="#f618"
    onValueChanged={(low, high, fromUser) => {
        this.setState({rangeLow: low, rangeHigh: high})
    }}/>
/>

...

Properties

Supported color formats are: #RGB, #RGBA, #RRGGBB, #RRGGBBAA

NameDescriptionTypeDefault Value
rangeEnabledSlider works as an ordinary slider with 1 control if falseBooleantrue
lineWidthWidth of slider's lineNumber4
thumbRadiusRadius of thumb (including border)Number10
thumbBorderWidthBorder width of thumbNumber2
textSizeSize of label textNumber16
labelBorderWidthBorder width of labelNumber2
labelPaddingPadding of label (distance between border and text)Number4
labelBorderRadiusBorder radius of label bubbleNumber4
labelTailHeightHeight of label bubble's tailNumber8
labelGapHeightGap between label and sliderNumber4
textFormatThis string will be formatted with active value and shown in thumbString
"Price: %d" =>
"Price: 75"
if the current value is 75
%d
(just the number)
labelStyleStyle of the label.
Label is not shown if none
String

Currently supported values:
- none
- bubble
bubble
gravityVertical gravity of drawn contentString

Currently supported values:
- top
- bottom
- center
top
selectionColorColor of selected partString#4286f4
blankColorColor of unselected partString#ffffff7f
thumbColorColor of thumbString#ffffff
thumbBorderColorColor of thumb's borderString#cccccc
labelBackgroundColorColor label's backgroundString#ff60ad
labelBorderColorColor label's borderString#d13e85
labelTextColorColor label's textString#ffffff
minMinimum value of sliderNumber (integer)0
maxMaximum value of sliderNumber (integer)100
stepStep of sliderNumber (integer)1
initialLowValueInitial value of lower thumbNumber (integer)0
initialHighValueInitial value of higher thumbNumber (integer)100

If **initialLowValue** ( or **initialHighValue**) is not provided, it's set to **min** (or **max**).

Methods

To call methods of RangeSlider you need to have a reference to it's instance.
React native provides 2 ways to do it:

...
<RangeSlider ref="_rangeSlider" />
...
this.refs._rangeSlider.setLowValue(42);
...

or

...
<RangeSlider ref={ component => this._rangeSlider = component } />
...
this._rangeSlider.setLowValue(42);
...
Available methos
NameDescriptionParams
setLowValueSet low value of slidervalue: number
setHighValueSet high value of slidervalue: number

Callbacks

NameDescriptionParams
onValueChangedA callback to be called when value was changed.
fromUser parameter is true if the value was changed because of user's interaction (not by calling setLowValue or setHighValue methods). Just like android's OnSeekbarChangeListener.
lowValue: number

highValue: number

fromUser: boolean

Known issues

  • Label's corner radius is not working on iOS

Keywords

FAQs

Package last updated on 02 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc