@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
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import React, { useState, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Modal, TouchableOpacity, View, ActivityIndicator } from 'react-native';
|
|
4
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
5
|
-
import { CameraView, useCameraPermissions } from 'expo-camera';
|
|
6
|
-
import * as ImageManipulator from 'expo-image-manipulator';
|
|
7
|
-
import { Svg, Defs, Rect, Mask, Circle } from 'react-native-svg';
|
|
8
|
-
import Text from '../Text';
|
|
9
|
-
import Container from '../Container';
|
|
10
|
-
import Button from '../Button';
|
|
11
|
-
import { Colors } from '../../configs/constants';
|
|
12
|
-
import { ConfirmPictureModal } from './confirmPictureModal';
|
|
13
|
-
import style from './style';
|
|
14
|
-
|
|
15
|
-
const DESIRED_RATIO = '16:9';
|
|
16
|
-
|
|
17
|
-
const SvgCircle = () => {
|
|
18
|
-
return (
|
|
19
|
-
<Svg height='100%' width='100%'>
|
|
20
|
-
<Defs>
|
|
21
|
-
<Mask id='mask' x='0' y='0' height='100%' width='100%'>
|
|
22
|
-
<Rect height='100%' width='100%' fill={Colors.white} />
|
|
23
|
-
<Circle r='29%' cx='50%' cy='50%' fill={Colors.darkgray} />
|
|
24
|
-
</Mask>
|
|
25
|
-
</Defs>
|
|
26
|
-
<Rect
|
|
27
|
-
height='100%'
|
|
28
|
-
width='100%'
|
|
29
|
-
fill='rgba(0, 0, 0, 0.8)'
|
|
30
|
-
mask='url(#mask)'
|
|
31
|
-
fill-opacity='0'
|
|
32
|
-
/>
|
|
33
|
-
</Svg>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const TakePicture = ({
|
|
38
|
-
visible,
|
|
39
|
-
onClose,
|
|
40
|
-
avatar,
|
|
41
|
-
cameraErrorMessage,
|
|
42
|
-
requestPermissionsMessage,
|
|
43
|
-
processingPictureMessage,
|
|
44
|
-
repeatPictureText,
|
|
45
|
-
usePictureText,
|
|
46
|
-
}) => {
|
|
47
|
-
const [permission, requestPermission] = useCameraPermissions();
|
|
48
|
-
const [type, setType] = useState('back');
|
|
49
|
-
const [image, setImage] = useState(null);
|
|
50
|
-
const [takingPicture, setTakingPicture] = useState(false);
|
|
51
|
-
const camera = useRef();
|
|
52
|
-
|
|
53
|
-
const flipCamera = () => {
|
|
54
|
-
setType((current) => (current === 'back' ? 'front' : 'back'));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const takePicture = async () => {
|
|
58
|
-
if (camera) {
|
|
59
|
-
setTakingPicture(true);
|
|
60
|
-
const tempImage = await camera.current.takePictureAsync({ quality: 1.0 });
|
|
61
|
-
|
|
62
|
-
if (avatar) {
|
|
63
|
-
const avatarImage = await ImageManipulator.manipulateAsync(
|
|
64
|
-
tempImage.localUri || tempImage.uri,
|
|
65
|
-
[
|
|
66
|
-
{
|
|
67
|
-
crop: {
|
|
68
|
-
originX: 0,
|
|
69
|
-
originY: (tempImage.height - tempImage.width) / 2,
|
|
70
|
-
width: tempImage.width,
|
|
71
|
-
height: tempImage.width,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
{ compress: 1.0, format: ImageManipulator.SaveFormat.PNG }
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
setImage(avatarImage);
|
|
79
|
-
setTakingPicture(false);
|
|
80
|
-
} else {
|
|
81
|
-
setImage(tempImage);
|
|
82
|
-
setTakingPicture(false);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const repeatPhoto = () => {
|
|
88
|
-
setImage(null);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const usePhoto = () => {
|
|
92
|
-
onClose(typeof image === 'object' ? image.uri : image);
|
|
93
|
-
setImage(null);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const closeModal = () => {
|
|
97
|
-
setImage(null);
|
|
98
|
-
onClose();
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
if (!permission?.granted) {
|
|
102
|
-
return (
|
|
103
|
-
<View style={style.cameraPermissionsContainer}>
|
|
104
|
-
<Text color='red'>{cameraErrorMessage}</Text>
|
|
105
|
-
<Button onPress={requestPermission} color='inverted'>
|
|
106
|
-
<Text color='white'>{requestPermissionsMessage}</Text>
|
|
107
|
-
</Button>
|
|
108
|
-
</View>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<Modal
|
|
114
|
-
animationType='slide'
|
|
115
|
-
transparent={false}
|
|
116
|
-
visible={visible}
|
|
117
|
-
onRequestClose={onClose}
|
|
118
|
-
>
|
|
119
|
-
<Container style={style.cameraContainer}>
|
|
120
|
-
<CameraView
|
|
121
|
-
ref={camera}
|
|
122
|
-
style={style.cameraContainer}
|
|
123
|
-
facing={type}
|
|
124
|
-
ratio={DESIRED_RATIO}
|
|
125
|
-
>
|
|
126
|
-
{avatar && <SvgCircle />}
|
|
127
|
-
|
|
128
|
-
<View style={style.cameraFlipContainer}>
|
|
129
|
-
<TouchableOpacity onPress={closeModal} style={style.closeIcon}>
|
|
130
|
-
<Ionicons
|
|
131
|
-
name='close-outline'
|
|
132
|
-
color={Colors.darkblue}
|
|
133
|
-
size={24}
|
|
134
|
-
/>
|
|
135
|
-
</TouchableOpacity>
|
|
136
|
-
<TouchableOpacity style={style.cameraFlipBtn} onPress={flipCamera}>
|
|
137
|
-
<Ionicons
|
|
138
|
-
name='camera-reverse-outline'
|
|
139
|
-
style={style.cameraFlipIcon}
|
|
140
|
-
color={Colors.white}
|
|
141
|
-
size={40}
|
|
142
|
-
/>
|
|
143
|
-
</TouchableOpacity>
|
|
144
|
-
<TouchableOpacity
|
|
145
|
-
style={style.cameraRecordBtn}
|
|
146
|
-
onPress={takePicture}
|
|
147
|
-
>
|
|
148
|
-
<Ionicons
|
|
149
|
-
name='radio-button-on-outline'
|
|
150
|
-
color={Colors.red}
|
|
151
|
-
size={60}
|
|
152
|
-
/>
|
|
153
|
-
</TouchableOpacity>
|
|
154
|
-
</View>
|
|
155
|
-
</CameraView>
|
|
156
|
-
|
|
157
|
-
{takingPicture && (
|
|
158
|
-
<View style={style.cameraTakingPictureOverlay}>
|
|
159
|
-
<ActivityIndicator color={Colors.darkblue} />
|
|
160
|
-
<Text color='white'>{processingPictureMessage} ...</Text>
|
|
161
|
-
</View>
|
|
162
|
-
)}
|
|
163
|
-
<ConfirmPictureModal
|
|
164
|
-
visible={image !== null}
|
|
165
|
-
image={image}
|
|
166
|
-
repeatPictureText={repeatPictureText}
|
|
167
|
-
usePictureText={usePictureText}
|
|
168
|
-
onRepeatPhoto={repeatPhoto}
|
|
169
|
-
onUsePhoto={usePhoto}
|
|
170
|
-
/>
|
|
171
|
-
</Container>
|
|
172
|
-
</Modal>
|
|
173
|
-
);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
TakePicture.defaultProps = {
|
|
177
|
-
visible: false,
|
|
178
|
-
onClose: () => {},
|
|
179
|
-
avatar: false,
|
|
180
|
-
cameraErrorMessage: ' ',
|
|
181
|
-
requestPermissionsMessage: ' ',
|
|
182
|
-
processingPictureMessage: ' ',
|
|
183
|
-
repeatPictureText: ' ',
|
|
184
|
-
usePictureText: ' ',
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
TakePicture.propTypes = {
|
|
188
|
-
visible: PropTypes.bool.isRequired,
|
|
189
|
-
onClose: PropTypes.func.isRequired,
|
|
190
|
-
avatar: PropTypes.bool,
|
|
191
|
-
cameraErrorMessage: PropTypes.string.isRequired,
|
|
192
|
-
requestPermissionsMessage: PropTypes.string.isRequired,
|
|
193
|
-
processingPictureMessage: PropTypes.string.isRequired,
|
|
194
|
-
repeatPictureText: PropTypes.string.isRequired,
|
|
195
|
-
usePictureText: PropTypes.string.isRequired,
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export default TakePicture;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Text as RNText } from 'react-native';
|
|
4
|
-
import style from './style';
|
|
5
|
-
|
|
6
|
-
const Text = ({
|
|
7
|
-
variant = 'default',
|
|
8
|
-
size = 'medium',
|
|
9
|
-
color = 'dark',
|
|
10
|
-
weight = 'regular',
|
|
11
|
-
align = 'left',
|
|
12
|
-
style: customStyle = {},
|
|
13
|
-
children,
|
|
14
|
-
...props
|
|
15
|
-
}) => (
|
|
16
|
-
<RNText
|
|
17
|
-
style={[
|
|
18
|
-
style[variant],
|
|
19
|
-
style[size],
|
|
20
|
-
style[color],
|
|
21
|
-
style[weight],
|
|
22
|
-
style[align],
|
|
23
|
-
{ ...customStyle },
|
|
24
|
-
]}
|
|
25
|
-
allowFontScaling={false}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</RNText>
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
Text.defaultProps = {
|
|
33
|
-
color: 'dark',
|
|
34
|
-
variant: 'default',
|
|
35
|
-
size: 'medium',
|
|
36
|
-
weight: 'regular',
|
|
37
|
-
align: 'left',
|
|
38
|
-
style: {},
|
|
39
|
-
children: ' ',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
Text.propTypes = {
|
|
43
|
-
color: PropTypes.oneOf([
|
|
44
|
-
'brightblue',
|
|
45
|
-
'brightviolet',
|
|
46
|
-
'dark',
|
|
47
|
-
'darkyellow',
|
|
48
|
-
'electricblue',
|
|
49
|
-
'gold',
|
|
50
|
-
'green',
|
|
51
|
-
'light',
|
|
52
|
-
'lighter',
|
|
53
|
-
'lightgold',
|
|
54
|
-
'midgreen',
|
|
55
|
-
'red',
|
|
56
|
-
'violet',
|
|
57
|
-
'white',
|
|
58
|
-
'yellow',
|
|
59
|
-
]),
|
|
60
|
-
variant: PropTypes.oneOf(['default', 'lowercase', 'uppercase']),
|
|
61
|
-
size: PropTypes.oneOf([
|
|
62
|
-
'tiny',
|
|
63
|
-
'small',
|
|
64
|
-
'medium',
|
|
65
|
-
'large',
|
|
66
|
-
'extra-large',
|
|
67
|
-
'huge',
|
|
68
|
-
]),
|
|
69
|
-
weight: PropTypes.oneOf(['regular', 'bold', 'semiBold']),
|
|
70
|
-
align: PropTypes.oneOf(['left', 'right', 'center', 'justify']),
|
|
71
|
-
style: PropTypes.any,
|
|
72
|
-
children: PropTypes.node,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export default Text;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useEffect,
|
|
4
|
-
useState,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
} from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { TouchableOpacity, View, Dimensions } from 'react-native';
|
|
9
|
-
import style from './style';
|
|
10
|
-
|
|
11
|
-
const { width } = Dimensions.get('window');
|
|
12
|
-
const BUTTON_WIDTH = width * 0.6;
|
|
13
|
-
|
|
14
|
-
const TimeOutButton = forwardRef(
|
|
15
|
-
({ onPress, time = 3000, warning, children }, ref) => {
|
|
16
|
-
const [elapsedTime, setElapsedTime] = useState(0);
|
|
17
|
-
const [interval, setLocalInterval] = useState();
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
let isCancelled = false;
|
|
21
|
-
try {
|
|
22
|
-
setLocalInterval(
|
|
23
|
-
setInterval(() => {
|
|
24
|
-
if (!isCancelled) {
|
|
25
|
-
setElapsedTime((elapsedTime) => elapsedTime + 1);
|
|
26
|
-
}
|
|
27
|
-
}, 1)
|
|
28
|
-
);
|
|
29
|
-
} catch (e) {
|
|
30
|
-
if (!isCancelled) {
|
|
31
|
-
throw e;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return () => {
|
|
36
|
-
clearInterval(interval);
|
|
37
|
-
isCancelled = true;
|
|
38
|
-
};
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
useImperativeHandle(ref, () => ({
|
|
42
|
-
onStop() {
|
|
43
|
-
clearInterval(interval);
|
|
44
|
-
},
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
const watchInterval = () => {
|
|
48
|
-
if (elapsedTime >= time) {
|
|
49
|
-
clearInterval(interval);
|
|
50
|
-
onPress();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return elapsedTime <= time
|
|
54
|
-
? (BUTTON_WIDTH * (time - elapsedTime)) / time
|
|
55
|
-
: BUTTON_WIDTH;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const checkWarningPercent = () => {
|
|
59
|
-
return elapsedTime <= time ? time * 0.3 > time - elapsedTime : false;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const onLocalPress = () => {
|
|
63
|
-
setElapsedTime(time);
|
|
64
|
-
clearInterval(interval);
|
|
65
|
-
onPress();
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<TouchableOpacity
|
|
70
|
-
style={[style.button, style.buttonBg]}
|
|
71
|
-
onPress={onLocalPress}
|
|
72
|
-
>
|
|
73
|
-
<View
|
|
74
|
-
style={[
|
|
75
|
-
style.button,
|
|
76
|
-
warning
|
|
77
|
-
? checkWarningPercent()
|
|
78
|
-
? style.buttonOverlayWarning
|
|
79
|
-
: style.buttonOverlay
|
|
80
|
-
: style.buttonOverlay,
|
|
81
|
-
{ width: watchInterval() },
|
|
82
|
-
]}
|
|
83
|
-
/>
|
|
84
|
-
{children}
|
|
85
|
-
</TouchableOpacity>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
TimeOutButton.defaultProps = {
|
|
91
|
-
children: null,
|
|
92
|
-
time: 3000,
|
|
93
|
-
warning: false,
|
|
94
|
-
onPress: () => {},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
TimeOutButton.propTypes = {
|
|
98
|
-
children: PropTypes.node,
|
|
99
|
-
time: PropTypes.number,
|
|
100
|
-
warning: PropTypes.bool,
|
|
101
|
-
onPress: PropTypes.func,
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export default TimeOutButton;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { View, TouchableOpacity } from 'react-native';
|
|
4
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
5
|
-
import Text from '../Text';
|
|
6
|
-
import style from './style';
|
|
7
|
-
|
|
8
|
-
const keys = [
|
|
9
|
-
{
|
|
10
|
-
key: <Text size='extra-large'>1</Text>,
|
|
11
|
-
value: 1,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
key: <Text size='extra-large'>2</Text>,
|
|
15
|
-
value: 2,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
key: <Text size='extra-large'>3</Text>,
|
|
19
|
-
value: 3,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
key: <Text size='extra-large'>4</Text>,
|
|
23
|
-
value: 4,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
key: <Text size='extra-large'>5</Text>,
|
|
27
|
-
value: 5,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
key: <Text size='extra-large'>6</Text>,
|
|
31
|
-
value: 6,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: <Text size='extra-large'>7</Text>,
|
|
35
|
-
value: 7,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
key: <Text size='extra-large'>8</Text>,
|
|
39
|
-
value: 8,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
key: <Text size='extra-large'>9</Text>,
|
|
43
|
-
value: 9,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
key: <Ionicons name='finger-print-outline' style={style.icon} />,
|
|
47
|
-
value: 'biometrics',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
key: <Text size='extra-large'>0</Text>,
|
|
51
|
-
value: 0,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
key: <Ionicons name='backspace-outline' style={style.icon} />,
|
|
55
|
-
value: 'back',
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
const VirtualKeyboard = ({ onPress, hideBiometrics }) => (
|
|
60
|
-
<View style={style.container}>
|
|
61
|
-
{keys.map(({ key, value }) => (
|
|
62
|
-
<TouchableOpacity
|
|
63
|
-
key={`key-${value}`}
|
|
64
|
-
style={style.button}
|
|
65
|
-
onPress={() =>
|
|
66
|
-
onPress(value === 'biometrics' && hideBiometrics ? null : value)
|
|
67
|
-
}
|
|
68
|
-
disabled={value === 'biometrics' && hideBiometrics}
|
|
69
|
-
>
|
|
70
|
-
{value === 'biometrics' && hideBiometrics ? <Text> </Text> : key}
|
|
71
|
-
</TouchableOpacity>
|
|
72
|
-
))}
|
|
73
|
-
</View>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
VirtualKeyboard.defaultProps = {
|
|
77
|
-
onPress: () => {},
|
|
78
|
-
hideBiometrics: false,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
VirtualKeyboard.propTypes = {
|
|
82
|
-
onPress: PropTypes.func,
|
|
83
|
-
hideBiometrics: PropTypes.bool,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default VirtualKeyboard;
|
package/lib/components/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export { default as Button } from "./Button";
|
|
2
|
-
export { default as Card } from "./Card";
|
|
3
|
-
export { default as ConfirmationModal } from "./ConfirmationModal";
|
|
4
|
-
export { default as Container } from "./Container";
|
|
5
|
-
export { default as DeckSwiper } from "./DeckSwiper";
|
|
6
|
-
export { default as FlashMessage, sendMessage } from "./FlashMessage";
|
|
7
|
-
export { default as FloatingContainer } from "./FloatingContainer";
|
|
8
|
-
export { default as Footer } from "./Footer";
|
|
9
|
-
export { default as Header } from "./Header";
|
|
10
|
-
export { default as ImagePicker } from "./ImagePicker";
|
|
11
|
-
export { default as ImageResponsive } from "./ImageResponsive";
|
|
12
|
-
export { default as ImageViewer } from "./ImageViewer";
|
|
13
|
-
export { default as Input } from "./Input";
|
|
14
|
-
export { default as InputPin } from "./InputPin";
|
|
15
|
-
export { default as MenuItem } from "./MenuItem";
|
|
16
|
-
export { default as NavigationTitle } from "./NavigationTitle";
|
|
17
|
-
export { default as Notification } from "./Notification";
|
|
18
|
-
export { default as Select } from "./Select";
|
|
19
|
-
export { default as SwipeablePanel } from "./SwipeablePanel";
|
|
20
|
-
export { default as Switch } from "./Switch";
|
|
21
|
-
export { default as TakePicture } from "./TakePicture";
|
|
22
|
-
export { default as Text } from "./Text";
|
|
23
|
-
export { default as Textarea } from "./Textarea";
|
|
24
|
-
export { default as TimeOutButton } from "./TimeOutButton";
|
|
25
|
-
export { default as UploadDocument } from "./UploadDocument";
|
|
26
|
-
export { default as VirtualKeyboard } from "./VirtualKeyboard";
|
|
27
|
-
export { default as withPreventDoubleClick } from "./PreventDoubleClick";
|
|
28
|
-
export { default as CustomChatView } from "./CustomChatView";
|
package/lib/configs/loadFonts.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as Font from 'expo-font';
|
|
2
|
-
|
|
3
|
-
export const asyncLoadFont = Font.loadAsync({
|
|
4
|
-
poppins_bold: require('../assets/fonts/Poppins-Bold.ttf'),
|
|
5
|
-
poppins_regular: require('../assets/fonts/Poppins-Regular.ttf'),
|
|
6
|
-
poppins_semiBold: require('../assets/fonts/Poppins-SemiBold.ttf')
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const loadFonts = [
|
|
10
|
-
asyncLoadFont
|
|
11
|
-
];
|
package/lib/hooks/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as useDebounce } from './useDebounce';
|