-
Notifications
You must be signed in to change notification settings - Fork 0
/
Checkbox.tsx
53 lines (47 loc) · 1.42 KB
/
Checkbox.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React, { FunctionComponent } from 'react'
import { StyleSheet } from 'react-native';
import { Metrics, Colors, Fonts } from '../Theme';
import BouncyCheckbox from "react-native-bouncy-checkbox";
import Icon from 'react-native-vector-icons/MaterialIcons';
interface CheckboxProps {
title: string,
onPress?: (isChecked?: boolean) => void
}
const Checkbox: FunctionComponent<CheckboxProps> = ({
title,
onPress,
}) => {
return (
<BouncyCheckbox
size={Metrics.checkboxHeight}
fillColor={Colors.orange}
unfillColor={Colors.background}
iconComponent={<Icon name={"check"} size={24} color={Colors.white} />}
text={title}
textStyle={{ color: Colors.text, textDecorationLine: "none" }}
textContainerStyle={{ marginLeft: Metrics.baseMargin }}
iconStyle={{ borderWidth: 2, borderRadius: Metrics.buttonRadius, borderColor: Colors.black }}
bounceEffect={1}
bounceFriction={6}
onPress={onPress ? onPress : () => {}}
/>
)
}
const styles = StyleSheet.create({
button: {
width: "80%",
alignSelf: "center",
alignItems: "center",
justifyContent: "center",
paddingVertical: Metrics.baseMargin,
paddingHorizontal: Metrics.doubleBaseMargin,
backgroundColor: Colors.orange,
borderRadius: Metrics.buttonRadius,
},
title: {
...Fonts.style.button,
paddingTop: 4, //center vertically
color: Colors.white
},
})
export default Checkbox