@holper/react-native-holper-storybook 0.6.101 → 0.7.0
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.
- package/.expo/README.md +8 -0
- package/.nvmrc +1 -0
- package/.prettierignore +5 -0
- package/.storybook/index.jsx +11 -0
- package/.storybook/main.js +8 -0
- package/.storybook/preview.jsx +51 -0
- package/.storybook/storybook.requires.js +43 -0
- package/.yarn/releases/yarn-4.5.0.cjs +925 -0
- package/.yarnrc.yml +3 -0
- package/App.jsx +29 -0
- package/LICENSE +21 -0
- package/{readme.md → README.md} +18 -19
- package/app.config.js +77 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/fonts/Poppins-Bold.ttf +0 -0
- package/assets/fonts/Poppins-Regular.ttf +0 -0
- package/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash.png +0 -0
- package/babel.config.js +7 -0
- package/build.sh +11 -0
- package/components/Button/index.tsx +66 -0
- package/{lib/components/Button/style.js → components/Button/style.ts} +8 -7
- package/components/Card/index.tsx +33 -0
- package/{lib/components/Card/style.js → components/Card/style.ts} +5 -4
- package/{lib/components/ConfirmationModal/index.js → components/ConfirmationModal/index.tsx} +25 -79
- package/{lib/components/ConfirmationModal/style.js → components/ConfirmationModal/style.tsx} +14 -13
- package/{lib/components/Container/index.js → components/Container/index.tsx} +7 -28
- package/{lib/components/Container/style.js → components/Container/style.ts} +6 -5
- package/{lib/components/CustomChatView/index.js → components/CustomChatView/index.tsx} +22 -30
- package/{lib/components/CustomChatView/style.js → components/CustomChatView/style.ts} +1 -1
- package/components/DeckSwiper/index.tsx +90 -0
- package/{lib/components/DeckSwiper/style.js → components/DeckSwiper/style.ts} +13 -12
- package/components/DonutCountdown/index.tsx +86 -0
- package/components/DonutCountdown/style.ts +8 -0
- package/components/FloatingContainer/index.tsx +35 -0
- package/{lib/components/FloatingContainer/style.js → components/FloatingContainer/style.ts} +7 -6
- package/components/Footer/index.tsx +35 -0
- package/{lib/components/Footer/style.js → components/Footer/style.ts} +4 -3
- package/components/Header/index.tsx +21 -0
- package/{lib/components/Header/style.js → components/Header/style.ts} +4 -3
- package/{lib/components/ImagePicker/index.js → components/ImagePicker/index.tsx} +3 -12
- package/components/ImageResponsive/index.tsx +24 -0
- package/components/ImageResponsive/style.ts +9 -0
- package/components/ImageViewer/index.tsx +36 -0
- package/{lib/components/ImageViewer/style.js → components/ImageViewer/style.ts} +11 -10
- package/{lib/components/Input/index.js → components/Input/index.tsx} +6 -33
- package/{lib/components/Input/style.js → components/Input/style.ts} +7 -18
- package/{lib/components/InputPin/index.js → components/InputPin/index.tsx} +6 -13
- package/{lib/components/InputPin/style.js → components/InputPin/style.ts} +7 -6
- package/components/MenuItem/index.tsx +25 -0
- package/{lib/components/MenuItem/style.js → components/MenuItem/style.ts} +9 -7
- package/{lib/components/NavigationTitle/index.js → components/NavigationTitle/index.tsx} +9 -30
- package/{lib/components/NavigationTitle/style.js → components/NavigationTitle/style.ts} +12 -11
- package/components/Notification/index.tsx +44 -0
- package/{lib/components/Notification/style.js → components/Notification/style.ts} +13 -11
- package/components/PreventDoubleClick/index.tsx +28 -0
- package/components/Select/index.tsx +51 -0
- package/components/Select/style.ts +64 -0
- package/{lib/components/SwipeablePanel/index.js → components/SwipeablePanel/index.tsx} +58 -85
- package/{lib/components/SwipeablePanel/style.js → components/SwipeablePanel/style.ts} +15 -14
- package/components/Switch/index.tsx +30 -0
- package/components/TakePicture/confirmPictureModal.tsx +37 -0
- package/components/TakePicture/index.tsx +148 -0
- package/{lib/components/TakePicture/style.js → components/TakePicture/style.ts} +4 -4
- package/components/Text/index.tsx +33 -0
- package/{lib/components/Text/style.js → components/Text/style.ts} +4 -2
- package/{lib/components/Textarea/index.js → components/Textarea/index.tsx} +5 -24
- package/{lib/components/Textarea/style.js → components/Textarea/style.ts} +5 -4
- package/components/TimeOutButton/index.tsx +67 -0
- package/{lib/components/TimeOutButton/style.js → components/TimeOutButton/style.ts} +4 -3
- package/components/Toast/index.tsx +34 -0
- package/components/Toast/style.ts +12 -0
- package/{lib/components/UploadDocument/index.js → components/UploadDocument/index.tsx} +49 -105
- package/{lib/components/UploadDocument/style.js → components/UploadDocument/style.ts} +16 -15
- package/components/VirtualKeyboard/index.tsx +75 -0
- package/{lib/components/VirtualKeyboard/style.js → components/VirtualKeyboard/style.ts} +9 -8
- package/components/index.ts +29 -0
- package/{lib/configs/constants.js → configs/constants.ts} +50 -48
- package/configs/types.ts +326 -0
- package/eas.json +27 -0
- package/eslint.config.mjs +205 -0
- package/hooks/index.ts +2 -0
- package/{lib/hooks/useDebounce.js → hooks/useDebounce.tsx} +6 -4
- package/hooks/useLoadFonts.tsx +13 -0
- package/index.js +3 -2
- package/lib/components/Button/index.tsx +66 -0
- package/lib/components/Button/style.ts +111 -0
- package/lib/components/Card/index.tsx +33 -0
- package/lib/components/Card/style.ts +34 -0
- package/lib/components/ConfirmationModal/index.tsx +104 -0
- package/lib/components/ConfirmationModal/style.tsx +53 -0
- package/lib/components/Container/index.tsx +33 -0
- package/lib/components/Container/style.ts +13 -0
- package/lib/components/CustomChatView/index.tsx +65 -0
- package/lib/components/CustomChatView/style.ts +10 -0
- package/lib/components/DeckSwiper/index.tsx +90 -0
- package/lib/components/DeckSwiper/style.ts +59 -0
- package/lib/components/DonutCountdown/index.tsx +86 -0
- package/lib/components/DonutCountdown/style.ts +8 -0
- package/lib/components/FloatingContainer/index.tsx +35 -0
- package/lib/components/FloatingContainer/style.ts +25 -0
- package/lib/components/Footer/index.tsx +35 -0
- package/lib/components/Footer/style.ts +40 -0
- package/lib/components/Header/index.tsx +21 -0
- package/lib/components/Header/style.ts +34 -0
- package/lib/components/ImagePicker/index.tsx +18 -0
- package/lib/components/ImageResponsive/index.tsx +24 -0
- package/lib/components/ImageResponsive/style.ts +9 -0
- package/lib/components/ImageViewer/index.tsx +36 -0
- package/lib/components/ImageViewer/style.ts +38 -0
- package/lib/components/Input/index.tsx +62 -0
- package/lib/components/Input/style.ts +91 -0
- package/lib/components/InputPin/index.tsx +21 -0
- package/lib/components/InputPin/style.ts +22 -0
- package/lib/components/MenuItem/index.tsx +25 -0
- package/lib/components/MenuItem/style.ts +44 -0
- package/lib/components/NavigationTitle/index.tsx +53 -0
- package/lib/components/NavigationTitle/style.ts +49 -0
- package/lib/components/Notification/index.tsx +44 -0
- package/lib/components/Notification/style.ts +50 -0
- package/lib/components/PreventDoubleClick/index.tsx +28 -0
- package/lib/components/Select/index.tsx +51 -0
- package/lib/components/Select/style.ts +64 -0
- package/lib/components/SwipeablePanel/index.tsx +208 -0
- package/lib/components/SwipeablePanel/style.ts +81 -0
- package/lib/components/Switch/index.tsx +30 -0
- package/lib/components/TakePicture/confirmPictureModal.tsx +37 -0
- package/lib/components/TakePicture/index.tsx +148 -0
- package/lib/components/TakePicture/style.ts +95 -0
- package/lib/components/Text/index.tsx +33 -0
- package/lib/components/Text/style.ts +101 -0
- package/lib/components/Textarea/index.tsx +26 -0
- package/lib/components/Textarea/style.ts +38 -0
- package/lib/components/TimeOutButton/index.tsx +67 -0
- package/lib/components/TimeOutButton/style.ts +42 -0
- package/lib/components/Toast/index.tsx +34 -0
- package/lib/components/Toast/style.ts +12 -0
- package/lib/components/UploadDocument/index.tsx +179 -0
- package/lib/components/UploadDocument/style.ts +57 -0
- package/lib/components/VirtualKeyboard/index.tsx +75 -0
- package/lib/components/VirtualKeyboard/style.ts +25 -0
- package/lib/components/index.ts +29 -0
- package/lib/configs/constants.ts +273 -0
- package/lib/configs/types.ts +326 -0
- package/lib/hooks/index.ts +2 -0
- package/lib/hooks/useDebounce.tsx +24 -0
- package/lib/hooks/useLoadFonts.tsx +13 -0
- package/lib/index.js +3 -2
- package/metro.config.js +11 -0
- package/package.json +72 -63
- package/prettier.config.mjs +23 -0
- package/stories/Button.stories.tsx +181 -0
- package/stories/Card.stories.tsx +22 -0
- package/stories/Colors.stories.tsx +57 -0
- package/stories/ConfirmationModal.stories.tsx +142 -0
- package/stories/Container.stories.tsx +105 -0
- package/stories/DeckSwiper.stories.tsx +43 -0
- package/stories/DonutCountdown.stories.tsx +134 -0
- package/stories/FloatingContainer.stories.tsx +139 -0
- package/stories/Footer.stories.tsx +65 -0
- package/stories/Header.stories.tsx +37 -0
- package/stories/ImagePicker.stories.tsx +14 -0
- package/stories/ImageResponsive.stories.tsx +18 -0
- package/stories/ImageViewer.stories.tsx +24 -0
- package/stories/Input.stories.tsx +119 -0
- package/stories/InputPin.stories.tsx +40 -0
- package/stories/Menu.stories.tsx +53 -0
- package/stories/MenuItem.stories.tsx +30 -0
- package/stories/NavigationTitle.stories.tsx +51 -0
- package/stories/Notification.stories.tsx +58 -0
- package/stories/Select.stories.tsx +270 -0
- package/stories/SwipeablePanel.stories.tsx +360 -0
- package/stories/Switch.stories.tsx +36 -0
- package/stories/TakePicture.stories.tsx +59 -0
- package/stories/Text.stories.tsx +61 -0
- package/stories/Textarea.stories.tsx +48 -0
- package/stories/TimeOutButton.stories.tsx +55 -0
- package/stories/Toast.stories.tsx +37 -0
- package/stories/UploadDocument.stories.tsx +179 -0
- package/stories/VirtualKeyboard.stories.tsx +14 -0
- package/tsconfig.json +21 -0
- package/utilities/ScrollView.tsx +19 -0
- package/utilities/index.ts +2 -0
- package/utilities/utils.ts +29 -0
- package/lib/components/Button/index.js +0 -104
- package/lib/components/Card/index.js +0 -49
- package/lib/components/DeckSwiper/index.js +0 -118
- package/lib/components/FlashMessage/index.js +0 -81
- package/lib/components/FloatingContainer/index.js +0 -69
- package/lib/components/Footer/index.js +0 -61
- package/lib/components/Header/index.js +0 -45
- package/lib/components/ImageResponsive/index.js +0 -39
- package/lib/components/ImageResponsive/style.js +0 -7
- package/lib/components/ImageViewer/index.js +0 -62
- package/lib/components/MenuItem/index.js +0 -44
- package/lib/components/Notification/index.js +0 -80
- package/lib/components/PreventDoubleClick/index.js +0 -21
- package/lib/components/Select/index.js +0 -89
- package/lib/components/Select/style.js +0 -81
- package/lib/components/Switch/index.js +0 -57
- package/lib/components/TakePicture/confirmPictureModal.js +0 -64
- package/lib/components/TakePicture/index.js +0 -198
- package/lib/components/Text/index.js +0 -75
- package/lib/components/TimeOutButton/index.js +0 -104
- package/lib/components/VirtualKeyboard/index.js +0 -86
- package/lib/components/index.js +0 -28
- package/lib/configs/loadFonts.js +0 -11
- package/lib/hooks/index.js +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Alert } from 'react-native';
|
|
4
|
+
|
|
5
|
+
import { UploadDocument } from '../components';
|
|
6
|
+
import { Colors } from '../configs/constants';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'UploadDocument',
|
|
10
|
+
component: UploadDocument,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<UploadDocument
|
|
16
|
+
title="Foto frontal"
|
|
17
|
+
description="Foto frontal de su cedula de identidad"
|
|
18
|
+
uploadButtonText="Subir"
|
|
19
|
+
reUploadButtonText="Volver a subir documento"
|
|
20
|
+
icon={<Ionicons name="image-outline" color={Colors.darkblue} size={50} />}
|
|
21
|
+
mediaModal={{
|
|
22
|
+
title: 'Seleccionar origen',
|
|
23
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
24
|
+
confirmText: 'Cámara',
|
|
25
|
+
cancelText: 'Galería',
|
|
26
|
+
}}
|
|
27
|
+
takePicture={{
|
|
28
|
+
cameraErrorMessage: 'No access to the camera',
|
|
29
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
30
|
+
processingPictureMessage: 'Processing',
|
|
31
|
+
repeatPictureText: 'Repeat',
|
|
32
|
+
usePictureText: 'Use',
|
|
33
|
+
}}
|
|
34
|
+
onSelectImage={() => {}}
|
|
35
|
+
/>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const AvatarType = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<UploadDocument
|
|
42
|
+
title="Avatar"
|
|
43
|
+
uploadButtonText="Subir"
|
|
44
|
+
reUploadButtonText="Volver a subir avatar"
|
|
45
|
+
icon={<Ionicons name="happy-outline" color={Colors.darkblue} size={50} />}
|
|
46
|
+
mediaModal={{
|
|
47
|
+
title: 'Seleccionar origen',
|
|
48
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
49
|
+
confirmText: 'Cámara',
|
|
50
|
+
cancelText: 'Galería',
|
|
51
|
+
}}
|
|
52
|
+
takePicture={{
|
|
53
|
+
cameraErrorMessage: 'No access to the camera',
|
|
54
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
55
|
+
processingPictureMessage: 'Processing',
|
|
56
|
+
repeatPictureText: 'Repeat',
|
|
57
|
+
usePictureText: 'Use',
|
|
58
|
+
}}
|
|
59
|
+
onSelectImage={() => {}}
|
|
60
|
+
isAvatarPicker
|
|
61
|
+
/>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const PreloadedFile = {
|
|
66
|
+
render: () => (
|
|
67
|
+
<UploadDocument
|
|
68
|
+
title="Foto frontal"
|
|
69
|
+
description="Foto frontal de su cedula de identidad"
|
|
70
|
+
uploadButtonText="Subir"
|
|
71
|
+
reUploadButtonText="Volver a subir documento"
|
|
72
|
+
icon={<Ionicons name="image-outline" color={Colors.darkblue} size={50} />}
|
|
73
|
+
mediaModal={{
|
|
74
|
+
title: 'Seleccionar origen',
|
|
75
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
76
|
+
confirmText: 'Cámara',
|
|
77
|
+
cancelText: 'Galería',
|
|
78
|
+
}}
|
|
79
|
+
takePicture={{
|
|
80
|
+
cameraErrorMessage: 'No access to the camera',
|
|
81
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
82
|
+
processingPictureMessage: 'Processing',
|
|
83
|
+
repeatPictureText: 'Repeat',
|
|
84
|
+
usePictureText: 'Use',
|
|
85
|
+
}}
|
|
86
|
+
onSelectImage={() => {}}
|
|
87
|
+
file="https://picsum.photos/200?random=1"
|
|
88
|
+
/>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const CompletedComponent = () => {
|
|
93
|
+
const [value, setValue] = useState<string>();
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<UploadDocument
|
|
97
|
+
title="Foto frontal"
|
|
98
|
+
description="Foto frontal de su cedula de identidad"
|
|
99
|
+
uploadButtonText="Subir"
|
|
100
|
+
reUploadButtonText="Volver a subir documento"
|
|
101
|
+
icon={<Ionicons name="image-outline" color={Colors.darkblue} size={50} />}
|
|
102
|
+
mediaModal={{
|
|
103
|
+
title: 'Seleccionar origen',
|
|
104
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
105
|
+
confirmText: 'Cámara',
|
|
106
|
+
cancelText: 'Galería',
|
|
107
|
+
}}
|
|
108
|
+
takePicture={{
|
|
109
|
+
cameraErrorMessage: 'No access to the camera',
|
|
110
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
111
|
+
processingPictureMessage: 'Processing',
|
|
112
|
+
repeatPictureText: 'Repeat',
|
|
113
|
+
usePictureText: 'Use',
|
|
114
|
+
}}
|
|
115
|
+
onSelectImage={setValue}
|
|
116
|
+
completed={value !== null}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const Completed = {
|
|
122
|
+
render: CompletedComponent,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const Inverted = {
|
|
126
|
+
render: () => (
|
|
127
|
+
<UploadDocument
|
|
128
|
+
inverted
|
|
129
|
+
title="Foto frontal"
|
|
130
|
+
description="Foto frontal de su cedula de identidad"
|
|
131
|
+
uploadButtonText="Subir"
|
|
132
|
+
reUploadButtonText="Volver a subir documento"
|
|
133
|
+
icon={<Ionicons name="image-outline" color={Colors.darkblue} size={50} />}
|
|
134
|
+
mediaModal={{
|
|
135
|
+
title: 'Seleccionar origen',
|
|
136
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
137
|
+
confirmText: 'Cámara',
|
|
138
|
+
cancelText: 'Galería',
|
|
139
|
+
}}
|
|
140
|
+
takePicture={{
|
|
141
|
+
cameraErrorMessage: 'No access to the camera',
|
|
142
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
143
|
+
processingPictureMessage: 'Processing',
|
|
144
|
+
repeatPictureText: 'Repeat',
|
|
145
|
+
usePictureText: 'Use',
|
|
146
|
+
}}
|
|
147
|
+
onSelectImage={() => {}}
|
|
148
|
+
/>
|
|
149
|
+
),
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const PermissionDenied = {
|
|
153
|
+
render: () => (
|
|
154
|
+
<UploadDocument
|
|
155
|
+
title="Foto frontal"
|
|
156
|
+
description="Foto frontal de su cedula de identidad"
|
|
157
|
+
uploadButtonText="Subir"
|
|
158
|
+
reUploadButtonText="Volver a subir documento"
|
|
159
|
+
icon={<Ionicons name="image-outline" color={Colors.darkblue} size={50} />}
|
|
160
|
+
onPermissionDenied={() => {
|
|
161
|
+
Alert.alert('Permission denied', 'Permission denied');
|
|
162
|
+
}}
|
|
163
|
+
mediaModal={{
|
|
164
|
+
title: 'Seleccionar origen',
|
|
165
|
+
description: 'Selecione desde donde desea cargar el archivo',
|
|
166
|
+
confirmText: 'Cámara',
|
|
167
|
+
cancelText: 'Galería',
|
|
168
|
+
}}
|
|
169
|
+
takePicture={{
|
|
170
|
+
cameraErrorMessage: 'No access to the camera',
|
|
171
|
+
requestPermissionsMessage: 'Grant access to the camera',
|
|
172
|
+
processingPictureMessage: 'Processing',
|
|
173
|
+
repeatPictureText: 'Repeat',
|
|
174
|
+
usePictureText: 'Use',
|
|
175
|
+
}}
|
|
176
|
+
onSelectImage={() => {}}
|
|
177
|
+
/>
|
|
178
|
+
),
|
|
179
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VirtualKeyboard } from '../components';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Virtual Keyboard',
|
|
5
|
+
component: VirtualKeyboard,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Default = {
|
|
9
|
+
render: () => <VirtualKeyboard onPress={() => {}} />,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const HideBiometrics = {
|
|
13
|
+
render: () => <VirtualKeyboard onPress={() => {}} hideBiometrics />,
|
|
14
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Bundler */
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"resolveJsonModule": true,
|
|
7
|
+
|
|
8
|
+
/* Linting */
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"noFallthroughCasesInSwitch": true,
|
|
14
|
+
"noImplicitAny": true,
|
|
15
|
+
"noImplicitThis": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"strictNullChecks": true,
|
|
18
|
+
"useUnknownInCatchVariables": false
|
|
19
|
+
},
|
|
20
|
+
"extends": "expo/tsconfig.base"
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ScrollView } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface ScrollViewProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
styles?: StyleProp<ViewStyle>;
|
|
9
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default ({ children, styles, contentContainerStyle }: ScrollViewProps) => (
|
|
13
|
+
<ScrollView
|
|
14
|
+
style={[{ paddingVertical: 42, paddingHorizontal: 20, flex: 1 }, styles]}
|
|
15
|
+
contentContainerStyle={contentContainerStyle}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</ScrollView>
|
|
19
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const lightOrDark = (color: any) => {
|
|
2
|
+
let r: number, g: number, b: number;
|
|
3
|
+
// Check the format of the color, HEX or RGB?
|
|
4
|
+
if (color.match(/^rgb/)) {
|
|
5
|
+
// If HEX --> store the red, green, blue values in separate variables
|
|
6
|
+
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
|
|
7
|
+
|
|
8
|
+
r = color[1];
|
|
9
|
+
g = color[2];
|
|
10
|
+
b = color[3];
|
|
11
|
+
} else {
|
|
12
|
+
// If RGB --> Convert it to HEX: http://gist.github.com/983661
|
|
13
|
+
color = +('0x' + color.slice(1).replace(color.length < 5 && /./g, '$&$&'));
|
|
14
|
+
|
|
15
|
+
r = Math.floor(color / (256 * 256));
|
|
16
|
+
g = Math.floor(color / 256) % 256;
|
|
17
|
+
b = color % 256;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// HSP equation from http://alienryderflex.com/hsp.html
|
|
21
|
+
const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
|
|
22
|
+
|
|
23
|
+
// Using the HSP value, determine whether the color is light or dark
|
|
24
|
+
if (hsp > 127.5) {
|
|
25
|
+
return 'light';
|
|
26
|
+
} else {
|
|
27
|
+
return 'dark';
|
|
28
|
+
}
|
|
29
|
+
};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { TouchableOpacity, ActivityIndicator } from 'react-native';
|
|
4
|
-
import withPreventDoubleClick from './../PreventDoubleClick';
|
|
5
|
-
import { Colors } from '../../configs/constants';
|
|
6
|
-
import style from './style';
|
|
7
|
-
|
|
8
|
-
const Button = ({
|
|
9
|
-
onPress,
|
|
10
|
-
disabled,
|
|
11
|
-
isLoading,
|
|
12
|
-
bordered,
|
|
13
|
-
variant = 'primary',
|
|
14
|
-
size = 'medium',
|
|
15
|
-
noShadow,
|
|
16
|
-
style: customStyle,
|
|
17
|
-
debounceDelay = 0,
|
|
18
|
-
children,
|
|
19
|
-
}) => {
|
|
20
|
-
const [isDisabled, setIsDisabled] = useState(disabled);
|
|
21
|
-
|
|
22
|
-
useEffect(() => setIsDisabled(disabled), [disabled]);
|
|
23
|
-
|
|
24
|
-
const getSpinnerColor = () => {
|
|
25
|
-
switch (variant) {
|
|
26
|
-
case 'primary':
|
|
27
|
-
case 'inverted':
|
|
28
|
-
case 'error':
|
|
29
|
-
return Colors.white;
|
|
30
|
-
default:
|
|
31
|
-
return Colors.darkblue;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleTap = () => {
|
|
36
|
-
onPress();
|
|
37
|
-
setIsDisabled(true);
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
setIsDisabled(false);
|
|
40
|
-
}, debounceDelay);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<TouchableOpacity
|
|
45
|
-
style={[
|
|
46
|
-
style.button,
|
|
47
|
-
style[variant],
|
|
48
|
-
style[size],
|
|
49
|
-
bordered ? style.bordered : {},
|
|
50
|
-
isDisabled ? style.disabled : {},
|
|
51
|
-
noShadow ? style.noShadow : {},
|
|
52
|
-
customStyle,
|
|
53
|
-
]}
|
|
54
|
-
disabled={isLoading || isDisabled}
|
|
55
|
-
onPress={handleTap}
|
|
56
|
-
>
|
|
57
|
-
{isLoading ? (
|
|
58
|
-
<ActivityIndicator color={getSpinnerColor()} size={28} />
|
|
59
|
-
) : (
|
|
60
|
-
children
|
|
61
|
-
)}
|
|
62
|
-
</TouchableOpacity>
|
|
63
|
-
);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
Button.defaultProps = {
|
|
67
|
-
children: null,
|
|
68
|
-
disabled: false,
|
|
69
|
-
isLoading: false,
|
|
70
|
-
bordered: false,
|
|
71
|
-
noShadow: false,
|
|
72
|
-
variant: 'primary',
|
|
73
|
-
size: 'medium',
|
|
74
|
-
style: {},
|
|
75
|
-
onPress: () => {},
|
|
76
|
-
debounceDelay: 0,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
Button.propTypes = {
|
|
80
|
-
children: PropTypes.node,
|
|
81
|
-
disabled: PropTypes.bool,
|
|
82
|
-
isLoading: PropTypes.bool,
|
|
83
|
-
bordered: PropTypes.bool,
|
|
84
|
-
noShadow: PropTypes.bool,
|
|
85
|
-
variant: PropTypes.oneOf([
|
|
86
|
-
'brightblue',
|
|
87
|
-
'brightviolet',
|
|
88
|
-
'darkyellow',
|
|
89
|
-
'dim',
|
|
90
|
-
'electricblue',
|
|
91
|
-
'error',
|
|
92
|
-
'inverted',
|
|
93
|
-
'light',
|
|
94
|
-
'lightgreen',
|
|
95
|
-
'primary',
|
|
96
|
-
'secondary',
|
|
97
|
-
]),
|
|
98
|
-
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'fit', 'icon']),
|
|
99
|
-
style: PropTypes.any,
|
|
100
|
-
onPress: PropTypes.func,
|
|
101
|
-
debounceDelay: PropTypes.number,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export default withPreventDoubleClick(Button);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { View, TouchableOpacity } from 'react-native';
|
|
4
|
-
import withPreventDoubleClick from '../PreventDoubleClick';
|
|
5
|
-
import style from './style';
|
|
6
|
-
|
|
7
|
-
const TappedTouchableOpacity = withPreventDoubleClick(TouchableOpacity);
|
|
8
|
-
|
|
9
|
-
const Card = (
|
|
10
|
-
{ children, isButton, onPress, noShadow, style: customStyle },
|
|
11
|
-
...props
|
|
12
|
-
) => (
|
|
13
|
-
<>
|
|
14
|
-
{isButton ? (
|
|
15
|
-
<TappedTouchableOpacity
|
|
16
|
-
onPress={onPress}
|
|
17
|
-
style={[style.card, customStyle, noShadow ? style.noShadow : {}]}
|
|
18
|
-
{...props}
|
|
19
|
-
>
|
|
20
|
-
{children}
|
|
21
|
-
</TappedTouchableOpacity>
|
|
22
|
-
) : (
|
|
23
|
-
<View
|
|
24
|
-
style={[style.card, customStyle, noShadow ? style.noShadow : {}]}
|
|
25
|
-
{...props}
|
|
26
|
-
>
|
|
27
|
-
{children}
|
|
28
|
-
</View>
|
|
29
|
-
)}
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
Card.defaultProps = {
|
|
34
|
-
style: {},
|
|
35
|
-
children: null,
|
|
36
|
-
isButton: false,
|
|
37
|
-
noShadow: false,
|
|
38
|
-
onPress: () => {},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
Card.propTypes = {
|
|
42
|
-
style: PropTypes.any,
|
|
43
|
-
children: PropTypes.node,
|
|
44
|
-
isButton: PropTypes.bool,
|
|
45
|
-
noShadow: PropTypes.bool,
|
|
46
|
-
onPress: PropTypes.func,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default Card;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { View, Image } from 'react-native';
|
|
4
|
-
import Swiper from 'react-native-deck-swiper';
|
|
5
|
-
import Entypo from 'react-native-vector-icons/Entypo';
|
|
6
|
-
import Text from '../Text';
|
|
7
|
-
import Button from '../Button';
|
|
8
|
-
import { Colors } from '../../configs/constants';
|
|
9
|
-
import style from './style';
|
|
10
|
-
|
|
11
|
-
const DeckSwiper = ({ data, inverted, nextText, onChange, onFinish }) => {
|
|
12
|
-
const swiper = useRef(null);
|
|
13
|
-
const [finished, setFinished] = useState(false);
|
|
14
|
-
const [index, setIndex] = useState(0);
|
|
15
|
-
|
|
16
|
-
const renderDots = () =>
|
|
17
|
-
data.map((d, i) => (
|
|
18
|
-
<Entypo
|
|
19
|
-
name='dot-single'
|
|
20
|
-
size={36}
|
|
21
|
-
key={`dot-${i}`}
|
|
22
|
-
style={style[index === i ? 'dotSelected' : 'dot']}
|
|
23
|
-
/>
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<Swiper
|
|
29
|
-
ref={swiper}
|
|
30
|
-
cards={data}
|
|
31
|
-
renderCard={(card) => {
|
|
32
|
-
if (!card) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return (
|
|
36
|
-
<View style={style.card}>
|
|
37
|
-
<View style={style.imageContainer}>
|
|
38
|
-
<Image
|
|
39
|
-
style={style.imageResponsive}
|
|
40
|
-
source={card.image}
|
|
41
|
-
progressiveRenderingEnabled
|
|
42
|
-
resizeMode='contain'
|
|
43
|
-
/>
|
|
44
|
-
</View>
|
|
45
|
-
<View style={style.textContainer}>
|
|
46
|
-
<Text size='extra-large' style={style.title}>
|
|
47
|
-
{card.title}
|
|
48
|
-
</Text>
|
|
49
|
-
<Text size='large' align='center'>
|
|
50
|
-
{card.description}
|
|
51
|
-
</Text>
|
|
52
|
-
</View>
|
|
53
|
-
</View>
|
|
54
|
-
);
|
|
55
|
-
}}
|
|
56
|
-
onSwipedAll={() => {
|
|
57
|
-
setFinished(true);
|
|
58
|
-
onFinish();
|
|
59
|
-
}}
|
|
60
|
-
onSwipedRight={(index) => {
|
|
61
|
-
setIndex(index - 1);
|
|
62
|
-
onChange(index - 1);
|
|
63
|
-
}}
|
|
64
|
-
onSwipedLeft={(index) => {
|
|
65
|
-
setIndex(index + 1);
|
|
66
|
-
onChange(index + 1);
|
|
67
|
-
}}
|
|
68
|
-
cardIndex={index}
|
|
69
|
-
backgroundColor={Colors.white}
|
|
70
|
-
stackSize={2}
|
|
71
|
-
verticalSwipe={false}
|
|
72
|
-
showSecondCard={true}
|
|
73
|
-
disableRightSwipe={index === 0}
|
|
74
|
-
goBackToPreviousCardOnSwipeRight={true}
|
|
75
|
-
childrenOnTop
|
|
76
|
-
>
|
|
77
|
-
{!finished && (
|
|
78
|
-
<>
|
|
79
|
-
<View style={style.dotsContainer}>{renderDots()}</View>
|
|
80
|
-
<View style={style.container}>
|
|
81
|
-
<Button
|
|
82
|
-
variant={inverted ? 'inverted' : 'primary'}
|
|
83
|
-
onPress={() => swiper.current.swipeLeft()}
|
|
84
|
-
>
|
|
85
|
-
<Text color='white'>{nextText}</Text>
|
|
86
|
-
</Button>
|
|
87
|
-
</View>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</Swiper>
|
|
91
|
-
</>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
DeckSwiper.defaultProps = {
|
|
96
|
-
data: [],
|
|
97
|
-
inverted: false,
|
|
98
|
-
nextText: ' ',
|
|
99
|
-
useUri: false,
|
|
100
|
-
onChange: () => {},
|
|
101
|
-
onfinish: () => {},
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
DeckSwiper.propTypes = {
|
|
105
|
-
data: PropTypes.arrayOf(
|
|
106
|
-
PropTypes.shape({
|
|
107
|
-
image: PropTypes.string,
|
|
108
|
-
title: PropTypes.string,
|
|
109
|
-
description: PropTypes.string,
|
|
110
|
-
})
|
|
111
|
-
),
|
|
112
|
-
inverted: PropTypes.bool,
|
|
113
|
-
nextText: PropTypes.string,
|
|
114
|
-
onChange: PropTypes.func,
|
|
115
|
-
onFinish: PropTypes.func,
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default DeckSwiper;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
5
|
-
import RNFlashMessage, {
|
|
6
|
-
showMessage,
|
|
7
|
-
renderFlashMessageIcon,
|
|
8
|
-
} from 'react-native-flash-message';
|
|
9
|
-
import { Colors } from '../../configs/constants';
|
|
10
|
-
|
|
11
|
-
export const customRenderFlashMessageIcon = (
|
|
12
|
-
icon = 'success',
|
|
13
|
-
style = {},
|
|
14
|
-
customProps = {}
|
|
15
|
-
) => {
|
|
16
|
-
switch (icon) {
|
|
17
|
-
case 'success':
|
|
18
|
-
return (
|
|
19
|
-
<Ionicons
|
|
20
|
-
name='checkmark-circle-outline'
|
|
21
|
-
color={Colors.darkblue}
|
|
22
|
-
size={30}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
case 'error':
|
|
26
|
-
return (
|
|
27
|
-
<Ionicons
|
|
28
|
-
name='alert-circle-outline'
|
|
29
|
-
color={Colors.darkblue}
|
|
30
|
-
size={30}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// it's good to inherit the original method...
|
|
36
|
-
return renderFlashMessageIcon(icon, style, customProps);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const statusBarHeight = Platform.OS === 'android' ? { statusBarHeight: 5 } : {};
|
|
40
|
-
|
|
41
|
-
export const sendMessage = ({ variant, message, description }) => {
|
|
42
|
-
return showMessage({
|
|
43
|
-
position: 'top',
|
|
44
|
-
message,
|
|
45
|
-
description,
|
|
46
|
-
icon: variant,
|
|
47
|
-
type: variant,
|
|
48
|
-
backgroundColor: variant === 'success' ? Colors.green : Colors.lightred,
|
|
49
|
-
color: Colors.darkblue,
|
|
50
|
-
hideOnPress: true,
|
|
51
|
-
...statusBarHeight,
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
sendMessage.defaultProps = {
|
|
56
|
-
options: {
|
|
57
|
-
variant: 'success',
|
|
58
|
-
message: ' ',
|
|
59
|
-
description: ' ',
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
sendMessage.propTypes = {
|
|
64
|
-
options: PropTypes.shape({
|
|
65
|
-
variant: PropTypes.oneOf(['success', 'error']),
|
|
66
|
-
message: PropTypes.string,
|
|
67
|
-
description: PropTypes.string,
|
|
68
|
-
}),
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const FlashMessage = () => {
|
|
72
|
-
return (
|
|
73
|
-
<RNFlashMessage
|
|
74
|
-
renderFlashMessageIcon={customRenderFlashMessageIcon}
|
|
75
|
-
titleStyle={{ fontFamily: 'poppins_bold' }}
|
|
76
|
-
textStyle={{ fontFamily: 'poppins_regular' }}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default FlashMessage;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
View,
|
|
5
|
-
ScrollView,
|
|
6
|
-
RefreshControl,
|
|
7
|
-
KeyboardAvoidingView,
|
|
8
|
-
Platform,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import style from './style';
|
|
11
|
-
|
|
12
|
-
const FloatingContainer = ({
|
|
13
|
-
useRefreshControl,
|
|
14
|
-
onRefresh,
|
|
15
|
-
isRefreshing,
|
|
16
|
-
children,
|
|
17
|
-
floatingComponent,
|
|
18
|
-
centered,
|
|
19
|
-
floatingContainerStyle,
|
|
20
|
-
disableScroll,
|
|
21
|
-
}) => (
|
|
22
|
-
<KeyboardAvoidingView
|
|
23
|
-
style={style.floatingContainer}
|
|
24
|
-
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
25
|
-
>
|
|
26
|
-
<ScrollView
|
|
27
|
-
contentContainerStyle={centered ? style.centered : {}}
|
|
28
|
-
fadingEdgeLength={150}
|
|
29
|
-
keyboardShouldPersistTaps='handled'
|
|
30
|
-
showsVerticalScrollIndicator={false}
|
|
31
|
-
scrollEnabled={!disableScroll}
|
|
32
|
-
keyboardDismissMode='on-drag'
|
|
33
|
-
refreshControl={
|
|
34
|
-
useRefreshControl ? (
|
|
35
|
-
<RefreshControl refreshing={isRefreshing} onRefresh={onRefresh} />
|
|
36
|
-
) : null
|
|
37
|
-
}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
</ScrollView>
|
|
41
|
-
<View style={[style.container, floatingContainerStyle]}>
|
|
42
|
-
{floatingComponent}
|
|
43
|
-
</View>
|
|
44
|
-
</KeyboardAvoidingView>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
FloatingContainer.defaultProps = {
|
|
48
|
-
useRefreshControl: false,
|
|
49
|
-
isRefreshing: false,
|
|
50
|
-
centered: false,
|
|
51
|
-
onRefresh: () => {},
|
|
52
|
-
children: null,
|
|
53
|
-
floatingComponent: null,
|
|
54
|
-
disableScroll: false,
|
|
55
|
-
floatingContainerStyle: {},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
FloatingContainer.propTypes = {
|
|
59
|
-
useRefreshControl: PropTypes.bool,
|
|
60
|
-
isRefreshing: PropTypes.bool,
|
|
61
|
-
centered: PropTypes.bool,
|
|
62
|
-
onRefresh: PropTypes.func,
|
|
63
|
-
children: PropTypes.node,
|
|
64
|
-
floatingComponent: PropTypes.node,
|
|
65
|
-
disableScroll: PropTypes.bool,
|
|
66
|
-
floatingContainerStyle: PropTypes.any,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default FloatingContainer;
|