@momo-kits/foundation 0.75.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/Assets/header-background.png +0 -0
  2. package/Assets/icon.json +3947 -0
  3. package/Button/index.tsx +247 -0
  4. package/Button/styles.ts +41 -0
  5. package/CheckBox/index.tsx +61 -0
  6. package/CheckBox/styles.ts +15 -0
  7. package/CheckBox/types.ts +10 -0
  8. package/Consts/colors+spacing+radius.ts +214 -0
  9. package/Consts/index.ts +3 -0
  10. package/Consts/styles.ts +78 -0
  11. package/Consts/theme.ts +121 -0
  12. package/Divider/index.tsx +19 -0
  13. package/Icon/index.tsx +37 -0
  14. package/Icon/types.ts +8 -0
  15. package/IconButton/index.tsx +128 -0
  16. package/IconButton/styles.ts +19 -0
  17. package/Image/index.tsx +80 -0
  18. package/Image/styles.ts +13 -0
  19. package/Image/types.ts +3 -0
  20. package/Input/Input.tsx +142 -0
  21. package/Input/InputMoney.tsx +132 -0
  22. package/Input/InputSearch.tsx +161 -0
  23. package/Input/InputTextArea.tsx +152 -0
  24. package/Input/common.tsx +125 -0
  25. package/Input/index.tsx +41 -0
  26. package/Input/styles.ts +122 -0
  27. package/Input/utils.ts +63 -0
  28. package/Layout/Card.tsx +87 -0
  29. package/Layout/GridSystem.tsx +124 -0
  30. package/Layout/ScreenContainer.tsx +122 -0
  31. package/Layout/Section.tsx +143 -0
  32. package/Layout/index.ts +16 -0
  33. package/Layout/types.ts +21 -0
  34. package/Layout/utils.ts +50 -0
  35. package/Navigation/BottomTab.tsx +39 -0
  36. package/Navigation/Components.tsx +329 -0
  37. package/Navigation/ModalScreen.tsx +207 -0
  38. package/Navigation/Navigation.ts +38 -0
  39. package/Navigation/NavigationButton.tsx +54 -0
  40. package/Navigation/NavigationContainer.tsx +82 -0
  41. package/Navigation/Navigator.ts +66 -0
  42. package/Navigation/Observer.ts +79 -0
  43. package/Navigation/StackScreen.tsx +40 -0
  44. package/Navigation/index.ts +14 -0
  45. package/Navigation/types.ts +149 -0
  46. package/Navigation/utils.tsx +167 -0
  47. package/Pagination/Dot.tsx +16 -0
  48. package/Pagination/PaginationDot.tsx +33 -0
  49. package/Pagination/PaginationNumber.tsx +23 -0
  50. package/Pagination/PaginationScroll.tsx +88 -0
  51. package/Pagination/PaginationWhiteDot.tsx +32 -0
  52. package/Pagination/index.tsx +25 -0
  53. package/Pagination/styles.ts +47 -0
  54. package/Pagination/types.ts +19 -0
  55. package/Popup/PopupNotify.tsx +215 -0
  56. package/Popup/PopupPromotion.tsx +77 -0
  57. package/Popup/index.tsx +4 -0
  58. package/Popup/types.ts +22 -0
  59. package/Radio/index.tsx +65 -0
  60. package/Radio/styles.ts +11 -0
  61. package/Radio/types.ts +10 -0
  62. package/Skeleton/index.tsx +72 -0
  63. package/Skeleton/styles.ts +5 -0
  64. package/Skeleton/types.ts +3 -0
  65. package/Switch/index.tsx +40 -0
  66. package/Switch/styles.ts +23 -0
  67. package/Switch/types.ts +8 -0
  68. package/Tag/index.tsx +79 -0
  69. package/Tag/styles.ts +24 -0
  70. package/Tag/types.ts +10 -0
  71. package/Text/index.tsx +110 -0
  72. package/Text/styles.ts +35 -0
  73. package/Text/types.ts +40 -0
  74. package/index.ts +38 -0
  75. package/package.json +41 -0
  76. package/publish.sh +26 -0
