ordering-ui-react-native 0.12.18 → 0.12.19
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/package.json +1 -1
- package/src/config.json +2 -2
- package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
- package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
- package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
- package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
- package/themes/business/src/components 2/Chat/index.tsx +0 -1152
- package/themes/business/src/components 2/Chat/styles.tsx +0 -12
- package/themes/business/src/components 2/Contacts/index.tsx +0 -299
- package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
- package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
- package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
- package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
- package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
- package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
- package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
- package/themes/business/src/components 2/Home/index.tsx +0 -111
- package/themes/business/src/components 2/Home/styles.tsx +0 -27
- package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
- package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
- package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
- package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
- package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
- package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
- package/themes/business/src/components 2/MapView/index.tsx +0 -317
- package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
- package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
- package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
- package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
- package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
- package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
- package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
- package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
- package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
- package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
- package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
- package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
- package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
- package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
- package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
- package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
- package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
- package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
- package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
- package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
- package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
- package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
- package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
- package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
- package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
- package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
- package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
- package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
- package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
- package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
- package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
- package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
- package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
- package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
- package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
- package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
- package/themes/business/src/components 2/StoresList/index.tsx +0 -208
- package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
- package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
- package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
- package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
- package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
- package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
- package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
- package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
- package/themes/business/src/components 2/shared/OButton.tsx +0 -149
- package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
- package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
- package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
- package/themes/business/src/components 2/shared/OFab.tsx +0 -54
- package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
- package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
- package/themes/business/src/components 2/shared/OInput.tsx +0 -144
- package/themes/business/src/components 2/shared/OLink.tsx +0 -76
- package/themes/business/src/components 2/shared/OModal.tsx +0 -275
- package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
- package/themes/business/src/components 2/shared/OText.tsx +0 -55
- package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
- package/themes/business/src/components 2/shared/OToast.tsx +0 -92
- package/themes/business/src/components 2/shared/index.tsx +0 -27
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, Keyboard } from 'react-native';
|
|
3
|
-
import { useForm, Controller } from 'react-hook-form';
|
|
4
|
-
import Spinner from 'react-native-loading-spinner-overlay';
|
|
5
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
6
|
-
import {
|
|
7
|
-
SignupForm as SignUpController,
|
|
8
|
-
useLanguage,
|
|
9
|
-
ToastType,
|
|
10
|
-
useToast,
|
|
11
|
-
} from 'ordering-components/native';
|
|
12
|
-
import { useTheme } from 'styled-components/native';
|
|
13
|
-
import { FormInput } from './styles';
|
|
14
|
-
import { PhoneInputNumber } from '../PhoneInputNumber';
|
|
15
|
-
import { VerifyPhone } from '../VerifyPhone';
|
|
16
|
-
import { OButton, OInput, OModal, OIconButton, OText } from '../shared';
|
|
17
|
-
import { _removeStoreData } from '../../providers/StoreUtil';
|
|
18
|
-
import { SignupParams } from '../../types';
|
|
19
|
-
import { sortInputFields } from '../../utils';
|
|
20
|
-
|
|
21
|
-
const SignupFormUI = (props: SignupParams) => {
|
|
22
|
-
const {
|
|
23
|
-
navigation,
|
|
24
|
-
formState,
|
|
25
|
-
validationFields,
|
|
26
|
-
showField,
|
|
27
|
-
isRequiredField,
|
|
28
|
-
useSignupByCellphone,
|
|
29
|
-
handleSuccessSignup,
|
|
30
|
-
handleButtonSignupClick,
|
|
31
|
-
verifyPhoneState,
|
|
32
|
-
checkPhoneCodeState,
|
|
33
|
-
setCheckPhoneCodeState,
|
|
34
|
-
handleSendVerifyCode,
|
|
35
|
-
handleCheckPhoneCode,
|
|
36
|
-
signupLevel,
|
|
37
|
-
// notificationState,
|
|
38
|
-
} = props;
|
|
39
|
-
|
|
40
|
-
const notValidationFields = [
|
|
41
|
-
'coupon',
|
|
42
|
-
'driver_tip',
|
|
43
|
-
'mobile_phone',
|
|
44
|
-
'address',
|
|
45
|
-
'address_notes',
|
|
46
|
-
'middle_name',
|
|
47
|
-
'lastname',
|
|
48
|
-
'second_lastname',
|
|
49
|
-
];
|
|
50
|
-
|
|
51
|
-
const showInputPhoneNumber =
|
|
52
|
-
validationFields?.fields?.checkout?.cellphone?.enabled ?? false;
|
|
53
|
-
|
|
54
|
-
const theme = useTheme();
|
|
55
|
-
const [, { showToast }] = useToast();
|
|
56
|
-
const [, t] = useLanguage();
|
|
57
|
-
const { control, handleSubmit, errors } = useForm();
|
|
58
|
-
|
|
59
|
-
const [passwordSee, setPasswordSee] = useState(false);
|
|
60
|
-
const [formValues, setFormValues] = useState(null);
|
|
61
|
-
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
62
|
-
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
63
|
-
const [phoneInputData, setPhoneInputData] = useState({
|
|
64
|
-
error: '',
|
|
65
|
-
phone: {
|
|
66
|
-
country_phone_code: null,
|
|
67
|
-
cellphone: null,
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const nameRef = useRef<any>(null);
|
|
72
|
-
const lastnameRef = useRef<any>(null);
|
|
73
|
-
const middleNameRef = useRef<any>(null);
|
|
74
|
-
const secondLastnameRef = useRef<any>(null);
|
|
75
|
-
const emailRef = useRef<any>(null);
|
|
76
|
-
const phoneRef = useRef<any>(null);
|
|
77
|
-
const passwordRef = useRef<any>(null);
|
|
78
|
-
|
|
79
|
-
const handleRefs = (ref: any, code: string) => {
|
|
80
|
-
switch (code) {
|
|
81
|
-
case 'name': {
|
|
82
|
-
nameRef.current = ref;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case 'middle_name': {
|
|
86
|
-
middleNameRef.current = ref;
|
|
87
|
-
}
|
|
88
|
-
case 'lastname': {
|
|
89
|
-
lastnameRef.current = ref;
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
case 'second_lastname': {
|
|
93
|
-
secondLastnameRef.current = ref;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case 'email': {
|
|
97
|
-
emailRef.current = ref;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const handleFocusRef = (code: string) => {
|
|
104
|
-
switch (code) {
|
|
105
|
-
case 'name': {
|
|
106
|
-
nameRef?.current?.focus();
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
case 'middle_name': {
|
|
110
|
-
middleNameRef?.current?.focus();
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
case 'lastname': {
|
|
114
|
-
lastnameRef?.current?.focus();
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case 'second_lastname': {
|
|
118
|
-
secondLastnameRef?.current?.focus();
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
case 'email': {
|
|
122
|
-
emailRef?.current?.focus();
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const getNextFieldCode = (index: number) => {
|
|
129
|
-
const fields = sortInputFields({
|
|
130
|
-
values: validationFields?.fields?.checkout,
|
|
131
|
-
})?.filter(
|
|
132
|
-
(field: any) =>
|
|
133
|
-
!notValidationFields.includes(field.code) && showField(field.code),
|
|
134
|
-
);
|
|
135
|
-
return fields[index + 1]?.code;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const handleSignup = () => {
|
|
139
|
-
handleSubmit(onSubmit)();
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const onSubmit = (values: any) => {
|
|
143
|
-
Keyboard.dismiss();
|
|
144
|
-
|
|
145
|
-
if (phoneInputData.error) {
|
|
146
|
-
showToast(ToastType.Error, phoneInputData.error);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (
|
|
151
|
-
!phoneInputData.phone.country_phone_code &&
|
|
152
|
-
!phoneInputData.phone.cellphone &&
|
|
153
|
-
validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
154
|
-
validationFields?.fields?.checkout?.cellphone?.required
|
|
155
|
-
) {
|
|
156
|
-
showToast(
|
|
157
|
-
ToastType.Error,
|
|
158
|
-
t(
|
|
159
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
160
|
-
'The field Mobile phone is required.',
|
|
161
|
-
),
|
|
162
|
-
);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (!useSignupByCellphone) {
|
|
167
|
-
handleButtonSignupClick &&
|
|
168
|
-
handleButtonSignupClick({
|
|
169
|
-
...values,
|
|
170
|
-
...phoneInputData.phone,
|
|
171
|
-
level: signupLevel,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
if (
|
|
175
|
-
!formState.loading &&
|
|
176
|
-
formState.result.result &&
|
|
177
|
-
!formState.result.error
|
|
178
|
-
) {
|
|
179
|
-
handleSuccessSignup && handleSuccessSignup(formState.result.result);
|
|
180
|
-
}
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
setFormValues(values);
|
|
185
|
-
handleVerifyCodeClick(values);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const handleVerifyCodeClick = (values: any) => {
|
|
189
|
-
const formData = values || formValues;
|
|
190
|
-
|
|
191
|
-
handleSendVerifyCode &&
|
|
192
|
-
handleSendVerifyCode({
|
|
193
|
-
...formData,
|
|
194
|
-
...phoneInputData.phone,
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
setIsLoadingVerifyModal(true);
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// get object with rules for hook form inputs
|
|
201
|
-
const getInputRules = (field: any) => {
|
|
202
|
-
const rules: any = {
|
|
203
|
-
required: isRequiredField(field.code)
|
|
204
|
-
? t(
|
|
205
|
-
`VALIDATION_ERROR_${field.code.toUpperCase()}_REQUIRED`,
|
|
206
|
-
`${field.name} is required`,
|
|
207
|
-
).replace('_attribute_', t(field.name, field.code))
|
|
208
|
-
: null,
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
if (field.code && field.code === 'email') {
|
|
212
|
-
rules.pattern = {
|
|
213
|
-
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
214
|
-
message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace(
|
|
215
|
-
'_attribute_',
|
|
216
|
-
t('EMAIL', 'Email'),
|
|
217
|
-
),
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
return rules;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const handleChangeInputEmail = (value: string, onChange: any) => {
|
|
224
|
-
onChange(value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
useEffect(() => {
|
|
228
|
-
if (!formState.loading && formState.result?.error) {
|
|
229
|
-
formState.result?.result &&
|
|
230
|
-
showToast(ToastType.Error, formState.result?.result[0]);
|
|
231
|
-
setIsLoadingVerifyModal(false);
|
|
232
|
-
}
|
|
233
|
-
}, [formState]);
|
|
234
|
-
|
|
235
|
-
useEffect(() => {
|
|
236
|
-
if (Object.keys(errors).length > 0) {
|
|
237
|
-
// Convert all errors in one string to show in toast provider
|
|
238
|
-
const list = Object.values(errors);
|
|
239
|
-
|
|
240
|
-
if (phoneInputData.error) {
|
|
241
|
-
list.push({ message: phoneInputData.error });
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
!phoneInputData.error &&
|
|
246
|
-
!phoneInputData.phone.country_phone_code &&
|
|
247
|
-
!phoneInputData.phone.cellphone &&
|
|
248
|
-
validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
249
|
-
validationFields?.fields?.checkout?.cellphone?.required
|
|
250
|
-
) {
|
|
251
|
-
list.push({
|
|
252
|
-
message: t(
|
|
253
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
254
|
-
'The field Mobile phone is required.',
|
|
255
|
-
),
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
let stringError = '';
|
|
260
|
-
list.map((item: any, i: number) => {
|
|
261
|
-
stringError +=
|
|
262
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
showToast(ToastType.Error, stringError);
|
|
266
|
-
setIsLoadingVerifyModal(false);
|
|
267
|
-
}
|
|
268
|
-
}, [errors]);
|
|
269
|
-
|
|
270
|
-
useEffect(() => {
|
|
271
|
-
if (verifyPhoneState && !verifyPhoneState?.loading) {
|
|
272
|
-
if (verifyPhoneState.result?.error) {
|
|
273
|
-
const message =
|
|
274
|
-
typeof verifyPhoneState?.result?.result === 'string'
|
|
275
|
-
? verifyPhoneState?.result?.result
|
|
276
|
-
: verifyPhoneState?.result?.result[0];
|
|
277
|
-
|
|
278
|
-
verifyPhoneState.result?.result && showToast(ToastType.Error, message);
|
|
279
|
-
setIsLoadingVerifyModal(false);
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const okResult = verifyPhoneState.result?.result === 'OK';
|
|
284
|
-
if (okResult) {
|
|
285
|
-
!isModalVisible && setIsModalVisible(true);
|
|
286
|
-
setIsLoadingVerifyModal(false);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}, [verifyPhoneState]);
|
|
290
|
-
|
|
291
|
-
const styles = StyleSheet.create({
|
|
292
|
-
header: {
|
|
293
|
-
marginBottom: 30,
|
|
294
|
-
justifyContent: 'space-between',
|
|
295
|
-
},
|
|
296
|
-
arrowLeft: {
|
|
297
|
-
maxWidth: 40,
|
|
298
|
-
height: 25,
|
|
299
|
-
justifyContent: 'flex-end',
|
|
300
|
-
marginBottom: 25,
|
|
301
|
-
},
|
|
302
|
-
title: {
|
|
303
|
-
fontFamily: 'Poppins',
|
|
304
|
-
fontStyle: 'normal',
|
|
305
|
-
fontWeight: '600',
|
|
306
|
-
fontSize: 26,
|
|
307
|
-
color: theme.colors.textGray,
|
|
308
|
-
},
|
|
309
|
-
btn: {
|
|
310
|
-
borderRadius: 7.6,
|
|
311
|
-
height: 44,
|
|
312
|
-
},
|
|
313
|
-
btnText: {
|
|
314
|
-
color: theme.colors.inputTextColor,
|
|
315
|
-
fontFamily: 'Poppins',
|
|
316
|
-
fontStyle: 'normal',
|
|
317
|
-
fontWeight: 'normal',
|
|
318
|
-
fontSize: 18,
|
|
319
|
-
},
|
|
320
|
-
btnFlag: {
|
|
321
|
-
borderWidth: 1,
|
|
322
|
-
borderRadius: 7.6,
|
|
323
|
-
marginRight: 9,
|
|
324
|
-
borderColor: theme.colors.inputSignup,
|
|
325
|
-
},
|
|
326
|
-
input: {
|
|
327
|
-
color: theme.colors.inputTextColor,
|
|
328
|
-
marginBottom: 20,
|
|
329
|
-
borderWidth: 1,
|
|
330
|
-
borderRadius: 7.6,
|
|
331
|
-
borderColor: theme.colors.inputSignup,
|
|
332
|
-
backgroundColor: theme.colors.transparent,
|
|
333
|
-
},
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
return (
|
|
337
|
-
<View>
|
|
338
|
-
<View style={styles.header}>
|
|
339
|
-
<OIconButton
|
|
340
|
-
icon={theme.images.general.arrow_left}
|
|
341
|
-
borderColor={theme.colors.clear}
|
|
342
|
-
iconStyle={{ width: 20, height: 20 }}
|
|
343
|
-
style={styles.arrowLeft}
|
|
344
|
-
onClick={() => navigation?.canGoBack() && navigation.goBack()}
|
|
345
|
-
/>
|
|
346
|
-
|
|
347
|
-
<OText style={styles.title}>{t('SIGNUP', 'Sign Up')}</OText>
|
|
348
|
-
</View>
|
|
349
|
-
|
|
350
|
-
<FormInput>
|
|
351
|
-
{!(validationFields?.loading && validationFields?.fields?.checkout) ? (
|
|
352
|
-
<>
|
|
353
|
-
{sortInputFields({
|
|
354
|
-
values: validationFields?.fields?.checkout,
|
|
355
|
-
}).map(
|
|
356
|
-
(field: any, i: number) =>
|
|
357
|
-
!notValidationFields.includes(field.code) &&
|
|
358
|
-
showField &&
|
|
359
|
-
showField(field.code) && (
|
|
360
|
-
<Controller
|
|
361
|
-
key={field.id}
|
|
362
|
-
control={control}
|
|
363
|
-
render={({ onChange, value }: any) => (
|
|
364
|
-
<OInput
|
|
365
|
-
placeholder={t(field.name)}
|
|
366
|
-
style={styles.input}
|
|
367
|
-
icon={
|
|
368
|
-
field.code === 'email'
|
|
369
|
-
? theme.images.logos.emailInputIcon
|
|
370
|
-
: theme.images.general.profile
|
|
371
|
-
}
|
|
372
|
-
value={value}
|
|
373
|
-
onChange={(val: any) =>
|
|
374
|
-
field.code !== 'email'
|
|
375
|
-
? onChange(val)
|
|
376
|
-
: handleChangeInputEmail(val, onChange)
|
|
377
|
-
}
|
|
378
|
-
autoCapitalize={
|
|
379
|
-
field.code === 'email' ? 'none' : 'sentences'
|
|
380
|
-
}
|
|
381
|
-
autoCorrect={field.code === 'email' && false}
|
|
382
|
-
type={
|
|
383
|
-
field.code === 'email' ? 'email-address' : 'default'
|
|
384
|
-
}
|
|
385
|
-
autoCompleteType={
|
|
386
|
-
field.code === 'email' ? 'email' : 'off'
|
|
387
|
-
}
|
|
388
|
-
selectionColor={theme.colors.primary}
|
|
389
|
-
color={theme.colors.textGray}
|
|
390
|
-
returnKeyType="next"
|
|
391
|
-
blurOnSubmit={false}
|
|
392
|
-
forwardRef={(ref: any) => handleRefs(ref, field.code)}
|
|
393
|
-
onSubmitEditing={() =>
|
|
394
|
-
field.code === 'email'
|
|
395
|
-
? phoneRef.current.focus()
|
|
396
|
-
: handleFocusRef(getNextFieldCode(i))
|
|
397
|
-
}
|
|
398
|
-
/>
|
|
399
|
-
)}
|
|
400
|
-
name={field.code}
|
|
401
|
-
rules={getInputRules(field)}
|
|
402
|
-
defaultValue=""
|
|
403
|
-
/>
|
|
404
|
-
),
|
|
405
|
-
)}
|
|
406
|
-
|
|
407
|
-
{!!showInputPhoneNumber && (
|
|
408
|
-
<View style={{ marginBottom: 25 }}>
|
|
409
|
-
<PhoneInputNumber
|
|
410
|
-
data={phoneInputData}
|
|
411
|
-
handleData={(val: any) => setPhoneInputData(val)}
|
|
412
|
-
forwardRef={phoneRef}
|
|
413
|
-
flagProps={styles.btnFlag}
|
|
414
|
-
onSubmitEditing={() => null}
|
|
415
|
-
textInputProps={{
|
|
416
|
-
returnKeyType: 'next',
|
|
417
|
-
onSubmitEditing: () => passwordRef.current.focus(),
|
|
418
|
-
}}
|
|
419
|
-
/>
|
|
420
|
-
</View>
|
|
421
|
-
)}
|
|
422
|
-
|
|
423
|
-
<Controller
|
|
424
|
-
control={control}
|
|
425
|
-
render={({ onChange, value }: any) => (
|
|
426
|
-
<OInput
|
|
427
|
-
isSecured={!passwordSee ? true : false}
|
|
428
|
-
placeholder={t('PASSWORD', 'Password')}
|
|
429
|
-
style={styles.input}
|
|
430
|
-
icon={theme.images.logos.passwordInputIcon}
|
|
431
|
-
iconCustomRight={
|
|
432
|
-
!passwordSee ? (
|
|
433
|
-
<MaterialCommunityIcons
|
|
434
|
-
name="eye-outline"
|
|
435
|
-
size={24}
|
|
436
|
-
color={theme.colors.inputSignup}
|
|
437
|
-
onPress={() => setPasswordSee(!passwordSee)}
|
|
438
|
-
/>
|
|
439
|
-
) : (
|
|
440
|
-
<MaterialCommunityIcons
|
|
441
|
-
name="eye-off-outline"
|
|
442
|
-
size={24}
|
|
443
|
-
color={theme.colors.inputSignup}
|
|
444
|
-
onPress={() => setPasswordSee(!passwordSee)}
|
|
445
|
-
/>
|
|
446
|
-
)
|
|
447
|
-
}
|
|
448
|
-
selectionColor={theme.colors.primary}
|
|
449
|
-
color={theme.colors.textGray}
|
|
450
|
-
value={value}
|
|
451
|
-
onChange={(val: any) => onChange(val)}
|
|
452
|
-
returnKeyType="done"
|
|
453
|
-
blurOnSubmit
|
|
454
|
-
forwardRef={passwordRef}
|
|
455
|
-
/>
|
|
456
|
-
)}
|
|
457
|
-
name="password"
|
|
458
|
-
rules={{
|
|
459
|
-
required: isRequiredField('password')
|
|
460
|
-
? t(
|
|
461
|
-
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
462
|
-
'The field Password is required',
|
|
463
|
-
).replace('_attribute_', t('PASSWORD', 'password'))
|
|
464
|
-
: null,
|
|
465
|
-
minLength: {
|
|
466
|
-
value: 8,
|
|
467
|
-
message: t(
|
|
468
|
-
'VALIDATION_ERROR_PASSWORD_MIN_STRING',
|
|
469
|
-
'The Password must be at least 8 characters.',
|
|
470
|
-
)
|
|
471
|
-
.replace('_attribute_', t('PASSWORD', 'Password'))
|
|
472
|
-
.replace('_min_', 8),
|
|
473
|
-
},
|
|
474
|
-
}}
|
|
475
|
-
defaultValue=""
|
|
476
|
-
/>
|
|
477
|
-
</>
|
|
478
|
-
) : (
|
|
479
|
-
<Spinner visible />
|
|
480
|
-
)}
|
|
481
|
-
|
|
482
|
-
{useSignupByCellphone ? (
|
|
483
|
-
<OButton
|
|
484
|
-
onClick={handleSubmit(onSubmit)}
|
|
485
|
-
text={t('GET_VERIFY_CODE', 'Get Verify Code')}
|
|
486
|
-
borderColor={theme.colors.primary}
|
|
487
|
-
textStyle={styles.btnText}
|
|
488
|
-
style={styles.btn}
|
|
489
|
-
imgRightSrc={null}
|
|
490
|
-
isLoading={isLoadingVerifyModal}
|
|
491
|
-
indicatorColor={theme.colors.white}
|
|
492
|
-
/>
|
|
493
|
-
) : (
|
|
494
|
-
<OButton
|
|
495
|
-
onClick={handleSignup}
|
|
496
|
-
text={t('SIGNUP', 'Sign Up')}
|
|
497
|
-
bgColor={theme.colors.primary}
|
|
498
|
-
borderColor={theme.colors.primary}
|
|
499
|
-
textStyle={styles.btnText}
|
|
500
|
-
style={styles.btn}
|
|
501
|
-
imgRightSrc={null}
|
|
502
|
-
isDisabled={formState.loading || validationFields.loading}
|
|
503
|
-
/>
|
|
504
|
-
)}
|
|
505
|
-
</FormInput>
|
|
506
|
-
|
|
507
|
-
<OModal open={isModalVisible} onClose={() => setIsModalVisible(false)}>
|
|
508
|
-
<VerifyPhone
|
|
509
|
-
phone={phoneInputData.phone}
|
|
510
|
-
formValues={formValues}
|
|
511
|
-
verifyPhoneState={verifyPhoneState}
|
|
512
|
-
checkPhoneCodeState={checkPhoneCodeState}
|
|
513
|
-
handleCheckPhoneCode={handleCheckPhoneCode}
|
|
514
|
-
setCheckPhoneCodeState={setCheckPhoneCodeState}
|
|
515
|
-
handleVerifyCodeClick={onSubmit}
|
|
516
|
-
/>
|
|
517
|
-
</OModal>
|
|
518
|
-
|
|
519
|
-
<Spinner visible={formState.loading} />
|
|
520
|
-
</View>
|
|
521
|
-
);
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
export const SignupForm = (props: any) => {
|
|
525
|
-
const signupProps = {
|
|
526
|
-
...props,
|
|
527
|
-
UIComponent: SignupFormUI,
|
|
528
|
-
};
|
|
529
|
-
return <SignUpController {...signupProps} />;
|
|
530
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native';
|
|
2
|
-
|
|
3
|
-
export const FormSide = styled.View`
|
|
4
|
-
display: flex;
|
|
5
|
-
width: 100%;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
margin-top: 10px;
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const FormInput = styled.View`
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
width: 100%;
|
|
15
|
-
margin-bottom: 35px;
|
|
16
|
-
`;
|