@holper/react-native-holper-storybook 0.7.1 → 0.8.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/index.js +2 -3
- package/lib/components/Button/index.js +104 -0
- package/lib/components/Button/{style.ts → style.js} +7 -8
- package/lib/components/Card/index.js +49 -0
- package/lib/components/Card/{style.ts → style.js} +4 -5
- package/lib/components/ConfirmationModal/{index.tsx → index.js} +79 -25
- package/lib/components/ConfirmationModal/{style.tsx → style.js} +13 -14
- package/lib/components/Container/{index.tsx → index.js} +28 -7
- package/lib/components/Container/{style.ts → style.js} +5 -6
- package/lib/components/CustomChatView/{index.tsx → index.js} +30 -22
- package/lib/components/CustomChatView/{style.ts → style.js} +1 -1
- package/lib/components/DeckSwiper/index.js +118 -0
- package/lib/components/DeckSwiper/{style.ts → style.js} +12 -13
- package/lib/components/FlashMessage/index.js +83 -0
- package/lib/components/FloatingContainer/index.js +69 -0
- package/lib/components/FloatingContainer/{style.ts → style.js} +6 -7
- package/lib/components/Footer/index.js +61 -0
- package/lib/components/Footer/{style.ts → style.js} +3 -4
- package/lib/components/Header/index.js +45 -0
- package/lib/components/Header/{style.ts → style.js} +3 -4
- package/lib/components/ImagePicker/{index.tsx → index.js} +12 -3
- package/lib/components/ImageResponsive/index.js +39 -0
- package/lib/components/ImageResponsive/style.js +7 -0
- package/lib/components/ImageViewer/index.js +62 -0
- package/lib/components/ImageViewer/{style.ts → style.js} +3 -4
- package/lib/components/Input/{index.tsx → index.js} +33 -6
- package/lib/components/Input/{style.ts → style.js} +18 -7
- package/lib/components/InputPin/{index.tsx → index.js} +13 -6
- package/lib/components/InputPin/{style.ts → style.js} +6 -7
- package/lib/components/MenuItem/index.js +44 -0
- package/lib/components/MenuItem/{style.ts → style.js} +7 -9
- package/lib/components/NavigationTitle/{index.tsx → index.js} +30 -9
- package/lib/components/NavigationTitle/{style.ts → style.js} +11 -12
- package/lib/components/Notification/index.js +80 -0
- package/lib/components/Notification/{style.ts → style.js} +11 -13
- package/lib/components/PreventDoubleClick/index.js +21 -0
- package/lib/components/Select/index.js +89 -0
- package/lib/components/Select/style.js +81 -0
- package/lib/components/SwipeablePanel/{index.tsx → index.js} +85 -58
- package/lib/components/SwipeablePanel/{style.ts → style.js} +14 -15
- package/lib/components/Switch/index.js +57 -0
- package/lib/components/TakePicture/{confirmPictureModal.tsx → confirmPictureModal.js} +33 -9
- package/lib/components/TakePicture/index.js +198 -0
- package/lib/components/TakePicture/{style.ts → style.js} +4 -4
- package/lib/components/Text/index.js +75 -0
- package/lib/components/Text/{style.ts → style.js} +2 -4
- package/lib/components/Textarea/{index.tsx → index.js} +24 -5
- package/lib/components/Textarea/{style.ts → style.js} +4 -5
- package/lib/components/TimeOutButton/index.js +104 -0
- package/lib/components/TimeOutButton/{style.ts → style.js} +3 -4
- package/lib/components/UploadDocument/index.js +222 -0
- package/lib/components/UploadDocument/{style.ts → style.js} +15 -16
- package/lib/components/VirtualKeyboard/index.js +86 -0
- package/lib/components/VirtualKeyboard/{style.ts → style.js} +8 -9
- package/lib/components/index.js +28 -0
- package/lib/configs/constants.js +276 -0
- package/lib/configs/loadFonts.js +11 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/{useDebounce.tsx → useDebounce.js} +4 -6
- package/lib/index.js +2 -3
- package/package.json +58 -72
- package/{README.md → readme.md} +20 -19
- package/LICENSE +0 -21
- package/lib/components/Button/index.tsx +0 -66
- package/lib/components/Card/index.tsx +0 -33
- package/lib/components/DeckSwiper/index.tsx +0 -90
- package/lib/components/DonutCountdown/index.tsx +0 -86
- package/lib/components/DonutCountdown/style.ts +0 -8
- package/lib/components/FloatingContainer/index.tsx +0 -35
- package/lib/components/Footer/index.tsx +0 -35
- package/lib/components/Header/index.tsx +0 -21
- package/lib/components/ImageResponsive/index.tsx +0 -24
- package/lib/components/ImageResponsive/style.ts +0 -9
- package/lib/components/ImageViewer/index.tsx +0 -36
- package/lib/components/MenuItem/index.tsx +0 -25
- package/lib/components/Notification/index.tsx +0 -44
- package/lib/components/PreventDoubleClick/index.tsx +0 -28
- package/lib/components/Select/index.tsx +0 -51
- package/lib/components/Select/style.ts +0 -64
- package/lib/components/Switch/index.tsx +0 -30
- package/lib/components/TakePicture/index.tsx +0 -148
- package/lib/components/Text/index.tsx +0 -33
- package/lib/components/TimeOutButton/index.tsx +0 -67
- package/lib/components/Toast/index.tsx +0 -34
- package/lib/components/Toast/style.ts +0 -12
- package/lib/components/UploadDocument/index.tsx +0 -179
- package/lib/components/VirtualKeyboard/index.tsx +0 -75
- package/lib/components/index.ts +0 -29
- package/lib/configs/constants.ts +0 -273
- package/lib/configs/types.ts +0 -326
- package/lib/hooks/index.ts +0 -2
- package/lib/hooks/useLoadFonts.tsx +0 -13
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { StyleSheet, Dimensions } from 'react-native';
|
|
3
2
|
import { Colors } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
cameraContainer: {
|
|
9
8
|
flex: 1,
|
|
10
9
|
...StyleSheet.absoluteFillObject,
|
|
@@ -26,6 +25,7 @@ export default StyleSheet.create({
|
|
|
26
25
|
flex: 1,
|
|
27
26
|
backgroundColor: Colors.transparent,
|
|
28
27
|
flexDirection: 'row',
|
|
28
|
+
position: 'relative',
|
|
29
29
|
marginBottom: 20,
|
|
30
30
|
...StyleSheet.absoluteFillObject,
|
|
31
31
|
},
|
|
@@ -92,4 +92,4 @@ export default StyleSheet.create({
|
|
|
92
92
|
justifyContent: 'center',
|
|
93
93
|
alignItems: 'center',
|
|
94
94
|
},
|
|
95
|
-
}
|
|
95
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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,8 +1,6 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
1
|
import { Colors } from '../../configs/constants';
|
|
4
2
|
|
|
5
|
-
export default
|
|
3
|
+
export default {
|
|
6
4
|
// colors
|
|
7
5
|
dark: {
|
|
8
6
|
color: Colors.darkblue,
|
|
@@ -98,4 +96,4 @@ export default StyleSheet.create({
|
|
|
98
96
|
justify: {
|
|
99
97
|
textAlign: 'justify',
|
|
100
98
|
},
|
|
101
|
-
}
|
|
99
|
+
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
1
3
|
import { TextInput } from 'react-native';
|
|
2
|
-
|
|
3
4
|
import { Colors } from '../../configs/constants';
|
|
4
5
|
import style from './style';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const Textarea = ({
|
|
8
|
+
variant = 'default',
|
|
9
|
+
disabled,
|
|
10
|
+
numberOfLines = 4,
|
|
11
|
+
fitToContainer,
|
|
12
|
+
...props
|
|
13
|
+
}) => (
|
|
9
14
|
<TextInput
|
|
10
15
|
style={[
|
|
11
16
|
style.textarea,
|
|
@@ -17,10 +22,24 @@ const Textarea = ({ variant = 'default', disabled, numberOfLines = 4, fitToConta
|
|
|
17
22
|
multiline
|
|
18
23
|
editable={!disabled}
|
|
19
24
|
numberOfLines={numberOfLines}
|
|
20
|
-
textAlignVertical=
|
|
25
|
+
textAlignVertical='top'
|
|
21
26
|
placeholderTextColor={Colors.midblue}
|
|
22
27
|
{...props}
|
|
23
28
|
/>
|
|
24
29
|
);
|
|
25
30
|
|
|
31
|
+
Textarea.defaultProps = {
|
|
32
|
+
variant: 'default',
|
|
33
|
+
disabled: false,
|
|
34
|
+
fitToContainer: false,
|
|
35
|
+
numberOfLines: 4,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
Textarea.propTypes = {
|
|
39
|
+
variant: PropTypes.oneOf(['default', 'completed', 'error']),
|
|
40
|
+
disabled: PropTypes.bool,
|
|
41
|
+
fitToContainer: PropTypes.bool,
|
|
42
|
+
numberOfLines: PropTypes.number,
|
|
43
|
+
};
|
|
44
|
+
|
|
26
45
|
export default Textarea;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Dimensions
|
|
2
|
-
|
|
3
|
-
import { borderRadius, Colors } from '../../configs/constants';
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
2
|
+
import { Colors, borderRadius } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
textarea: {
|
|
9
8
|
borderRadius,
|
|
10
9
|
borderWidth: 1,
|
|
@@ -35,4 +34,4 @@ export default StyleSheet.create({
|
|
|
35
34
|
disabled: {
|
|
36
35
|
opacity: 0.5,
|
|
37
36
|
},
|
|
38
|
-
}
|
|
37
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
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,10 +1,9 @@
|
|
|
1
|
-
import { Dimensions
|
|
2
|
-
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
3
2
|
import { Colors } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
// Default button shape
|
|
9
8
|
button: {
|
|
10
9
|
margin: 8,
|
|
@@ -39,4 +38,4 @@ export default StyleSheet.create({
|
|
|
39
38
|
left: -10,
|
|
40
39
|
backgroundColor: Colors.red,
|
|
41
40
|
},
|
|
42
|
-
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { View, TouchableOpacity, ActivityIndicator } from "react-native";
|
|
4
|
+
import * as ExpoImagePicker from "expo-image-picker";
|
|
5
|
+
import Text from "../Text";
|
|
6
|
+
import Button from "../Button";
|
|
7
|
+
import ConfirmationModal from "../ConfirmationModal";
|
|
8
|
+
import ImagePicker from "../ImagePicker";
|
|
9
|
+
import ImageViewer from "../ImageViewer";
|
|
10
|
+
import TakePicture from "../TakePicture";
|
|
11
|
+
import { Colors } from "../../configs/constants";
|
|
12
|
+
import style from "./style";
|
|
13
|
+
|
|
14
|
+
const UploadDocument = ({
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
icon,
|
|
18
|
+
completed,
|
|
19
|
+
isAvatarPicker,
|
|
20
|
+
uploadButtonText,
|
|
21
|
+
reUploadButtonText,
|
|
22
|
+
mediaModal,
|
|
23
|
+
takePicture,
|
|
24
|
+
inverted,
|
|
25
|
+
onSelectImage,
|
|
26
|
+
file,
|
|
27
|
+
onPermissionDenied,
|
|
28
|
+
}) => {
|
|
29
|
+
const [showMediaModal, setShowMediaModal] = useState(false);
|
|
30
|
+
const [showCamera, setShowCamera] = useState(false);
|
|
31
|
+
const [image, setImage] = useState(null);
|
|
32
|
+
const [loading, setLoading] = useState(true);
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
(async () => await ExpoImagePicker.requestMediaLibraryPermissionsAsync())();
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!image) {
|
|
40
|
+
setImage(file);
|
|
41
|
+
}
|
|
42
|
+
}, [file]);
|
|
43
|
+
|
|
44
|
+
const pickUploadMethod = async (method) => {
|
|
45
|
+
setShowMediaModal(false);
|
|
46
|
+
|
|
47
|
+
switch (method) {
|
|
48
|
+
case "camera":
|
|
49
|
+
setTimeout(async () => {
|
|
50
|
+
setShowCamera(true);
|
|
51
|
+
}, 500);
|
|
52
|
+
break;
|
|
53
|
+
case "gallery":
|
|
54
|
+
setTimeout(async () => {
|
|
55
|
+
const { granted } =
|
|
56
|
+
await ExpoImagePicker.requestMediaLibraryPermissionsAsync();
|
|
57
|
+
|
|
58
|
+
if (!granted) {
|
|
59
|
+
onPermissionDenied();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const image = await ImagePicker(isAvatarPicker);
|
|
64
|
+
selectImage(image);
|
|
65
|
+
}, 500);
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const selectImage = (image) => {
|
|
73
|
+
setImage(image);
|
|
74
|
+
onSelectImage(image);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View style={[style.container, completed ? style.containerCompleted : {}]}>
|
|
79
|
+
{image ? (
|
|
80
|
+
<View style={style.uploadedContainer}>
|
|
81
|
+
<View>
|
|
82
|
+
<ImageViewer
|
|
83
|
+
source={{
|
|
84
|
+
uri: typeof image === "object" ? image.uri : image,
|
|
85
|
+
}}
|
|
86
|
+
style={style.image}
|
|
87
|
+
resizeMode="cover"
|
|
88
|
+
avatar
|
|
89
|
+
onLoadEnd={() => setLoading(false)}
|
|
90
|
+
/>
|
|
91
|
+
{loading && (
|
|
92
|
+
<ActivityIndicator
|
|
93
|
+
style={style.imageSpinner}
|
|
94
|
+
animating={loading}
|
|
95
|
+
color={Colors.darkblue}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
</View>
|
|
99
|
+
<View style={style.reUploadButtons}>
|
|
100
|
+
<Text
|
|
101
|
+
style={style.titleUploaded}
|
|
102
|
+
numberOfLines={1}
|
|
103
|
+
ellipsizeMode="tail"
|
|
104
|
+
>
|
|
105
|
+
{title}
|
|
106
|
+
</Text>
|
|
107
|
+
<TouchableOpacity onPress={() => setShowMediaModal(true)}>
|
|
108
|
+
<Text size="tiny" style={style.reUpload}>
|
|
109
|
+
{reUploadButtonText}
|
|
110
|
+
</Text>
|
|
111
|
+
</TouchableOpacity>
|
|
112
|
+
</View>
|
|
113
|
+
</View>
|
|
114
|
+
) : (
|
|
115
|
+
<View style={style.noUploaded}>
|
|
116
|
+
{icon}
|
|
117
|
+
<Text
|
|
118
|
+
size="large"
|
|
119
|
+
style={style.title}
|
|
120
|
+
numberOfLines={1}
|
|
121
|
+
ellipsizeMode="tail"
|
|
122
|
+
>
|
|
123
|
+
{title}
|
|
124
|
+
</Text>
|
|
125
|
+
<Text size="small" style={style.description}>
|
|
126
|
+
{description}
|
|
127
|
+
</Text>
|
|
128
|
+
<Button variant="dim" onPress={() => setShowMediaModal(true)}>
|
|
129
|
+
<Text>{uploadButtonText}</Text>
|
|
130
|
+
</Button>
|
|
131
|
+
</View>
|
|
132
|
+
)}
|
|
133
|
+
|
|
134
|
+
<ConfirmationModal
|
|
135
|
+
visible={showMediaModal}
|
|
136
|
+
inverted={inverted}
|
|
137
|
+
title={mediaModal.title}
|
|
138
|
+
onConfirm={() => pickUploadMethod("camera")}
|
|
139
|
+
confirmText={mediaModal.confirmText}
|
|
140
|
+
onCancel={() => pickUploadMethod("gallery")}
|
|
141
|
+
cancelText={mediaModal.cancelText}
|
|
142
|
+
onClose={() => setShowMediaModal(false)}
|
|
143
|
+
>
|
|
144
|
+
<Text>{mediaModal.description}</Text>
|
|
145
|
+
</ConfirmationModal>
|
|
146
|
+
|
|
147
|
+
<TakePicture
|
|
148
|
+
visible={showCamera}
|
|
149
|
+
cameraErrorMessage={takePicture.cameraErrorMessage}
|
|
150
|
+
requestPermissionsMessage={takePicture.requestPermissionsMessage}
|
|
151
|
+
processingPictureMessage={takePicture.processingPictureMessage}
|
|
152
|
+
repeatPictureText={takePicture.repeatPictureText}
|
|
153
|
+
usePictureText={takePicture.usePictureText}
|
|
154
|
+
avatar={isAvatarPicker}
|
|
155
|
+
onClose={(selectedImage) => {
|
|
156
|
+
if (selectedImage) {
|
|
157
|
+
selectImage(selectedImage);
|
|
158
|
+
}
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
setShowCamera(false);
|
|
161
|
+
}, 0);
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
</View>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
UploadDocument.defaultProps = {
|
|
169
|
+
title: " ",
|
|
170
|
+
description: " ",
|
|
171
|
+
uploadButtonText: " ",
|
|
172
|
+
reUploadButtonText: " ",
|
|
173
|
+
completed: false,
|
|
174
|
+
inverted: false,
|
|
175
|
+
isAvatarPicker: false,
|
|
176
|
+
icon: null,
|
|
177
|
+
onSelectImage: () => {},
|
|
178
|
+
file: null,
|
|
179
|
+
onPermissionDenied: () => {},
|
|
180
|
+
mediaModal: {
|
|
181
|
+
title: " ",
|
|
182
|
+
confirmText: " ",
|
|
183
|
+
cancelText: " ",
|
|
184
|
+
description: " ",
|
|
185
|
+
},
|
|
186
|
+
takePicture: {
|
|
187
|
+
cameraErrorMessage: " ",
|
|
188
|
+
requestPermissionsMessage: " ",
|
|
189
|
+
processingPictureMessage: " ",
|
|
190
|
+
repeatPictureText: " ",
|
|
191
|
+
usePictureText: " ",
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
UploadDocument.propTypes = {
|
|
196
|
+
title: PropTypes.string,
|
|
197
|
+
description: PropTypes.string,
|
|
198
|
+
uploadButtonText: PropTypes.string,
|
|
199
|
+
reUploadButtonText: PropTypes.string,
|
|
200
|
+
completed: PropTypes.bool,
|
|
201
|
+
inverted: PropTypes.bool,
|
|
202
|
+
isAvatarPicker: PropTypes.bool,
|
|
203
|
+
icon: PropTypes.node,
|
|
204
|
+
onSelectImage: PropTypes.func,
|
|
205
|
+
file: PropTypes.string,
|
|
206
|
+
onPermissionDenied: PropTypes.func,
|
|
207
|
+
mediaModal: PropTypes.shape({
|
|
208
|
+
title: PropTypes.string,
|
|
209
|
+
confirmText: PropTypes.string,
|
|
210
|
+
cancelText: PropTypes.string,
|
|
211
|
+
description: PropTypes.string,
|
|
212
|
+
}),
|
|
213
|
+
takePicture: PropTypes.shape({
|
|
214
|
+
cameraErrorMessage: PropTypes.string,
|
|
215
|
+
requestPermissionsMessage: PropTypes.string,
|
|
216
|
+
processingPictureMessage: PropTypes.string,
|
|
217
|
+
repeatPictureText: PropTypes.string,
|
|
218
|
+
usePictureText: PropTypes.string,
|
|
219
|
+
}),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export default UploadDocument;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Dimensions
|
|
2
|
-
|
|
1
|
+
import { Dimensions } from 'react-native';
|
|
3
2
|
import { Colors } from '../../configs/constants';
|
|
4
3
|
|
|
5
4
|
const { width } = Dimensions.get('window');
|
|
6
5
|
|
|
7
|
-
export default
|
|
6
|
+
export default {
|
|
8
7
|
container: {
|
|
9
8
|
borderWidth: 1,
|
|
10
9
|
borderColor: Colors.dimgray,
|
|
@@ -12,46 +11,46 @@ export default StyleSheet.create({
|
|
|
12
11
|
width: width - 80,
|
|
13
12
|
padding: 15,
|
|
14
13
|
justifyContent: 'center',
|
|
15
|
-
overflow: 'hidden'
|
|
14
|
+
overflow: 'hidden'
|
|
16
15
|
},
|
|
17
16
|
containerCompleted: {
|
|
18
|
-
borderColor: Colors.green
|
|
17
|
+
borderColor: Colors.green
|
|
19
18
|
},
|
|
20
19
|
noUploaded: {
|
|
21
|
-
alignItems: 'center'
|
|
20
|
+
alignItems: 'center'
|
|
22
21
|
},
|
|
23
22
|
title: {
|
|
24
|
-
marginTop: 5
|
|
23
|
+
marginTop: 5
|
|
25
24
|
},
|
|
26
25
|
titleUploaded: {
|
|
27
26
|
marginTop: 5,
|
|
28
|
-
width: width - 225
|
|
27
|
+
width: width - 225
|
|
29
28
|
},
|
|
30
29
|
description: {
|
|
31
|
-
marginBottom: 20
|
|
30
|
+
marginBottom: 20
|
|
32
31
|
},
|
|
33
32
|
uploadedContainer: {
|
|
34
33
|
flexDirection: 'row',
|
|
35
34
|
alignItems: 'center',
|
|
36
|
-
justifyContent: 'flex-start'
|
|
35
|
+
justifyContent: 'flex-start'
|
|
37
36
|
},
|
|
38
37
|
image: {
|
|
39
38
|
width: 100,
|
|
40
39
|
height: 100,
|
|
41
40
|
borderColor: Colors.dimgray,
|
|
42
|
-
borderWidth: 1
|
|
41
|
+
borderWidth: 1
|
|
43
42
|
},
|
|
44
43
|
imageSpinner: {
|
|
45
44
|
position: 'absolute',
|
|
46
45
|
left: 0,
|
|
47
46
|
right: 0,
|
|
48
47
|
top: 0,
|
|
49
|
-
bottom: 0
|
|
48
|
+
bottom: 0
|
|
50
49
|
},
|
|
51
50
|
reUpload: {
|
|
52
|
-
textDecorationLine: 'underline'
|
|
51
|
+
textDecorationLine: 'underline'
|
|
53
52
|
},
|
|
54
53
|
reUploadButtons: {
|
|
55
|
-
marginLeft: 15
|
|
56
|
-
}
|
|
57
|
-
}
|
|
54
|
+
marginLeft: 15
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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;
|