@@ -0,0 +1,32 @@
1
+ import React, {FC, useContext} from 'react';
2
+ import {View} from 'react-native';
3
+ import {ChildPaginationProps} from './types';
4
+ import styles from './styles';
5
+ import Dot from './Dot';
6
+ import {Colors, Spacing} from '../Consts';
7
+ import {ApplicationContext} from '../Navigation';
8
+
9
+ const PaginationWhiteDot: FC<ChildPaginationProps> = ({
10
+ dataLength = 2,
11
+ activeIndex = 0,
12
+ }) => {
13
+ const {theme} = useContext(ApplicationContext);
14
+ const renderDots = () => {
15
+ const dots = [];
16
+ for (let i = 0; i < dataLength; i++) {
17
+ dots.push(
18
+ <Dot
19
+ style={[
20
+ i !== dataLength - 1 ? {marginRight: Spacing.XS} : {},
21
+ {backgroundColor: Colors.black_01},
22
+ ]}
23
+ active={activeIndex === i}
24
+ />,
25
+ );
26
+ }
27
+ return dots;
28
+ };
29
+ return <View style={[styles.paginationWhiteContainer]}>{renderDots()}</View>;
30
+ };
31
+
32
+ export default PaginationWhiteDot;
@@ -0,0 +1,25 @@
1
+ import React, {FC} from 'react';
2
+ import {PaginationProps} from './types';
3
+ import PaginationWhiteDot from './PaginationWhiteDot';
4
+ import PaginationDot from './PaginationDot';
5
+ import PaginationNumber from './PaginationNumber';
6
+ import PaginationScroll from './PaginationScroll';
7
+
8
+ const Pagination: FC<PaginationProps> = props => {
9
+ const {type} = props;
10
+
11
+ const getComponent = (): any => {
12
+ switch (type) {
13
+ case 'black_white':
14
+ return <PaginationWhiteDot {...props} />;
15
+ case 'number':
16
+ return <PaginationNumber {...props} />;
17
+ default:
18
+ return <PaginationDot {...props} />;
19
+ }
20
+ };
21
+
22
+ return getComponent();
23
+ };
24
+
25
+ export {Pagination, PaginationScroll};
@@ -0,0 +1,47 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Colors, Radius, Spacing} from '../Consts';
3
+
4
+ export default StyleSheet.create({
5
+ activeDot: {
6
+ height: 4,
7
+ width: 12,
8
+ borderRadius: Radius.XS,
9
+ },
10
+ inactiveDot: {
11
+ height: 4,
12
+ width: 4,
13
+ borderRadius: Radius.XS,
14
+ },
15
+ paginationPinkContainer: {
16
+ flexDirection: 'row',
17
+ },
18
+ paginationWhiteContainer: {
19
+ flexDirection: 'row',
20
+ padding: Spacing.XS,
21
+ borderRadius: Radius.S,
22
+ backgroundColor: Colors.black_20 + '33',
23
+ },
24
+ paginationNumberContainer: {
25
+ paddingHorizontal: Spacing.S,
26
+ borderRadius: Radius.L,
27
+ backgroundColor: Colors.black_20 + '33',
28
+ },
29
+ scrollContainer: {
30
+ alignItems: 'center',
31
+ width: '100%',
32
+ },
33
+ scrollView: {
34
+ marginBottom: Spacing.L,
35
+ },
36
+
37
+ indicator: {
38
+ width: 24,
39
+ height: 4,
40
+ borderRadius: Radius.XS,
41
+ },
42
+ indicatorContainer: {
43
+ width: 72,
44
+ height: 4,
45
+ borderRadius: Radius.XS,
46
+ },
47
+ });
@@ -0,0 +1,19 @@
1
+ import {ScrollView, ScrollViewProps, ViewStyle} from 'react-native';
2
+ import {Ref} from 'react';
3
+
4
+ export type PaginationProps = {
5
+ type?: 'default' | 'black_white' | 'number' | 'scroll';
6
+ activeIndex: number;
7
+ dataLength: number;
8
+ };
9
+
10
+ export type DotProps = {
11
+ active: boolean;
12
+ style: ViewStyle | ViewStyle[];
13
+ };
14
+
15
+ export interface ScrollIndicatorProps extends ScrollViewProps {
16
+ scrollViewRef?: Ref<ScrollView>;
17
+ }
18
+
19
+ export type ChildPaginationProps = Omit<PaginationProps, 'type'>;
@@ -0,0 +1,215 @@
1
+ import React, {useContext} from 'react';
2
+ import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
+ import {PopupNotifyProps} from './types';
4
+ import {Radius, Spacing, Styles} from '../Consts';
5
+ import {Image} from '../Image';
6
+ import {Text} from '../Text';
7
+ import {ApplicationContext} from '../Navigation';
8
+ import {Button} from '../Button';
9
+ import {Icon} from '../Icon';
10
+
11
+ const PopupNotify: React.FC<PopupNotifyProps> = ({
12
+ image,
13
+ title,
14
+ description,
15
+ information,
16
+ secondary,
17
+ primary,
18
+ buttonDirection = 'row',
19
+ onIconClose,
20
+ }) => {
21
+ const {theme, navigator} = useContext(ApplicationContext);
22
+
23
+ /**
24
+ * on action popup
25
+ * @param callback
26
+ */
27
+ const onAction = (callback?: () => void) => {
28
+ navigator?.pop();
29
+ callback?.();
30
+ };
31
+
32
+ /**
33
+ * build main action of popup
34
+ */
35
+ const buildAction = () => {
36
+ const renderRow = () => {
37
+ return (
38
+ <View style={Styles.row}>
39
+ {!!secondary?.title && (
40
+ <>
41
+ <View style={Styles.flex}>
42
+ <Button
43
+ title={secondary?.title}
44
+ type="text"
45
+ size="medium"
46
+ onPress={() => {
47
+ onAction(secondary?.onPress);
48
+ }}
49
+ />
50
+ </View>
51
+ <View style={styles.buttonSpace} />
52
+ </>
53
+ )}
54
+ <View style={Styles.flex}>
55
+ <Button
56
+ title={primary.title}
57
+ size="medium"
58
+ onPress={() => {
59
+ onAction(primary.onPress);
60
+ }}
61
+ />
62
+ </View>
63
+ </View>
64
+ );
65
+ };
66
+ const renderColumn = () => {
67
+ return (
68
+ <View style={Styles.columnCenter}>
69
+ <Button
70
+ title={primary.title}
71
+ size="medium"
72
+ onPress={() => {
73
+ onAction(primary.onPress);
74
+ }}
75
+ />
76
+ {!!secondary?.title && (
77
+ <>
78
+ <View style={styles.buttonSpace} />
79
+ <Button
80
+ title={secondary?.title}
81
+ type="text"
82
+ size="medium"
83
+ onPress={() => {
84
+ onAction(secondary?.onPress);
85
+ }}
86
+ />
87
+ </>
88
+ )}
89
+ </View>
90
+ );
91
+ };
92
+
93
+ if (buttonDirection == 'auto') {
94
+ if (
95
+ secondary?.title &&
96
+ (secondary.title.length > 12 || primary.title.length > 12)
97
+ ) {
98
+ return renderColumn();
99
+ }
100
+ return renderRow();
101
+ }
102
+ if (buttonDirection == 'row') {
103
+ return renderRow();
104
+ }
105
+ return renderColumn();
106
+ };
107
+
108
+ /**
109
+ * build close action
110
+ */
111
+ const buildCloseIcon = () => {
112
+ return (
113
+ <View style={styles.iconCloseContainer}>
114
+ <TouchableOpacity
115
+ onPress={() => onAction(onIconClose)}
116
+ style={[
117
+ styles.iconClose,
118
+ {
119
+ backgroundColor: theme.colors.text.default,
120
+ borderColor: theme.colors.background.surface,
121
+ },
122
+ ]}>
123
+ <Icon
124
+ source="navigation_close"
125
+ color={theme.colors.background.surface}
126
+ size={14}
127
+ />
128
+ </TouchableOpacity>
129
+ </View>
130
+ );
131
+ };
132
+
133
+ return (
134
+ <View
135
+ accessibilityLabel={'PopupNotify'}
136
+ style={[
137
+ styles.container,
138
+ {backgroundColor: theme.colors.background.surface},
139
+ ]}>
140
+ {!!image && <Image source={{uri: image}} style={styles.image} />}
141
+ <View style={styles.content}>
142
+ <Text typography={'title_xs'} numberOfLines={1}>
143
+ {title}
144
+ </Text>
145
+ <View style={styles.description}>
146
+ <Text typography={'paragraph_default'} numberOfLines={3}>
147
+ {description}
148
+ </Text>
149
+ </View>
150
+ {!!information && (
151
+ <View style={styles.information}>
152
+ <Text
153
+ typography={'description_xs'}
154
+ color={theme.colors.text.hint}
155
+ numberOfLines={1}>
156
+ {information}
157
+ </Text>
158
+ </View>
159
+ )}
160
+ </View>
161
+ <View style={styles.contentAction}>{buildAction()}</View>
162
+ {buildCloseIcon()}
163
+ </View>
164
+ );
165
+ };
166
+
167
+ const styles = StyleSheet.create({
168
+ container: {
169
+ borderRadius: Radius.L,
170
+ minWidth: '100%',
171
+ },
172
+ image: {
173
+ borderTopLeftRadius: Radius.L,
174
+ borderTopRightRadius: Radius.L,
175
+ aspectRatio: 1.7777,
176
+ },
177
+ content: {padding: Spacing.XL},
178
+ description: {
179
+ marginTop: Spacing.S,
180
+ },
181
+ information: {
182
+ marginTop: Spacing.S,
183
+ },
184
+ contentAction: {
185
+ paddingHorizontal: Spacing.XL,
186
+ paddingBottom: Spacing.L,
187
+ },
188
+ buttonSpace: {
189
+ width: Spacing.S,
190
+ height: Spacing.S,
191
+ },
192
+ iconCloseContainer: {
193
+ position: 'absolute',
194
+ top: -Spacing.S,
195
+ right: -Spacing.S,
196
+ },
197
+ iconClose: {
198
+ width: 20,
199
+ height: 20,
200
+ alignItems: 'center',
201
+ justifyContent: 'center',
202
+ borderRadius: Radius.M,
203
+ borderWidth: 2,
204
+ },
205
+ });
206
+
207
+ PopupNotify.defaultProps = {
208
+ title: 'Title',
209
+ primary: {
210
+ title: 'Primary',
211
+ onPress: () => {},
212
+ },
213
+ };
214
+
215
+ export default PopupNotify;
@@ -0,0 +1,77 @@
1
+ import React, {useContext} from 'react';
2
+ import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
+ import {PopupPromotionProps} from './types';
4
+ import {ApplicationContext} from '../Navigation';
5
+ import {Image} from '../Image';
6
+ import {Radius, Spacing} from '../Consts';
7
+ import {Icon} from '../Icon';
8
+
9
+ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
10
+ const {theme, navigator} = useContext(ApplicationContext);
11
+
12
+ /**
13
+ * build close action
14
+ */
15
+ const buildCloseIcon = () => {
16
+ return (
17
+ <View style={styles.iconCloseContainer}>
18
+ <TouchableOpacity
19
+ onPress={() => {
20
+ navigator?.pop();
21
+ onClose?.();
22
+ }}
23
+ style={[
24
+ styles.iconClose,
25
+ {
26
+ backgroundColor: theme.colors.text.default,
27
+ borderColor: theme.colors.background.surface,
28
+ },
29
+ ]}>
30
+ <Icon
31
+ source="navigation_close"
32
+ color={theme.colors.background.surface}
33
+ size={14}
34
+ />
35
+ </TouchableOpacity>
36
+ </View>
37
+ );
38
+ };
39
+
40
+ return (
41
+ <View accessibilityLabel={'PopupPromotion'}>
42
+ <Image
43
+ style={styles.container}
44
+ source={{
45
+ uri: image,
46
+ }}
47
+ />
48
+ {buildCloseIcon()}
49
+ </View>
50
+ );
51
+ };
52
+
53
+ const styles = StyleSheet.create({
54
+ container: {
55
+ aspectRatio: 0.72,
56
+ },
57
+ iconCloseContainer: {
58
+ width: '100%',
59
+ flexDirection: 'row',
60
+ justifyContent: 'center',
61
+ marginTop: Spacing.L,
62
+ },
63
+ iconClose: {
64
+ width: 20,
65
+ height: 20,
66
+ alignItems: 'center',
67
+ justifyContent: 'center',
68
+ borderRadius: Radius.M,
69
+ borderWidth: 2,
70
+ },
71
+ });
72
+
73
+ PopupPromotion.defaultProps = {
74
+ image: 'https://google.com',
75
+ };
76
+
77
+ export default PopupPromotion;
@@ -0,0 +1,4 @@
1
+ import PopupNotify from './PopupNotify';
2
+ import PopupPromotion from './PopupPromotion';
3
+
4
+ export {PopupNotify, PopupPromotion};
package/Popup/types.ts ADDED
@@ -0,0 +1,22 @@
1
+ export type PopupNotifyProps = {
2
+ image?: string;
3
+ title: string;
4
+ description: string;
5
+ information?: string;
6
+ secondary?: PopupAction;
7
+ primary: PopupAction;
8
+ buttonDirection?: PopupActionDirection;
9
+ onIconClose?: () => void;
10
+ };
11
+
12
+ export type PopupPromotionProps = {
13
+ image: string;
14
+ onClose?: () => void;
15
+ };
16
+
17
+ type PopupAction = {
18
+ title: string;
19
+ onPress: () => void;
20
+ };
21
+
22
+ type PopupActionDirection = 'row' | 'column' | 'auto';
@@ -0,0 +1,65 @@
1
+ import React, {FC, useContext} from 'react';
2
+ import {TouchableOpacity, View} from 'react-native';
3
+
4
+ import {RadioProps} from './types';
5
+ import {Text} from '../Text';
6
+ import styles from './styles';
7
+ import {ApplicationContext} from '../Navigation';
8
+ import {Spacing} from '../Consts';
9
+
10
+ const Radio: FC<RadioProps> = ({
11
+ value,
12
+ groupValue,
13
+ disabled,
14
+ onChange,
15
+ label,
16
+ style,
17
+ }) => {
18
+ const {theme} = useContext(ApplicationContext);
19
+ const selected = value === groupValue;
20
+ let disabledStyle = {};
21
+ let checkBoxStyle = {
22
+ borderWidth: 2,
23
+ borderColor: theme.colors.text.default,
24
+ };
25
+
26
+ if (selected) {
27
+ checkBoxStyle = {
28
+ borderWidth: 6,
29
+ borderColor: theme.colors.primary,
30
+ };
31
+ }
32
+ if (disabled) {
33
+ disabledStyle = {
34
+ borderColor: selected
35
+ ? theme.colors.background.tonal
36
+ : theme.colors.text.disable,
37
+ };
38
+ }
39
+
40
+ return (
41
+ <TouchableOpacity
42
+ accessibilityLabel={`Radio/${label}`}
43
+ onPress={onChange}
44
+ disabled={disabled}
45
+ style={[
46
+ style,
47
+ {
48
+ flexDirection: 'row',
49
+ alignItems: 'center',
50
+ },
51
+ ]}>
52
+ <View
53
+ style={[
54
+ styles.radio,
55
+ checkBoxStyle,
56
+ disabledStyle,
57
+ {marginRight: label ? Spacing.XS : 0},
58
+ ]}
59
+ />
60
+ {!!label && <Text typography={'description_default'}>{label}</Text>}
61
+ </TouchableOpacity>
62
+ );
63
+ };
64
+
65
+ export {Radio};
@@ -0,0 +1,11 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Radius} from '../Consts';
3
+
4
+ export default StyleSheet.create({
5
+ radio: {
6
+ height: 20,
7
+ width: 20,
8
+ borderRadius: Radius.M,
9
+ },
10
+ container: {flex: 1},
11
+ });
package/Radio/types.ts ADDED
@@ -0,0 +1,10 @@
1
+ import {ViewStyle} from 'react-native';
2
+
3
+ export type RadioProps = {
4
+ value: string;
5
+ disabled?: boolean;
6
+ label?: string;
7
+ onChange: () => void;
8
+ groupValue: string;
9
+ style?: ViewStyle;
10
+ };
@@ -0,0 +1,72 @@
1
+ import React, {useEffect, useMemo, useRef, useState} from 'react';
2
+ import {Animated, Easing, Platform, StyleSheet, View} from 'react-native';
3
+ import LinearGradient from 'react-native-linear-gradient';
4
+ import {SkeletonTypes} from './types';
5
+ import {Colors, Styles} from '../Consts';
6
+ import styles from './styles';
7
+
8
+ const Skeleton: React.FC<SkeletonTypes> = ({style}) => {
9
+ const [width, setWidth] = useState(0);
10
+ const PRIMARY_COLOR = Colors.black_05;
11
+ const HIGHLIGHT_COLOR1 = Colors.black_05;
12
+ const HIGHLIGHT_COLOR2 = Colors.black_03;
13
+ const beginShimmerPosition = useRef(new Animated.Value(0)).current;
14
+
15
+ const shimmerColors = [HIGHLIGHT_COLOR1, HIGHLIGHT_COLOR2, HIGHLIGHT_COLOR1];
16
+ const linearTranslate = beginShimmerPosition.interpolate({
17
+ inputRange: [0, 1],
18
+ outputRange: [-width, width],
19
+ });
20
+ const animatedValue = useMemo(() => {
21
+ return Animated.loop(
22
+ Animated.timing(beginShimmerPosition, {
23
+ toValue: 1,
24
+ duration: 1000,
25
+ easing: Easing.linear,
26
+ useNativeDriver: Platform.OS !== 'web',
27
+ }),
28
+ );
29
+ }, [beginShimmerPosition]);
30
+
31
+ useEffect(() => {
32
+ animatedValue.start();
33
+ return () => {
34
+ animatedValue.stop();
35
+ };
36
+ }, [animatedValue]);
37
+
38
+ const onLayout = (newWidth: number) => {
39
+ if (newWidth !== width) {
40
+ setWidth(newWidth);
41
+ }
42
+ };
43
+ return (
44
+ <View style={[styles.container, style]} accessibilityLabel={'Skeleton'}>
45
+ <View
46
+ onLayout={e => onLayout(e.nativeEvent.layout.width)}
47
+ style={[Styles.flex, {backgroundColor: PRIMARY_COLOR}]}>
48
+ <Animated.View
49
+ style={{
50
+ transform: [{translateX: linearTranslate}],
51
+ width: '60%',
52
+ height: '100%',
53
+ }}>
54
+ <LinearGradient
55
+ style={[StyleSheet.absoluteFill]}
56
+ colors={shimmerColors}
57
+ start={{
58
+ x: 0,
59
+ y: 0,
60
+ }}
61
+ end={{
62
+ x: 1,
63
+ y: 0,
64
+ }}
65
+ />
66
+ </Animated.View>
67
+ </View>
68
+ </View>
69
+ );
70
+ };
71
+
72
+ export {Skeleton};
@@ -0,0 +1,5 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ container: {overflow: 'hidden', width: '100%', height: '100%'},
5
+ });
@@ -0,0 +1,3 @@
1
+ export type SkeletonTypes = {
2
+ style?: object;
3
+ };
@@ -0,0 +1,40 @@
1
+ import React, {FC, useContext} from 'react';
2
+ import {TouchableOpacity, View} from 'react-native';
3
+ import {SwitchProps} from './types';
4
+ import styles from './styles';
5
+ import {ApplicationContext} from '../Navigation';
6
+ import {Colors} from '../Consts';
7
+
8
+ const Switch: FC<SwitchProps> = props => {
9
+ const {theme} = useContext(ApplicationContext);
10
+ const {value, onChange, disabled, style} = props;
11
+ const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
12
+ const circleAlign = value ? 'flex-end' : 'flex-start';
13
+
14
+ let backgroundColor = value ? theme.colors.primary : Colors.black_07;
15
+ if (disabled) {
16
+ backgroundColor = value ? theme.colors.background.tonal : Colors.black_05;
17
+ }
18
+
19
+ return (
20
+ <TouchableOpacity
21
+ accessibilityLabel={'Switch'}
22
+ disabled={disabled}
23
+ onPress={() => onChange?.(!value)}
24
+ style={[
25
+ style,
26
+ styles.container,
27
+ {backgroundColor, alignItems: circleAlign},
28
+ ]}>
29
+ <View style={[styles.circle, {backgroundColor: circleBackgroundColor}]}>
30
+ <View style={[styles.circleSmall, {backgroundColor}]} />
31
+ </View>
32
+ </TouchableOpacity>
33
+ );
34
+ };
35
+
36
+ Switch.defaultProps = {
37
+ value: false,
38
+ disabled: false,
39
+ };
40
+ export {Switch};
@@ -0,0 +1,23 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ container: {
5
+ width: 38,
6
+ height: 24,
7
+ borderRadius: 20,
8
+ justifyContent: 'center',
9
+ paddingHorizontal: 4,
10
+ },
11
+ circle: {
12
+ width: 14,
13
+ height: 14,
14
+ borderRadius: 8,
15
+ alignItems: 'center',
16
+ justifyContent: 'center',
17
+ },
18
+ circleSmall: {
19
+ width: 6,
20
+ height: 6,
21
+ borderRadius: 4,
22
+ },
23
+ });
@@ -0,0 +1,8 @@
1
+ import {ViewStyle} from 'react-native';
2
+
3
+ export type SwitchProps = {
4
+ value: boolean;
5
+ onChange: (value: boolean) => void;
6
+ disabled?: boolean;
7
+ style?: ViewStyle;
8
+ };