@servesall/atoms 1.1.6 → 1.1.9
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/dist/bundle.cjs.js +420 -568
- package/dist/bundle.esm.js +421 -570
- package/dist/bundle.umd.js +420 -568
- package/package.json +3 -8
- package/src/Buttons/RoundedButton/RoundedButton.style.js +6 -3
- package/src/Buttons/RoundedButton/index.js +2 -0
- package/src/CountryFlatList/index.js +2 -2
- package/src/Inputs/InputNormal/Animated.style.js +11 -0
- package/src/Inputs/InputNormal/index.js +4 -0
- package/src/Inputs/PhoneNumber/Animated.style.js +23 -0
- package/src/Inputs/PhoneNumber/Placeholder/index.js +46 -0
- package/src/Inputs/PhoneNumber/index.js +151 -0
- package/src/Inputs/index.js +2 -1
- package/src/Theme/definitions/colors.js +1 -0
- package/src/index.js +8 -1
- package/src/Inputs/PhoneNumber/PrefixPicker/index.js +0 -200
- package/src/Inputs/PhoneNumber/PrefixPicker/prefixList.js +0 -946
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servesall/atoms",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "Atoms for react-native",
|
|
5
5
|
"main": "dist/bundle.cjs.js",
|
|
6
6
|
"module": "dist/bundle.esm.js",
|
|
7
|
-
"directories": {
|
|
8
|
-
"doc": "docs"
|
|
9
|
-
},
|
|
10
7
|
"files": [
|
|
11
8
|
"dist",
|
|
12
9
|
"src"
|
|
13
10
|
],
|
|
14
11
|
"scripts": {
|
|
15
12
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
|
-
"build": "npm i
|
|
13
|
+
"build": "npm i && rollup -c && npm publish"
|
|
17
14
|
},
|
|
18
15
|
"repository": {
|
|
19
16
|
"type": "git",
|
|
@@ -26,8 +23,7 @@
|
|
|
26
23
|
"react-native-reanimated": "*"
|
|
27
24
|
},
|
|
28
25
|
"dependencies": {
|
|
29
|
-
"react-native-status-bar-height": "^2.6.0"
|
|
30
|
-
"styled-components": "^5.3.5"
|
|
26
|
+
"react-native-status-bar-height": "^2.6.0"
|
|
31
27
|
},
|
|
32
28
|
"devDependencies": {
|
|
33
29
|
"@babel/cli": "^7.17.10",
|
|
@@ -40,7 +36,6 @@
|
|
|
40
36
|
"@rollup/plugin-image": "^2.1.1",
|
|
41
37
|
"@rollup/plugin-json": "^4.1.0",
|
|
42
38
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
43
|
-
"react-native-reanimated": "^2.8.0",
|
|
44
39
|
"rollup": "^2.72.1",
|
|
45
40
|
"rollup-plugin-node-polyfills": "^0.2.1"
|
|
46
41
|
},
|
|
@@ -5,8 +5,11 @@ export const ButtonWrapper = styled.View``;
|
|
|
5
5
|
export const ButtonStyle = styled.Pressable`
|
|
6
6
|
min-height: ${(props) => (props.size === "big" ? "60px" : "54px")};
|
|
7
7
|
width: 100%;
|
|
8
|
-
border-radius: ${(props) =>
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
border-radius: ${(props) =>
|
|
9
|
+
props.smallBorder
|
|
10
|
+
? props.theme.borderRadiusSmall
|
|
11
|
+
: props.theme.borderRadiusMedium};
|
|
12
|
+
background-color: ${(props) =>
|
|
13
|
+
props.active ? props.color : props.theme.greyButton};
|
|
11
14
|
${(props) => props.style};
|
|
12
15
|
`;
|
|
@@ -14,6 +14,7 @@ const RoundedBtn = ({
|
|
|
14
14
|
onClick = () => {},
|
|
15
15
|
style,
|
|
16
16
|
size = "big",
|
|
17
|
+
smallBorder = false,
|
|
17
18
|
hitSlop = 0,
|
|
18
19
|
}) => {
|
|
19
20
|
const scale = useSharedValue(1);
|
|
@@ -32,6 +33,7 @@ const RoundedBtn = ({
|
|
|
32
33
|
return (
|
|
33
34
|
<Animated.View style={[animatedStyle]}>
|
|
34
35
|
<ButtonStyle
|
|
36
|
+
smallBorder={smallBorder}
|
|
35
37
|
hitSlop={hitSlop}
|
|
36
38
|
size={size}
|
|
37
39
|
active={active}
|
|
@@ -31,14 +31,14 @@ const Item = ({ item, setSelected, variant }) => {
|
|
|
31
31
|
uri: item.src,
|
|
32
32
|
}}
|
|
33
33
|
/>
|
|
34
|
-
<Row>
|
|
34
|
+
<Row style={{ alignItems: "center" }}>
|
|
35
35
|
<Box style={{ flex: 4 }}>
|
|
36
36
|
<MarginHorizontal>
|
|
37
37
|
<H4>{item.name}</H4>
|
|
38
38
|
</MarginHorizontal>
|
|
39
39
|
</Box>
|
|
40
40
|
{variant === "countryCode" && (
|
|
41
|
-
<Box>
|
|
41
|
+
<Box style={{ flex: 3 }}>
|
|
42
42
|
<MarginHorizontal>
|
|
43
43
|
<H4>{item.code}</H4>
|
|
44
44
|
</MarginHorizontal>
|
|
@@ -20,4 +20,15 @@ export const BorderWrapper = styled.View`
|
|
|
20
20
|
border-radius: ${(props) => props.theme.borderRadiusSmall};
|
|
21
21
|
background-color: ${(props) =>
|
|
22
22
|
props.active ? props.theme.color1 : props.theme.color10};
|
|
23
|
+
${({ isRightBound, isLeftBound, active }) => {
|
|
24
|
+
if (isRightBound) {
|
|
25
|
+
if (!active) {
|
|
26
|
+
return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px; border-right-width: 0px;";
|
|
27
|
+
}
|
|
28
|
+
return "borderTopRightRadius: 0px; borderBottomRightRadius: 0px;";
|
|
29
|
+
}
|
|
30
|
+
if (isLeftBound) {
|
|
31
|
+
return "borderTopLeftRadius: 0px; borderBottomLeftRadius: 0px;";
|
|
32
|
+
}
|
|
33
|
+
}}
|
|
23
34
|
`;
|
|
@@ -24,6 +24,8 @@ const Input = ({
|
|
|
24
24
|
keyboardVerticalOffset = 0,
|
|
25
25
|
hasError = false,
|
|
26
26
|
error,
|
|
27
|
+
isRightBound = false,
|
|
28
|
+
isLeftBound = false,
|
|
27
29
|
}) => {
|
|
28
30
|
const [isFocused, setIsFocused] = useState(false);
|
|
29
31
|
const [textValue, setTextValue] = useState(value || defaultValue);
|
|
@@ -50,6 +52,8 @@ const Input = ({
|
|
|
50
52
|
}}
|
|
51
53
|
>
|
|
52
54
|
<BorderWrapper
|
|
55
|
+
isRightBound={isRightBound}
|
|
56
|
+
isLeftBound={isLeftBound}
|
|
53
57
|
active={isFocused}
|
|
54
58
|
color={
|
|
55
59
|
!hasError
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
|
|
3
|
+
export const InputWrapper = styled.Pressable`
|
|
4
|
+
min-height: 70px;
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const InputElement = styled.TextInput`
|
|
8
|
+
min-height: 40px;
|
|
9
|
+
font-family: ${(props) => props.theme.fontFamily2};
|
|
10
|
+
font-size: ${(props) => props.theme.small};
|
|
11
|
+
color: ${(props) => props.theme.color2};
|
|
12
|
+
background-color: ${(props) =>
|
|
13
|
+
props.active ? props.theme.color1 : props.theme.color10};
|
|
14
|
+
`;
|
|
15
|
+
export const BorderWrapper = styled.View`
|
|
16
|
+
min-height: 70px;
|
|
17
|
+
padding-top: 26px;
|
|
18
|
+
border-width: 2px;
|
|
19
|
+
border-color: ${(props) => props.color};
|
|
20
|
+
border-radius: ${(props) => props.theme.borderRadiusSmall};
|
|
21
|
+
background-color: ${(props) =>
|
|
22
|
+
props.active ? props.theme.color1 : props.theme.color10};
|
|
23
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import Animated, {
|
|
3
|
+
Easing,
|
|
4
|
+
useAnimatedStyle,
|
|
5
|
+
useSharedValue,
|
|
6
|
+
withTiming,
|
|
7
|
+
} from "react-native-reanimated";
|
|
8
|
+
|
|
9
|
+
const PlaceholderElement = React.memo(({ children, active }) => {
|
|
10
|
+
const top = useSharedValue(active ? 10 : 30);
|
|
11
|
+
|
|
12
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
13
|
+
return {
|
|
14
|
+
top: withTiming(top.value, {
|
|
15
|
+
duration: 250,
|
|
16
|
+
easing: Easing.bezier(0.19, 1.0, 0.22, 1.0),
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (active) {
|
|
23
|
+
top.value = 10;
|
|
24
|
+
}
|
|
25
|
+
if (!active) {
|
|
26
|
+
top.value = 30;
|
|
27
|
+
}
|
|
28
|
+
}, [active]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Animated.View
|
|
32
|
+
style={[
|
|
33
|
+
{
|
|
34
|
+
position: "absolute",
|
|
35
|
+
zIndex: 1,
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
},
|
|
38
|
+
animatedStyle,
|
|
39
|
+
]}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</Animated.View>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export default PlaceholderElement;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from "react";
|
|
2
|
+
import { H4 } from "../../Text";
|
|
3
|
+
import { MarginHorizontal, Row, Box } from "../../Layout";
|
|
4
|
+
import { KeyboardAvoidingView, Platform } from "react-native";
|
|
5
|
+
import { InputWrapper, InputElement, BorderWrapper } from "./Animated.style";
|
|
6
|
+
import Placeholder from "./Placeholder";
|
|
7
|
+
|
|
8
|
+
const InputPhone = ({
|
|
9
|
+
children,
|
|
10
|
+
style,
|
|
11
|
+
borderColorIdle,
|
|
12
|
+
borderColorActive,
|
|
13
|
+
borderColorError,
|
|
14
|
+
textChangePrefix = () => {},
|
|
15
|
+
textChangeNumber = () => {},
|
|
16
|
+
onPress = () => {},
|
|
17
|
+
valuePrefix,
|
|
18
|
+
valueNumber,
|
|
19
|
+
defaultValuePrefix,
|
|
20
|
+
defaultValueNumber,
|
|
21
|
+
multiline = false,
|
|
22
|
+
numberOfLines = 1,
|
|
23
|
+
maxLength = 1000,
|
|
24
|
+
autoFocus = false,
|
|
25
|
+
keyboardType,
|
|
26
|
+
editable = true,
|
|
27
|
+
keyboardVerticalOffset = 0,
|
|
28
|
+
hasError = false,
|
|
29
|
+
error,
|
|
30
|
+
}) => {
|
|
31
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
32
|
+
const [textValue, setTextValue] = useState(valuePrefix || defaultValuePrefix);
|
|
33
|
+
const [isFocusedPrefix, setIsFocusedPrefix] = useState(false);
|
|
34
|
+
const [textPrefixValue, setTextPrefixValue] = useState(
|
|
35
|
+
valueNumber || defaultValueNumber
|
|
36
|
+
);
|
|
37
|
+
const inputRef = useRef();
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
textChangeNumber(textValue);
|
|
41
|
+
}, [textValue]);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
textChangePrefix(textPrefixValue);
|
|
45
|
+
}, [textPrefixValue]);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
autoFocus && inputRef.current?.focus();
|
|
49
|
+
}, [autoFocus]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<KeyboardAvoidingView
|
|
53
|
+
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
54
|
+
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
55
|
+
>
|
|
56
|
+
<InputWrapper
|
|
57
|
+
onPress={() => {
|
|
58
|
+
onPress();
|
|
59
|
+
editable && setIsFocused(true);
|
|
60
|
+
editable && inputRef.current?.focus();
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<BorderWrapper
|
|
64
|
+
active={isFocused}
|
|
65
|
+
color={
|
|
66
|
+
!hasError
|
|
67
|
+
? isFocused
|
|
68
|
+
? borderColorActive
|
|
69
|
+
: borderColorIdle
|
|
70
|
+
: borderColorError
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<Row style={{ backgroundColor: "red", width: "100%" }}>
|
|
74
|
+
<Box>
|
|
75
|
+
<Placeholder
|
|
76
|
+
active={
|
|
77
|
+
isFocusedPrefix ||
|
|
78
|
+
(textPrefixValue && textPrefixValue.length > 0) ||
|
|
79
|
+
(valuePrefix && valuePrefix.length > 0)
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
<MarginHorizontal>
|
|
83
|
+
{!hasError ? (
|
|
84
|
+
children[0]
|
|
85
|
+
) : (
|
|
86
|
+
<H4 color={borderColorError}>{error || hasError}</H4>
|
|
87
|
+
)}
|
|
88
|
+
</MarginHorizontal>
|
|
89
|
+
</Placeholder>
|
|
90
|
+
</Box>
|
|
91
|
+
<Box>
|
|
92
|
+
<Placeholder
|
|
93
|
+
active={
|
|
94
|
+
isFocused ||
|
|
95
|
+
(textValue && textValue.length > 0) ||
|
|
96
|
+
(valueNumber && valueNumber.length > 0)
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
<MarginHorizontal>
|
|
100
|
+
{!hasError ? (
|
|
101
|
+
children[1]
|
|
102
|
+
) : (
|
|
103
|
+
<H4 color={borderColorError}>{error || hasError}</H4>
|
|
104
|
+
)}
|
|
105
|
+
</MarginHorizontal>
|
|
106
|
+
</Placeholder>
|
|
107
|
+
</Box>
|
|
108
|
+
</Row>
|
|
109
|
+
|
|
110
|
+
<MarginHorizontal>
|
|
111
|
+
<Row>
|
|
112
|
+
<InputElement
|
|
113
|
+
onFocus={() => setIsFocusedPrefix(true)}
|
|
114
|
+
onBlur={() => setIsFocusedPrefix(false)}
|
|
115
|
+
onChangeText={(text) => setTextPrefixValue(text)}
|
|
116
|
+
defaultValue={defaultValuePrefix}
|
|
117
|
+
value={valuePrefix}
|
|
118
|
+
multiline={multiline}
|
|
119
|
+
numberOfLines={numberOfLines}
|
|
120
|
+
maxLength={maxLength}
|
|
121
|
+
autoFocus={autoFocus}
|
|
122
|
+
keyboardType={keyboardType}
|
|
123
|
+
editable={editable}
|
|
124
|
+
active={isFocusedPrefix}
|
|
125
|
+
style={style}
|
|
126
|
+
/>
|
|
127
|
+
<InputElement
|
|
128
|
+
ref={inputRef}
|
|
129
|
+
onFocus={() => setIsFocused(true)}
|
|
130
|
+
onBlur={() => setIsFocused(false)}
|
|
131
|
+
onChangeText={(text) => setTextValue(text)}
|
|
132
|
+
defaultValue={defaultValueNumber}
|
|
133
|
+
value={valueNumber}
|
|
134
|
+
multiline={multiline}
|
|
135
|
+
numberOfLines={numberOfLines}
|
|
136
|
+
maxLength={maxLength}
|
|
137
|
+
autoFocus={autoFocus}
|
|
138
|
+
keyboardType={keyboardType}
|
|
139
|
+
editable={editable}
|
|
140
|
+
active={isFocused}
|
|
141
|
+
style={style}
|
|
142
|
+
/>
|
|
143
|
+
</Row>
|
|
144
|
+
</MarginHorizontal>
|
|
145
|
+
</BorderWrapper>
|
|
146
|
+
</InputWrapper>
|
|
147
|
+
</KeyboardAvoidingView>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export default InputPhone;
|
package/src/Inputs/index.js
CHANGED
|
@@ -2,5 +2,6 @@ import Input from "./Animated";
|
|
|
2
2
|
import AnimatedPlaceholder from "./AnimatedPlaceholder";
|
|
3
3
|
import InputOtp from "./Otp";
|
|
4
4
|
import InputNormal from "./InputNormal";
|
|
5
|
+
import InputPhone from "./PhoneNumber";
|
|
5
6
|
|
|
6
|
-
export { Input, AnimatedPlaceholder, InputOtp, InputNormal };
|
|
7
|
+
export { Input, AnimatedPlaceholder, InputOtp, InputNormal, InputPhone };
|
package/src/index.js
CHANGED
|
@@ -22,7 +22,13 @@ import {
|
|
|
22
22
|
Box,
|
|
23
23
|
RoundedTopBox,
|
|
24
24
|
} from "./Layout";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
Input,
|
|
27
|
+
AnimatedPlaceholder,
|
|
28
|
+
InputOtp,
|
|
29
|
+
InputNormal,
|
|
30
|
+
InputPhone,
|
|
31
|
+
} from "./Inputs";
|
|
26
32
|
import {
|
|
27
33
|
TextBtn,
|
|
28
34
|
RoundedBtn,
|
|
@@ -78,6 +84,7 @@ export {
|
|
|
78
84
|
InputNormal,
|
|
79
85
|
AnimatedPlaceholder,
|
|
80
86
|
InputOtp,
|
|
87
|
+
InputPhone,
|
|
81
88
|
TextBtn,
|
|
82
89
|
RoundedBtn,
|
|
83
90
|
RoundBtn,
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useCallback, useState, useEffect } from "react";
|
|
2
|
-
import { View, StatusBar } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
FullScreen,
|
|
5
|
-
Center,
|
|
6
|
-
Loader,
|
|
7
|
-
Success,
|
|
8
|
-
Error,
|
|
9
|
-
Switch,
|
|
10
|
-
Row,
|
|
11
|
-
Box,
|
|
12
|
-
Margin,
|
|
13
|
-
MarginHorizontal,
|
|
14
|
-
MarginVertical,
|
|
15
|
-
Padding,
|
|
16
|
-
H4,
|
|
17
|
-
H2,
|
|
18
|
-
H3,
|
|
19
|
-
RoundedBtn,
|
|
20
|
-
ErrorText,
|
|
21
|
-
MarginRight,
|
|
22
|
-
MarginBottom,
|
|
23
|
-
PaddingVertical,
|
|
24
|
-
PaddingTop,
|
|
25
|
-
useThemeContext,
|
|
26
|
-
Input,
|
|
27
|
-
} from "@servesall/atoms";
|
|
28
|
-
import BottomSheet, {
|
|
29
|
-
BottomSheetScrollView,
|
|
30
|
-
BottomSheetFooter,
|
|
31
|
-
} from "@gorhom/bottom-sheet";
|
|
32
|
-
import { useNavigation } from "@react-navigation/native";
|
|
33
|
-
import { useSubmitHook } from "@servesall/organisms";
|
|
34
|
-
import {
|
|
35
|
-
UserRolesQueryProvider,
|
|
36
|
-
useUserRoles,
|
|
37
|
-
UPDATE_MERCHANT_USER,
|
|
38
|
-
} from "@servesall/merchantglobalstate";
|
|
39
|
-
import LottieView from "lottie-react-native";
|
|
40
|
-
|
|
41
|
-
export default function NewUser({ data }) {
|
|
42
|
-
const { merchant } = data;
|
|
43
|
-
const [selectedRole, setSelectedRole] = useState(false);
|
|
44
|
-
const [userPhoneNumber, setUserPhoneNumber] = useState("");
|
|
45
|
-
const [userPrefix, setUserPrefix] = useState("+356");
|
|
46
|
-
const theme = useThemeContext();
|
|
47
|
-
const navigation = useNavigation();
|
|
48
|
-
|
|
49
|
-
const { submitForm, loading, success, error, errorText } = useSubmitHook({
|
|
50
|
-
gql: UPDATE_MERCHANT_USER,
|
|
51
|
-
formState: { isValid: true, isDirty: true },
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
success && setTimeout(() => navigation.goBack(), 1000);
|
|
56
|
-
}, [success]);
|
|
57
|
-
|
|
58
|
-
const submit = () => {};
|
|
59
|
-
|
|
60
|
-
// variables
|
|
61
|
-
const snapPoints = useMemo(() => ["90%"], []);
|
|
62
|
-
|
|
63
|
-
// callbacks
|
|
64
|
-
const handleSheetChanges = useCallback((index) => {
|
|
65
|
-
if (index === -1) {
|
|
66
|
-
navigation.goBack();
|
|
67
|
-
}
|
|
68
|
-
}, []);
|
|
69
|
-
|
|
70
|
-
const renderFooter = useCallback(
|
|
71
|
-
(props) => (
|
|
72
|
-
<BottomSheetFooter {...props} bottomInset={0}>
|
|
73
|
-
<View
|
|
74
|
-
style={{
|
|
75
|
-
backgroundColor: theme.color1,
|
|
76
|
-
borderTopWidth: 2,
|
|
77
|
-
borderColor: theme.color7,
|
|
78
|
-
}}
|
|
79
|
-
>
|
|
80
|
-
<Margin>
|
|
81
|
-
<RoundedBtn
|
|
82
|
-
active={
|
|
83
|
-
userPrefix !== "" && userPhoneNumber !== "" && selectedRole
|
|
84
|
-
}
|
|
85
|
-
size="small"
|
|
86
|
-
color={theme.color2}
|
|
87
|
-
onClick={submit}
|
|
88
|
-
>
|
|
89
|
-
<Center>
|
|
90
|
-
<H3 color={theme.color1}>Save</H3>
|
|
91
|
-
</Center>
|
|
92
|
-
</RoundedBtn>
|
|
93
|
-
</Margin>
|
|
94
|
-
</View>
|
|
95
|
-
</BottomSheetFooter>
|
|
96
|
-
),
|
|
97
|
-
[selectedRole, userPhoneNumber, userPrefix]
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<View
|
|
102
|
-
style={{
|
|
103
|
-
flex: 1,
|
|
104
|
-
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<StatusBar barStyle="dark-content" backgroundColor="rgba(0, 0, 0, 0.4)" />
|
|
108
|
-
|
|
109
|
-
<BottomSheet
|
|
110
|
-
index={0}
|
|
111
|
-
snapPoints={snapPoints}
|
|
112
|
-
onChange={handleSheetChanges}
|
|
113
|
-
enablePanDownToClose={true}
|
|
114
|
-
footerComponent={renderFooter}
|
|
115
|
-
>
|
|
116
|
-
<BottomSheetScrollView contentContainerStyle={{ paddingBottom: 100 }}>
|
|
117
|
-
{loading && (
|
|
118
|
-
<FullScreen style={{ backgroundColor: "rgba(255, 255, 255, 0.8)" }}>
|
|
119
|
-
<Center>
|
|
120
|
-
<Loader color={theme.color2} />
|
|
121
|
-
</Center>
|
|
122
|
-
</FullScreen>
|
|
123
|
-
)}
|
|
124
|
-
|
|
125
|
-
{success && (
|
|
126
|
-
<FullScreen style={{ backgroundColor: "rgba(255, 255, 255, 0.8)" }}>
|
|
127
|
-
<Center>
|
|
128
|
-
<Success />
|
|
129
|
-
</Center>
|
|
130
|
-
</FullScreen>
|
|
131
|
-
)}
|
|
132
|
-
|
|
133
|
-
{error && (
|
|
134
|
-
<FullScreen style={{ backgroundColor: "rgba(255, 255, 255, 0.8)" }}>
|
|
135
|
-
<Center>
|
|
136
|
-
<Error />
|
|
137
|
-
</Center>
|
|
138
|
-
</FullScreen>
|
|
139
|
-
)}
|
|
140
|
-
<Box>
|
|
141
|
-
<View style={{ borderBottomWidth: 2, borderColor: theme.color7 }}>
|
|
142
|
-
<Margin style={{ alignItems: "center" }}>
|
|
143
|
-
<LottieView
|
|
144
|
-
style={{
|
|
145
|
-
width: 80,
|
|
146
|
-
}}
|
|
147
|
-
autoPlay={true}
|
|
148
|
-
loop={true}
|
|
149
|
-
source={adduser}
|
|
150
|
-
/>
|
|
151
|
-
<PaddingTop>
|
|
152
|
-
<H3>Add a new user to {merchant.profile.name}</H3>
|
|
153
|
-
</PaddingTop>
|
|
154
|
-
</Margin>
|
|
155
|
-
</View>
|
|
156
|
-
|
|
157
|
-
<Margin>
|
|
158
|
-
{errorText && (
|
|
159
|
-
<PaddingVertical>
|
|
160
|
-
<ErrorText>
|
|
161
|
-
<Center>
|
|
162
|
-
<Padding>
|
|
163
|
-
<H4 color={theme.red}>{errorText}</H4>
|
|
164
|
-
</Padding>
|
|
165
|
-
</Center>
|
|
166
|
-
</ErrorText>
|
|
167
|
-
</PaddingVertical>
|
|
168
|
-
)}
|
|
169
|
-
</Margin>
|
|
170
|
-
|
|
171
|
-
<MarginBottom>
|
|
172
|
-
<Margin>
|
|
173
|
-
<H3>User phone number</H3>
|
|
174
|
-
</Margin>
|
|
175
|
-
<UserPhone
|
|
176
|
-
theme={theme}
|
|
177
|
-
setUserPhoneNumber={setUserPhoneNumber}
|
|
178
|
-
setUserPrefix={setUserPrefix}
|
|
179
|
-
userPrefix={userPrefix}
|
|
180
|
-
/>
|
|
181
|
-
</MarginBottom>
|
|
182
|
-
|
|
183
|
-
<Margin>
|
|
184
|
-
<PaddingVertical>
|
|
185
|
-
<H3>Choose Role</H3>
|
|
186
|
-
</PaddingVertical>
|
|
187
|
-
<UserRolesQueryProvider>
|
|
188
|
-
<Roles
|
|
189
|
-
selectedRole={selectedRole}
|
|
190
|
-
setSelectedRole={setSelectedRole}
|
|
191
|
-
theme={theme}
|
|
192
|
-
/>
|
|
193
|
-
</UserRolesQueryProvider>
|
|
194
|
-
</Margin>
|
|
195
|
-
</Box>
|
|
196
|
-
</BottomSheetScrollView>
|
|
197
|
-
</BottomSheet>
|
|
198
|
-
</View>
|
|
199
|
-
);
|
|
200
|
-
}
|