1.0.4 • Published 2 years ago

react-native-full-slider v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

react-native-full-slider

Supports Android and iOS    MIT License

Customizable range slider for react native apps

Getting started

npm i react-native-full-slider

Usage

Examples - display

Examples - code (reflects the short video above)

import RangeSlider, { Slider } from 'react-native-full-slider';
     const [fromValue, setFromValue] = useState(0);
     const [toValue, setToValue] = useState(0);
     const [value, setValue] = useState(0);
     return (
          <View style={styles.container}>
               <View>
                    <RangeSlider min={5} max={25}
                         fromValueOnChange={value => setFromValue(value)}
                         toValueOnChange={value => setToValue(value)}
                         initialFromValue={11}
                    />
                    <Text>from value:  {fromValue}</Text>
                    <Text>to value:  {toValue}</Text>
               </View>
               <View>
                    <Slider min={0} max={40} step={4}
                         valueOnChange={value => setValue(value)}
                         initialValue={12}
                         knobColor='red'
                         valueLabelsBackgroundColor='black'
                         inRangeBarColor='purple'
                         outOfRangeBarColor='orange'
                    />
                    <Text>value:  {value}</Text>
               </View>
          </View>
     );

API - RangeSlider (default import)

PropertyTypeRequiredDefault
minnumberyes-
maxnumberyes-
fromValueOnChangecallbackyes-
toValueOnChangecallbackyes-
stepnumberno1
styleSizestring ( 'small' | 'medium' | 'large' | number )no'medium'
fromKnobColorstring (color)no'#00a2ff'
toKnobColorstring (color)no'#00a2ff'
inRangeBarColorstring (color)no'rgb(100,100,100)'
outOfRangeBarColorstring (color)no'rgb(200,200,200)'
valueLabelsBackgroundColorstring (color)no'#3a4766'
rangeLabelsTextColorstring (color)no'rgb(60,60,60)'
showRangeLabelsbooleannotrue
showValueLabelsbooleannotrue
initialFromValuenumbernoas 'min' value
initialToValuenumbernoas 'max' value
knobSizenumberno24/34/44
containerStylestyleno-
barHeightnumberno8/11/15
labelFormatter(value: number) => stringno-

API - Slider (1 knob)

PropertyTypeRequiredDefault
minnumberyes-
maxnumberyes-
valueOnChangecallbackyes-
stepnumberno1
styleSizestring ( 'small' | 'medium' | 'large' | number )no'medium'
knobColorstring (color)no'#00a2ff'
inRangeBarColorstring (color)no'rgb(200,200,200)'
outOfRangeBarColorstring (color)no'rgb(100,100,100)'
valueLabelsTextColorstring (color)no'white'
valueLabelsBackgroundColorstring (color)no'#3a4766'
rangeLabelsTextColorstring (color)no'rgb(60,60,60)'
showRangeLabelsbooleannotrue
showValueLabelsbooleannotrue
initialValuenumbernoas 'min' value
containerStylestyleno-
barHeightnumberno8/11/15
labelFormatter(value: number) => stringno-

API - Textual Slider

PropertyTypeRequiredDefault
valuesItemTypeyes-
valueOnChangecallbackyes-
styleSizestring ( 'small' | 'medium' | 'large' | number )no'medium'
knobColorstring (color)no'#00a2ff'
inRangeBarColorstring (color)no'rgb(200,200,200)'
outOfRangeBarColorstring (color)no'rgb(100,100,100)'
valueLabelsTextColorstring (color)no'white'
valueLabelsBackgroundColorstring (color)no'#3a4766'
rangeLabelsTextColorstring (color)no'rgb(60,60,60)'
showRangeLabelsbooleannotrue
showValueLabelsbooleannotrue
initialValuenumberno-