1.0.20 • Published 7 months ago

react-native-gradient-multi-slider v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-native-gradient-multi-slider

Pure JS react native slider component with one or two markers. Options to customize track, touch area and provide customer markers and callbacks for touch events and value changes.

Examples

cd example/Basic
npm install
react-native run-ios
react-native run-android

Example

Getting Started

Installation

$ npm install --save react-native-gradient-multi-slider
$ yarn add -D react-native-gradient-multi-slider

Usage in a ScrollView

import MultiSlider from 'react-native-gradient-multi-slider';

<MultiSlider
    sliderLength={250}
    min={0}
    max={12}
    step={1}
/>

shape up CustomMarker as left and right

In order to make different styles on markers you can set isMarkersSeparated to true, define customMarkerLeft and customMarkerRight in MultiSlider. for example:

<MultiSlider
    ...
    isMarkersSeparated={true}

    customMarkerLeft={(e) => {
         return (<CustomSliderMarkerLeft
          currentValue={e.currentValue}/>)
    }}

    customMarkerRight={(e) => {
         return (<CustomSliderMarkerRight
         currentValue={e.currentValue}/>)
    }}
/>

Partial report of the props

Feel free to contribute to this part of the documentation.

Prop NameDefaultTypePurpose
values0ArrayPrefixed values of the slider
gradientColors#...ArrayGradient colors for slider track
onValuesChangeStart() => {}FunctionCallback when value starts changing
onValuesChange() => {}FunctionCallback when value changes
onValuesChangeFinish() => {}FunctionCallback when value stops changing
sliderLength280NumberLength of the slider
touchDimensions{...}ObjectTouch dimensions configuration
enableLabelFunctionEnable label rendering
customLabelFunctionComponent for rendering label above
customMarkerFunctionComponent for cursor
customMarkerLeftFunctionComponent for left cursor
customMarkerRightFunctionComponent for right cursor
isMarkersSeparatedBooleanExplanation in README.md
min0NumberMinimum value available in slider
max10NumberMaximum value available in slider
step1NumberStep value of slider
optionsArrayArrayPossible values of slider
Styles{...}StyleSlider styles
valuePrefixStringPrefix added to value
valueSuffixStringSuffix added to value
enabledOnetrueBooleanEnables first cursor
enabledTwotrueBooleanEnables second cursor
stepsAs[]ArrayCustomize step labels
showStepsfalseBooleanShow steps
showStepMarkerstrueBooleanShow step markers on track
showStepLabelstrueBooleanShow step labels underneath track
onToggleOneFunctionListener when first cursor toggles
onToggleTwoFunctionListener when second cursor toggles
allowOverlapfalseBooleanAllow overlap within cursors
snappedfalseBooleanFixed position for markers
smoothSnappedfalseBooleanSnap to nearest marker on release
verticalfalseBooleanUse vertical orientation
markerOffsetX0NumberOffset cursor(s) on X axis
markerOffsetY0NumberOffset cursor(s) on Y axis
markerSize0NumberMarker margin from track edges
minMarkerOverlap...0NumberClosest distance between markers (pixels)
imageBackground...StringImageBackground source
testIDStringUsed in end-to-end tests
1.0.20

7 months ago

1.0.19

8 months ago

1.0.18

8 months ago

1.0.17

8 months ago

1.0.16

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.12

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago