|
1 | 1 | import React, { FC, useEffect, useMemo, useState } from 'react' |
2 | | -import { StyleSheet, Animated, Easing, Pressable } from 'react-native' |
| 2 | +import { StyleSheet, Animated, Easing, Pressable, StyleProp, ViewStyle } from 'react-native' |
3 | 3 | import { Check } from './icons/Check' |
4 | 4 | import { GRAY, PRIMARY, WHITE, DARK } from '../../constants' |
5 | 5 |
|
6 | 6 | export interface CheckBoxProps { |
7 | 7 | value: boolean |
8 | 8 | isPrimary: boolean |
9 | 9 | onToggle: (value: boolean) => void |
| 10 | + CheckBoxStyle?: StyleProp<ViewStyle> |
10 | 11 | } |
11 | 12 |
|
12 | 13 | const animationToggle = (value: boolean) => new Animated.Value(value ? 1 : 0) |
13 | 14 |
|
14 | 15 | export const CheckBox: FC<CheckBoxProps> = (props: CheckBoxProps) => { |
15 | | - const { value, onToggle, isPrimary } = props |
| 16 | + const { value, onToggle, isPrimary, CheckBoxStyle } = props |
16 | 17 | const [timer] = useState<Animated.Value>(animationToggle(value)) |
17 | 18 | const [previousValue, setPreviousValue] = useState<boolean>(value) |
18 | 19 | const onToggleHandler = React.useMemo(() => () => onToggle && onToggle(!value), [onToggle, value]) |
@@ -57,7 +58,8 @@ export const CheckBox: FC<CheckBoxProps> = (props: CheckBoxProps) => { |
57 | 58 | backgroundColor: animatedBgStyle, |
58 | 59 | borderColor: animatedBorderColorStyle, |
59 | 60 | borderWidth |
60 | | - } |
| 61 | + }, |
| 62 | + CheckBoxStyle |
61 | 63 | ]} |
62 | 64 | > |
63 | 65 | <Check color={iconColor} /> |
|
0 commit comments