forked from mrzachnugent/react-native-reusables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch.tsx
35 lines (31 loc) · 762 Bytes
/
switch.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
32
33
34
35
import React from 'react';
import { Switch as RNSwitch } from 'react-native';
import { NAV_THEME } from '~/lib/constants';
const SKY_500 = '#0ea5e9';
const Switch = React.forwardRef<
React.ElementRef<typeof RNSwitch>,
React.ComponentPropsWithoutRef<typeof RNSwitch>
>(
(
{
className,
trackColor = { false: NAV_THEME.dark.border, true: SKY_500 },
thumbColor = NAV_THEME.light.background,
ios_backgroundColor = NAV_THEME.dark.border,
...props
},
ref
) => {
return (
<RNSwitch
trackColor={trackColor}
thumbColor={thumbColor}
ios_backgroundColor={ios_backgroundColor}
ref={ref}
{...props}
/>
);
}
);
Switch.displayName = 'Switch';
export { Switch };