Skip to main content

Slider

Slider

We all need a slider in our application. This is a JavaScript component built with the PanResponder and Animated APIs.

Slider

Usage

Imports:

import { Slider, Block } from 'galio-framework';

Simple example:

<Block flex>
<Slider
maximumValue={30}
value={10}
onSlidingComplete={() => this.registerTheValue()}
/>
</Block>

Modern usage with hooks:

const [sliderValue, setSliderValue] = useState(10);

<Slider
value={sliderValue}
onValueChange={setSliderValue}
minimumValue={0}
maximumValue={100}
step={1}
activeColor="primary"
trackColor="grey"
/>

Props

PropTypeDefaultDescription
valuenumber0The current value of the slider
onValueChangefunctionnullCallback when slider value changes
onSlidingCompletefunctionnullCallback when sliding is complete
activeColorstringGalioTheme.COLORS.PRIMARYActive track color
trackColorstringGalioTheme.COLORS.GREYInactive track color
thumbColorstringGalioTheme.COLORS.PRIMARYThumb color
disabledboolfalseDisables the slider
minimumValuenumber0Minimum slider value
maximumValuenumber100Maximum slider value
stepnumber1Step increment value
trackStyleobject{}Custom track styles
thumbStyleobject{}Custom thumb styles
styleobject{}Custom container styles