0.7.0 • Published 5 years ago
@dooboo-ui/native-slider v0.7.0
Slider
Props
| necessary | types | default | |
|---|---|---|---|
| hideMark | boolean | false | |
| hideLabel | boolean | true | |
| autoLabel | boolean | false | |
| step | number | 1 | |
| defaultValue | number | 0 | |
| minValue | number | 0 | |
| maxValue | number | 100 | |
| thumb | React.ReactElement | ||
| thumbSize | number | ||
| mark | React.ReactElement | ||
| customMarkWidth | number | ||
| startMark | boolean | true | |
| endMark | boolean | true | |
| markStyle | StyleProp | ||
| railStyle | StyleProp | ||
| trackStyle | StyleProp | ||
| thumbStyle | StyleProp | ||
| labelSize | number | ||
| labelStyle | StyleProp | ||
| labelTextStyle | StyleProp | ||
| onChange | (value: number) => void |
Installation
yarn add @dooboo-ui/nativeor
yarn add @dooboo-ui/native-sliderUsage
import React, { ReactElement } from 'react';
import { Slider } from '@dooboo-ui/native';
// or
import Slider from '@dooboo-ui/native-slider';
import styled from 'styled-components/native';
function Page(): ReactElement {
const handleChange = (value) => {
// Do something!
};
return (
<Container>
<Slider
step={10}
defaultValue={20}
minValue={0}
maxValue={100}
/>
<Slider
minValue={0}
maxValue={5}
step={1}
hideLabel={false}
autoLabel
onChange={handleChange}
/>
<Slider
minValue={0}
maxValue={10}
defaultValue={6}
step={1}
railStyle={{ backgroundColor: '#90A4F9' }}
trackStyle={{ backgroundColor: '#0B21E8' }}
thumbSize={8}
thumbStyle={{ backgroundColor: '#0B21E8' }}
markStyle={{ backgroundColor: '#4163F4' }}
labelSize={15}
labelStyle={{ backgroundColor: '#0B21E8' }}
labelTextStyle={{ color: '#FFFFFF', fontSize: 12 }}
onChange={handleChange}
/>
</Container>
);
}
export default Page;