forked from mrzachnugent/react-native-reusables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslider.tsx
31 lines (29 loc) · 939 Bytes
/
slider.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import RNCSlider from '@react-native-community/slider';
import { useColorScheme } from 'nativewind';
import React from 'react';
import { NAV_THEME } from '~/lib/constants';
/**
* @docs https://github.com/callstack/react-native-slider?tab=readme-ov-file#-react-native-communityslider-
*/
function Slider(props: React.ComponentProps<typeof RNCSlider>) {
const { colorScheme } = useColorScheme();
const {
minimumValue = 0,
maximumValue = 1,
minimumTrackTintColor = NAV_THEME[colorScheme].text,
maximumTrackTintColor = NAV_THEME[colorScheme].border,
thumbTintColor = NAV_THEME[colorScheme].text,
} = props;
return (
<RNCSlider
role='slider'
minimumValue={minimumValue}
maximumValue={maximumValue}
minimumTrackTintColor={minimumTrackTintColor}
maximumTrackTintColor={maximumTrackTintColor}
thumbTintColor={thumbTintColor}
{...props}
/>
);
}
export { Slider };