@holper/react-native-holper-storybook 0.6.96 → 0.6.97
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/lib/components/Button/index.js +2 -2
- package/lib/components/Input/index.js +3 -3
- package/lib/components/InputPin/index.js +6 -4
- package/lib/components/NavigationTitle/index.js +26 -13
- package/lib/components/Notification/index.js +31 -11
- package/lib/components/Select/index.js +13 -13
- package/lib/components/SwipeablePanel/index.js +49 -45
- package/lib/components/Switch/index.js +27 -13
- package/lib/components/Text/index.js +6 -6
- package/lib/components/Textarea/index.js +2 -2
- package/lib/components/TimeOutButton/index.js +1 -1
- package/lib/components/VirtualKeyboard/index.js +57 -42
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ import style from './style';
|
|
|
5
5
|
import { Colors } from '../../configs/constants';
|
|
6
6
|
|
|
7
7
|
const Input = ({
|
|
8
|
-
variant,
|
|
9
|
-
size,
|
|
8
|
+
variant = 'default',
|
|
9
|
+
size = 'fixed',
|
|
10
10
|
disabled,
|
|
11
11
|
leftIcon,
|
|
12
12
|
leftIconWide,
|
|
@@ -15,7 +15,7 @@ const Input = ({
|
|
|
15
15
|
count,
|
|
16
16
|
rightIcon,
|
|
17
17
|
value,
|
|
18
|
-
maxLength,
|
|
18
|
+
maxLength = 100,
|
|
19
19
|
...props
|
|
20
20
|
}) => (
|
|
21
21
|
<View style={style.container}>
|
|
@@ -5,22 +5,24 @@ import { times } from 'lodash';
|
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import style from './style';
|
|
7
7
|
|
|
8
|
-
const InputPin = ({values}) => (
|
|
8
|
+
const InputPin = ({ values = [] }) => (
|
|
9
9
|
<View style={style.container}>
|
|
10
10
|
{times(4, (index) => (
|
|
11
11
|
<View style={style.input} key={`value-${index}`}>
|
|
12
|
-
<Text size='large' weight='semiBold'>
|
|
12
|
+
<Text size='large' weight='semiBold'>
|
|
13
|
+
{values[index]}
|
|
14
|
+
</Text>
|
|
13
15
|
</View>
|
|
14
16
|
))}
|
|
15
17
|
</View>
|
|
16
18
|
);
|
|
17
19
|
|
|
18
20
|
InputPin.defaultProps = {
|
|
19
|
-
values: []
|
|
21
|
+
values: [],
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
InputPin.propTypes = {
|
|
23
|
-
values: PropTypes.arrayOf(PropTypes.number)
|
|
25
|
+
values: PropTypes.arrayOf(PropTypes.number),
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
export default InputPin;
|
|
@@ -6,27 +6,40 @@ import Text from '../Text';
|
|
|
6
6
|
import { Colors } from '../../configs/constants';
|
|
7
7
|
import style from './style';
|
|
8
8
|
|
|
9
|
-
const NavigationTitle = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const NavigationTitle = ({
|
|
10
|
+
type = 'close',
|
|
11
|
+
title,
|
|
12
|
+
noShadow,
|
|
13
|
+
xlarge,
|
|
14
|
+
blockNavigation,
|
|
15
|
+
onPress,
|
|
16
|
+
}) => (
|
|
17
|
+
<View
|
|
18
|
+
style={[
|
|
19
|
+
style.container,
|
|
20
|
+
type === 'close' ? style.containerClose : style.containerBack,
|
|
21
|
+
noShadow ? style.noShadow : {},
|
|
22
|
+
]}
|
|
23
|
+
>
|
|
15
24
|
{!blockNavigation && (
|
|
16
25
|
<>
|
|
17
26
|
{type === 'back' && (
|
|
18
27
|
<TouchableOpacity onPress={onPress} style={style.buttonBack}>
|
|
19
|
-
<Ionicons
|
|
28
|
+
<Ionicons
|
|
29
|
+
name='arrow-back-outline'
|
|
30
|
+
size={20}
|
|
31
|
+
color={Colors.darkblue}
|
|
32
|
+
/>
|
|
20
33
|
</TouchableOpacity>
|
|
21
34
|
)}
|
|
22
35
|
</>
|
|
23
36
|
)}
|
|
24
37
|
{typeof title === 'string' ? (
|
|
25
|
-
<Text size={xlarge ? 'extra-large' : 'large'} weight='semiBold'>
|
|
26
|
-
) : (
|
|
27
|
-
<>
|
|
38
|
+
<Text size={xlarge ? 'extra-large' : 'large'} weight='semiBold'>
|
|
28
39
|
{title}
|
|
29
|
-
|
|
40
|
+
</Text>
|
|
41
|
+
) : (
|
|
42
|
+
<>{title}</>
|
|
30
43
|
)}
|
|
31
44
|
{!blockNavigation && (
|
|
32
45
|
<>
|
|
@@ -46,7 +59,7 @@ NavigationTitle.defaultProps = {
|
|
|
46
59
|
noShadow: false,
|
|
47
60
|
xlarge: false,
|
|
48
61
|
blockNavigation: false,
|
|
49
|
-
onPress: () => {}
|
|
62
|
+
onPress: () => {},
|
|
50
63
|
};
|
|
51
64
|
|
|
52
65
|
NavigationTitle.propTypes = {
|
|
@@ -55,7 +68,7 @@ NavigationTitle.propTypes = {
|
|
|
55
68
|
noShadow: PropTypes.bool,
|
|
56
69
|
xlarge: PropTypes.bool,
|
|
57
70
|
blockNavigation: PropTypes.bool,
|
|
58
|
-
onPress: PropTypes.func
|
|
71
|
+
onPress: PropTypes.func,
|
|
59
72
|
};
|
|
60
73
|
|
|
61
74
|
export default NavigationTitle;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
4
|
-
import {ImagePropTypes} from 'deprecated-react-native-prop-types';
|
|
4
|
+
import { ImagePropTypes } from 'deprecated-react-native-prop-types';
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import ImageResponsive from '../ImageResponsive';
|
|
7
7
|
import { Colors } from '../../configs/constants';
|
|
@@ -9,32 +9,52 @@ import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
|
9
9
|
import moment from 'moment';
|
|
10
10
|
import style from './style';
|
|
11
11
|
|
|
12
|
-
const Notification = ({
|
|
13
|
-
|
|
12
|
+
const Notification = ({
|
|
13
|
+
first,
|
|
14
|
+
active,
|
|
15
|
+
hideAvatar,
|
|
16
|
+
avatar,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
date = moment().fromNow(),
|
|
20
|
+
onPress,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
14
23
|
<TouchableOpacity
|
|
15
24
|
style={[
|
|
16
25
|
style.container,
|
|
17
26
|
first ? style.first : {},
|
|
18
|
-
active ? style.active : {}
|
|
27
|
+
active ? style.active : {},
|
|
19
28
|
]}
|
|
20
29
|
onPress={onPress}
|
|
21
30
|
>
|
|
22
|
-
{!hideAvatar &&
|
|
31
|
+
{!hideAvatar && (
|
|
32
|
+
<ImageResponsive source={avatar} avatar style={style.avatar} />
|
|
33
|
+
)}
|
|
23
34
|
<View style={style.textContainer}>
|
|
24
35
|
<View style={style.text}>
|
|
25
36
|
<View style={style.textInner}>
|
|
26
37
|
<Text weight='semiBold'>{title}</Text>
|
|
27
|
-
{active &&
|
|
38
|
+
{active && (
|
|
39
|
+
<Ionicons
|
|
40
|
+
name='ellipse'
|
|
41
|
+
color={Colors.green}
|
|
42
|
+
size={12}
|
|
43
|
+
style={style.icon}
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
28
46
|
</View>
|
|
29
|
-
<Text color='light' size='tiny' style={style.time}>
|
|
47
|
+
<Text color='light' size='tiny' style={style.time}>
|
|
48
|
+
{moment(date).fromNow()}
|
|
49
|
+
</Text>
|
|
30
50
|
</View>
|
|
31
51
|
<Text color='light' size='small' ellipsizeMode='tail' numberOfLines={3}>
|
|
32
52
|
{description}
|
|
33
53
|
</Text>
|
|
34
54
|
</View>
|
|
35
55
|
</TouchableOpacity>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
38
58
|
|
|
39
59
|
Notification.defaultProps = {
|
|
40
60
|
first: false,
|
|
@@ -44,7 +64,7 @@ Notification.defaultProps = {
|
|
|
44
64
|
title: '',
|
|
45
65
|
description: '',
|
|
46
66
|
date: moment().fromNow(),
|
|
47
|
-
onPress: () => {}
|
|
67
|
+
onPress: () => {},
|
|
48
68
|
};
|
|
49
69
|
|
|
50
70
|
Notification.propTypes = {
|
|
@@ -55,7 +75,7 @@ Notification.propTypes = {
|
|
|
55
75
|
title: PropTypes.string,
|
|
56
76
|
description: PropTypes.string,
|
|
57
77
|
date: PropTypes.instanceOf(moment),
|
|
58
|
-
onPress: PropTypes.func
|
|
78
|
+
onPress: PropTypes.func,
|
|
59
79
|
};
|
|
60
80
|
|
|
61
81
|
export default Notification;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { View } from
|
|
3
|
-
import PropTypes from
|
|
4
|
-
import DropDownPicker from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import DropDownPicker from 'react-native-dropdown-picker';
|
|
5
5
|
import style, {
|
|
6
6
|
includesSelect,
|
|
7
7
|
placeholderStyle,
|
|
@@ -9,14 +9,14 @@ import style, {
|
|
|
9
9
|
listItemContainerStyle,
|
|
10
10
|
selectedItemLabelStyle,
|
|
11
11
|
textStyle,
|
|
12
|
-
} from
|
|
13
|
-
import { useEffect } from
|
|
12
|
+
} from './style';
|
|
13
|
+
import { useEffect } from 'react';
|
|
14
14
|
|
|
15
15
|
const Select = ({
|
|
16
16
|
value,
|
|
17
17
|
onValueChange,
|
|
18
|
-
items,
|
|
19
|
-
variant,
|
|
18
|
+
items = [],
|
|
19
|
+
variant = 'default',
|
|
20
20
|
disabled,
|
|
21
21
|
fitToContainer,
|
|
22
22
|
placeholder,
|
|
@@ -50,11 +50,11 @@ const Select = ({
|
|
|
50
50
|
listItemLabelStyle={listItemLabelStyle}
|
|
51
51
|
listItemContainerStyle={listItemContainerStyle}
|
|
52
52
|
selectedItemLabelStyle={selectedItemLabelStyle}
|
|
53
|
-
listMode=
|
|
53
|
+
listMode='MODAL'
|
|
54
54
|
textStyle={textStyle}
|
|
55
55
|
dropDownContainerStyle={{
|
|
56
56
|
...includesSelect[variant],
|
|
57
|
-
height:
|
|
57
|
+
height: 'auto',
|
|
58
58
|
}}
|
|
59
59
|
/>
|
|
60
60
|
</View>
|
|
@@ -62,8 +62,8 @@ const Select = ({
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
Select.defaultProps = {
|
|
65
|
-
variant:
|
|
66
|
-
placeholder:
|
|
65
|
+
variant: 'default',
|
|
66
|
+
placeholder: ' ',
|
|
67
67
|
disabled: false,
|
|
68
68
|
fitToContainer: false,
|
|
69
69
|
onValueChange: () => {},
|
|
@@ -72,7 +72,7 @@ Select.defaultProps = {
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
Select.propTypes = {
|
|
75
|
-
variant: PropTypes.oneOf([
|
|
75
|
+
variant: PropTypes.oneOf(['default', 'completed', 'error']),
|
|
76
76
|
placeholder: PropTypes.string.isRequired,
|
|
77
77
|
disabled: PropTypes.bool,
|
|
78
78
|
fitToContainer: PropTypes.bool,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useState, useRef, useEffect} from 'react';
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
|
4
4
|
View,
|
|
@@ -8,19 +8,19 @@ import {
|
|
|
8
8
|
PanResponder,
|
|
9
9
|
TouchableWithoutFeedback,
|
|
10
10
|
Platform,
|
|
11
|
-
TouchableOpacity
|
|
11
|
+
TouchableOpacity,
|
|
12
12
|
} from 'react-native';
|
|
13
|
-
import {getStatusBarHeight} from 'react-native-status-bar-height';
|
|
13
|
+
import { getStatusBarHeight } from 'react-native-status-bar-height';
|
|
14
14
|
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
15
|
-
import {CountdownCircleTimer} from 'react-native-countdown-circle-timer';
|
|
16
|
-
import {Colors} from '../../configs/constants';
|
|
15
|
+
import { CountdownCircleTimer } from 'react-native-countdown-circle-timer';
|
|
16
|
+
import { Colors } from '../../configs/constants';
|
|
17
17
|
import style from './style';
|
|
18
18
|
|
|
19
|
-
const {height: screenHeight} = Dimensions.get('window');
|
|
19
|
+
const { height: screenHeight } = Dimensions.get('window');
|
|
20
20
|
|
|
21
21
|
const STATUS = {
|
|
22
22
|
MEDIUM: 0,
|
|
23
|
-
LARGE: 1
|
|
23
|
+
LARGE: 1,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const calcMarginTop = () => {
|
|
@@ -32,26 +32,28 @@ const calcMarginTop = () => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const SwipeablePanel = ({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const LARGE_PANEL_HEIGHT =
|
|
35
|
+
offset = 0,
|
|
36
|
+
maximized,
|
|
37
|
+
lockPanel,
|
|
38
|
+
autoMaximize,
|
|
39
|
+
closeButton,
|
|
40
|
+
closeAfterSeconds = 0,
|
|
41
|
+
onClose,
|
|
42
|
+
avoidScroll,
|
|
43
|
+
children,
|
|
44
|
+
}) => {
|
|
45
|
+
const LARGE_PANEL_HEIGHT = screenHeight - offset - calcMarginTop(); // This is the margin top
|
|
46
46
|
const MEDIUM_PANEL_HEIGHT = 400; // Fixed height
|
|
47
47
|
|
|
48
48
|
const [closeButtonClicked, setCloseButtonClicked] = useState(false);
|
|
49
49
|
const [status, setStatus] = useState(STATUS.LARGE);
|
|
50
50
|
const [animatedValueY, setAnimatedValueY] = useState(LARGE_PANEL_HEIGHT);
|
|
51
|
-
const pan = useRef(
|
|
51
|
+
const pan = useRef(
|
|
52
|
+
new Animated.ValueXY({ x: 0, y: LARGE_PANEL_HEIGHT })
|
|
53
|
+
).current;
|
|
52
54
|
|
|
53
55
|
useEffect(() => {
|
|
54
|
-
pan.y.addListener(({value}) => setAnimatedValueY(value));
|
|
56
|
+
pan.y.addListener(({ value }) => setAnimatedValueY(value));
|
|
55
57
|
_animateTo(maximized ? STATUS.MEDIUM : STATUS.LARGE, true);
|
|
56
58
|
if (autoMaximize) {
|
|
57
59
|
setTimeout(() => _animateTo(STATUS.MEDIUM), 2000);
|
|
@@ -71,10 +73,13 @@ const SwipeablePanel = ({
|
|
|
71
73
|
y: animatedValueY,
|
|
72
74
|
});
|
|
73
75
|
|
|
74
|
-
pan.setValue({x: 0, y: 0});
|
|
76
|
+
pan.setValue({ x: 0, y: 0 });
|
|
75
77
|
},
|
|
76
78
|
onPanResponderMove: (evt, gestureState) => {
|
|
77
|
-
if (
|
|
79
|
+
if (
|
|
80
|
+
status === STATUS.MEDIUM &&
|
|
81
|
+
Math.abs(pan.y._value) <= pan.y._offset
|
|
82
|
+
) {
|
|
78
83
|
pan.setValue({
|
|
79
84
|
x: 0,
|
|
80
85
|
y: gestureState.dy,
|
|
@@ -91,7 +96,7 @@ const SwipeablePanel = ({
|
|
|
91
96
|
} else if (gestureState.dy > 100 || gestureState.vy > 0.5) {
|
|
92
97
|
_animateTo(STATUS.MEDIUM);
|
|
93
98
|
}
|
|
94
|
-
}
|
|
99
|
+
},
|
|
95
100
|
})
|
|
96
101
|
).current;
|
|
97
102
|
|
|
@@ -115,7 +120,7 @@ const SwipeablePanel = ({
|
|
|
115
120
|
setStatus(newStatus);
|
|
116
121
|
|
|
117
122
|
Animated.spring(pan, {
|
|
118
|
-
toValue: {x: 0, y: newY},
|
|
123
|
+
toValue: { x: 0, y: newY },
|
|
119
124
|
tension: 80,
|
|
120
125
|
friction: 25,
|
|
121
126
|
useNativeDriver: true,
|
|
@@ -126,16 +131,16 @@ const SwipeablePanel = ({
|
|
|
126
131
|
|
|
127
132
|
const renderContent = () => (
|
|
128
133
|
<TouchableWithoutFeedback onPress={() => _animateTo(STATUS.MEDIUM)}>
|
|
129
|
-
<View style={style.contentContainer}>
|
|
130
|
-
{children}
|
|
131
|
-
</View>
|
|
134
|
+
<View style={style.contentContainer}>{children}</View>
|
|
132
135
|
</TouchableWithoutFeedback>
|
|
133
136
|
);
|
|
134
137
|
|
|
135
138
|
return (
|
|
136
139
|
<Animated.View style={style.background}>
|
|
137
|
-
<TouchableWithoutFeedback
|
|
138
|
-
|
|
140
|
+
<TouchableWithoutFeedback
|
|
141
|
+
onPress={() => (maximized ? null : _animateTo(STATUS.LARGE))}
|
|
142
|
+
>
|
|
143
|
+
<View style={style.backgroundLayer} />
|
|
139
144
|
</TouchableWithoutFeedback>
|
|
140
145
|
<Animated.View
|
|
141
146
|
style={[
|
|
@@ -143,21 +148,24 @@ const SwipeablePanel = ({
|
|
|
143
148
|
{
|
|
144
149
|
bottom: MEDIUM_PANEL_HEIGHT - 1,
|
|
145
150
|
height: LARGE_PANEL_HEIGHT,
|
|
146
|
-
transform: pan.getTranslateTransform()
|
|
151
|
+
transform: pan.getTranslateTransform(),
|
|
147
152
|
},
|
|
148
153
|
]}
|
|
149
154
|
{...panResponder.panHandlers}
|
|
150
155
|
>
|
|
151
156
|
<View style={style.barContainer}>
|
|
152
|
-
<View style={style.bar}/>
|
|
157
|
+
<View style={style.bar} />
|
|
153
158
|
</View>
|
|
154
159
|
|
|
155
160
|
{closeButton && (
|
|
156
|
-
<TouchableOpacity
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
<TouchableOpacity
|
|
162
|
+
onPress={() => {
|
|
163
|
+
setCloseButtonClicked(true);
|
|
164
|
+
onClose();
|
|
165
|
+
}}
|
|
166
|
+
style={style.closeButton}
|
|
167
|
+
>
|
|
168
|
+
<Ionicons name='close-outline' size={20} color={Colors.darkblue} />
|
|
161
169
|
</TouchableOpacity>
|
|
162
170
|
)}
|
|
163
171
|
|
|
@@ -175,8 +183,8 @@ const SwipeablePanel = ({
|
|
|
175
183
|
size={40}
|
|
176
184
|
strokeWidth={4}
|
|
177
185
|
>
|
|
178
|
-
{({remainingTime, animatedColor}) => (
|
|
179
|
-
<Animated.Text style={{color: animatedColor, fontSize: 14}}>
|
|
186
|
+
{({ remainingTime, animatedColor }) => (
|
|
187
|
+
<Animated.Text style={{ color: animatedColor, fontSize: 14 }}>
|
|
180
188
|
{remainingTime}
|
|
181
189
|
</Animated.Text>
|
|
182
190
|
)}
|
|
@@ -185,9 +193,7 @@ const SwipeablePanel = ({
|
|
|
185
193
|
)}
|
|
186
194
|
|
|
187
195
|
{avoidScroll ? (
|
|
188
|
-
<>
|
|
189
|
-
{renderContent()}
|
|
190
|
-
</>
|
|
196
|
+
<>{renderContent()}</>
|
|
191
197
|
) : (
|
|
192
198
|
<ScrollView
|
|
193
199
|
onTouchStart={() => false}
|
|
@@ -199,7 +205,6 @@ const SwipeablePanel = ({
|
|
|
199
205
|
{renderContent()}
|
|
200
206
|
</ScrollView>
|
|
201
207
|
)}
|
|
202
|
-
|
|
203
208
|
</Animated.View>
|
|
204
209
|
</Animated.View>
|
|
205
210
|
);
|
|
@@ -213,8 +218,7 @@ SwipeablePanel.defaultProps = {
|
|
|
213
218
|
closeButton: false,
|
|
214
219
|
avoidScroll: false,
|
|
215
220
|
closeAfterSeconds: 0,
|
|
216
|
-
onClose: () => {
|
|
217
|
-
}
|
|
221
|
+
onClose: () => {},
|
|
218
222
|
};
|
|
219
223
|
|
|
220
224
|
SwipeablePanel.propTypes = {
|
|
@@ -225,7 +229,7 @@ SwipeablePanel.propTypes = {
|
|
|
225
229
|
closeAfterSeconds: PropTypes.number,
|
|
226
230
|
closeButton: PropTypes.bool,
|
|
227
231
|
avoidScroll: PropTypes.bool,
|
|
228
|
-
onClose: PropTypes.func
|
|
232
|
+
onClose: PropTypes.func,
|
|
229
233
|
};
|
|
230
234
|
|
|
231
235
|
export default SwipeablePanel;
|
|
@@ -3,25 +3,39 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Switch as RNSwitch, Platform } from 'react-native';
|
|
4
4
|
import { Colors } from '../../configs/constants';
|
|
5
5
|
|
|
6
|
-
const Switch = ({ value, size, ...props }) => (
|
|
6
|
+
const Switch = ({ value, size = 'medium', ...props }) => (
|
|
7
7
|
<RNSwitch
|
|
8
8
|
trackColor={{
|
|
9
9
|
false: Colors.lightblue,
|
|
10
|
-
true: Colors.lightblue
|
|
10
|
+
true: Colors.lightblue,
|
|
11
11
|
}}
|
|
12
12
|
thumbColor={value ? Colors.green : Colors.midblue}
|
|
13
13
|
ios_backgroundColor={Colors.white}
|
|
14
14
|
value={value}
|
|
15
15
|
style={{
|
|
16
|
-
transform: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
transform: [
|
|
17
|
+
{
|
|
18
|
+
scaleX:
|
|
19
|
+
size === 'small'
|
|
20
|
+
? Platform.OS === 'ios'
|
|
21
|
+
? 0.5
|
|
22
|
+
: 0.7
|
|
23
|
+
: Platform.OS === 'ios'
|
|
24
|
+
? 0.7
|
|
25
|
+
: 0.9,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
scaleY:
|
|
29
|
+
size === 'small'
|
|
30
|
+
? Platform.OS === 'ios'
|
|
31
|
+
? 0.5
|
|
32
|
+
: 0.7
|
|
33
|
+
: Platform.OS === 'ios'
|
|
34
|
+
? 0.7
|
|
35
|
+
: 0.9,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
}}
|
|
25
39
|
{...props}
|
|
26
40
|
/>
|
|
27
41
|
);
|
|
@@ -30,14 +44,14 @@ Switch.defaultProps = {
|
|
|
30
44
|
onValueChange: () => {},
|
|
31
45
|
value: false,
|
|
32
46
|
disabled: false,
|
|
33
|
-
size: 'medium'
|
|
47
|
+
size: 'medium',
|
|
34
48
|
};
|
|
35
49
|
|
|
36
50
|
Switch.propTypes = {
|
|
37
51
|
onValueChange: PropTypes.func,
|
|
38
52
|
value: PropTypes.bool,
|
|
39
53
|
disabled: PropTypes.bool,
|
|
40
|
-
size: PropTypes.oneOf(['medium', 'small'])
|
|
54
|
+
size: PropTypes.oneOf(['medium', 'small']),
|
|
41
55
|
};
|
|
42
56
|
|
|
43
57
|
export default Switch;
|
|
@@ -5,12 +5,12 @@ import { TextPropTypes } from 'deprecated-react-native-prop-types';
|
|
|
5
5
|
import style from './style';
|
|
6
6
|
|
|
7
7
|
const Text = ({
|
|
8
|
-
variant,
|
|
9
|
-
size,
|
|
10
|
-
color,
|
|
11
|
-
weight,
|
|
12
|
-
align,
|
|
13
|
-
style: customStyle,
|
|
8
|
+
variant = 'default',
|
|
9
|
+
size = 'medium',
|
|
10
|
+
color = 'dark',
|
|
11
|
+
weight = 'regular',
|
|
12
|
+
align = 'left',
|
|
13
|
+
style: customStyle = {},
|
|
14
14
|
children,
|
|
15
15
|
...props
|
|
16
16
|
}) => (
|
|
@@ -12,7 +12,7 @@ const { width } = Dimensions.get('window');
|
|
|
12
12
|
const BUTTON_WIDTH = width * 0.6;
|
|
13
13
|
|
|
14
14
|
const TimeOutButton = forwardRef(
|
|
15
|
-
({ onPress, time, warning, children }, ref) => {
|
|
15
|
+
({ onPress, time = 3000, warning, children }, ref) => {
|
|
16
16
|
const [elapsedTime, setElapsedTime] = useState(0);
|
|
17
17
|
const [interval, setLocalInterval] = useState();
|
|
18
18
|
|
|
@@ -5,54 +5,69 @@ import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
|
5
5
|
import Text from '../Text';
|
|
6
6
|
import style from './style';
|
|
7
7
|
|
|
8
|
-
const keys = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
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
|
+
];
|
|
45
58
|
|
|
46
59
|
const VirtualKeyboard = ({ onPress, hideBiometrics }) => (
|
|
47
60
|
<View style={style.container}>
|
|
48
|
-
{keys.map(({key, value}) => (
|
|
61
|
+
{keys.map(({ key, value }) => (
|
|
49
62
|
<TouchableOpacity
|
|
50
63
|
key={`key-${value}`}
|
|
51
64
|
style={style.button}
|
|
52
|
-
onPress={() =>
|
|
65
|
+
onPress={() =>
|
|
66
|
+
onPress(value === 'biometrics' && hideBiometrics ? null : value)
|
|
67
|
+
}
|
|
53
68
|
disabled={value === 'biometrics' && hideBiometrics}
|
|
54
69
|
>
|
|
55
|
-
{value === 'biometrics' && hideBiometrics ? <Text>
|
|
70
|
+
{value === 'biometrics' && hideBiometrics ? <Text> </Text> : key}
|
|
56
71
|
</TouchableOpacity>
|
|
57
72
|
))}
|
|
58
73
|
</View>
|
|
@@ -60,12 +75,12 @@ const VirtualKeyboard = ({ onPress, hideBiometrics }) => (
|
|
|
60
75
|
|
|
61
76
|
VirtualKeyboard.defaultProps = {
|
|
62
77
|
onPress: () => {},
|
|
63
|
-
hideBiometrics: false
|
|
78
|
+
hideBiometrics: false,
|
|
64
79
|
};
|
|
65
80
|
|
|
66
81
|
VirtualKeyboard.propTypes = {
|
|
67
82
|
onPress: PropTypes.func,
|
|
68
|
-
hideBiometrics: PropTypes.bool
|
|
83
|
+
hideBiometrics: PropTypes.bool,
|
|
69
84
|
};
|
|
70
85
|
|
|
71
86
|
export default VirtualKeyboard;
|