1.0.14 • Published 1 year ago

rnr-slider v1.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

rnr-slider

React Native component powered with Reanimated2 used to select a single value from a range of values

Installation and usage

To install this module do these terminal commands inside your project folder

Using Yarn:

yarn add rnr-slider

Using NPM:

npm install rnr-slider --save

Basic usage

As this component uses Reanimated2 library inside, it is important to use Reanimated2-hooks (e.g. useWorkletCallback) for the slider callbacks. Creates horizontal and vertical sliders.

import {Slider} from 'rnr-slider';

const Example = () => {
  const _onSlideStart = useWorkletCallback(e => {
    console.log('@start:', e);
  }, []);
  
  const _onSlideChange = useWorkletCallback(({value}) => {
    console.log('@change:', value);
  }, []);

  const _onSlideEnd = useWorkletCallback(e => {
    console.log('@end':, e);
  }, []);

  return (
    <Slider
      onSlideChange={_onSlideChange}
      onSlideStart={_onSlideStart}
      onSlideEnd={_onSlideEnd}
    />
  ) 
}

Main props

PropertyDescriptionTypeRequired
onSlideChangeMain handler for slider value change.functionYes
minMinimum of values range.Default value is 0.numberNo
maxMaximum of values range.Default is 100.numberNo
defaultPercentDefault percent of where knob will initially render.Default is 0.numberNo
onSlideStartAdditional handler which calls on slide start.functionNo
onSlideEndAdditional handler which calls on slide end.functionNo
onDoubleTapAdditional handler which calls on knob double tap.Useful when we want to reset slider to its initial value.functionNo
forwardedRefReference object.React.RefObjectNo
withDecimalsValue in hint will be represented with floating point.booleanNo
isVerticalMake vertical slider.booleanNo
containerStyleSlider container style.ViewStyleNo

Hint props

PropertyDescriptionTypeRequired
withHintShows balloon with current slider value near knob.booleanNo
HintComponentCustom hint component.React.ReactElementNo

Knob props

PropertyDescriptionTypeRequired
knobSizeSize of native knob.numberNo
knobStyleStyle of native knob.ViewStyleNo
knobVelocityLimitationVelocity limitation of knob.Useful when we need to check specific slider value (e.g. for haptics).numberNo
KnobComponentCustom knob component.React.ReactElementNo

Progress bar props

PropertyDescriptionTypeRequired
ProgressBarComponentCustom progress bar container component.React.ReactElementNo
withAnimatedProgressBarShows ProgressBarFillComponent.booleanNo
ProgressBarFillComponentCustom progress bar fill component.Works with withAnimatedProgressBar only!React.ReactElementNo
progressBarFillStylesStyle for custom progress bar fill.ViewStyleNo
1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

0.0.1

2 years ago