ordering-ui-react-native 0.15.11 → 0.15.14
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/themes/business/src/components/Chat/index.tsx +3 -2
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
- package/themes/original/src/components/LoginForm/index.tsx +83 -68
- package/themes/original/src/components/PaymentOptions/index.tsx +15 -6
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
- package/themes/original/src/components/SignupForm/index.tsx +173 -154
- package/themes/original/src/types/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -272,9 +272,10 @@ const ChatUI = (props: MessagesParams) => {
|
|
|
272
272
|
launchImageLibrary(
|
|
273
273
|
{
|
|
274
274
|
mediaType: 'photo',
|
|
275
|
-
maxHeight:
|
|
276
|
-
maxWidth:
|
|
275
|
+
maxHeight: 2048,
|
|
276
|
+
maxWidth: 2048,
|
|
277
277
|
includeBase64: true,
|
|
278
|
+
quality: 1
|
|
278
279
|
},
|
|
279
280
|
(response: any) => {
|
|
280
281
|
if (response.didCancel) {
|
|
@@ -65,18 +65,6 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
65
65
|
}
|
|
66
66
|
}, [formState])
|
|
67
67
|
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (Object.keys(errors).length > 0) {
|
|
70
|
-
// Convert all errors in one string to show in toast provider
|
|
71
|
-
const list = Object.values(errors)
|
|
72
|
-
let stringError = ''
|
|
73
|
-
list.map((item: any, i: number) => {
|
|
74
|
-
stringError += (i + 1) === list.length ? `- ${item.message}` : `- ${item.message}\n`
|
|
75
|
-
})
|
|
76
|
-
showToast(ToastType.Error, stringError)
|
|
77
|
-
}
|
|
78
|
-
}, [errors])
|
|
79
|
-
|
|
80
68
|
return (
|
|
81
69
|
<Container>
|
|
82
70
|
<NavBar
|
|
@@ -100,6 +88,14 @@ const ForgotPasswordUI = (props: any) => {
|
|
|
100
88
|
{t('FORGOT_PASSWORD_TEXT_MESSAGE', "Enter your email address and we'll sent a link to reset your password.")}
|
|
101
89
|
</OText>
|
|
102
90
|
<FormInput>
|
|
91
|
+
{errors?.email && (
|
|
92
|
+
<OText
|
|
93
|
+
size={14}
|
|
94
|
+
color={theme.colors.danger5}
|
|
95
|
+
weight={'normal'}>
|
|
96
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
97
|
+
</OText>
|
|
98
|
+
)}
|
|
103
99
|
<Controller
|
|
104
100
|
control={control}
|
|
105
101
|
render={({ onChange, value }: any) => (
|
|
@@ -67,7 +67,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
67
67
|
const [, t] = useLanguage();
|
|
68
68
|
const [{ configs }] = useConfig();
|
|
69
69
|
const [, { login }] = useSession();
|
|
70
|
-
const { control, handleSubmit, errors } = useForm();
|
|
70
|
+
const { control, handleSubmit, errors, reset, register, setValue } = useForm();
|
|
71
71
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
72
72
|
const [isLoadingVerifyModal, setIsLoadingVerifyModal] = useState(false);
|
|
73
73
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
@@ -91,7 +91,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
91
91
|
inputStyle: {
|
|
92
92
|
marginBottom: 28,
|
|
93
93
|
borderWidth: 1,
|
|
94
|
-
borderColor: theme.colors.border,
|
|
94
|
+
// borderColor: theme.colors.border,
|
|
95
95
|
borderRadius: 7.6,
|
|
96
96
|
},
|
|
97
97
|
line: {
|
|
@@ -189,33 +189,21 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
189
189
|
}, [verifyPhoneState]);
|
|
190
190
|
|
|
191
191
|
useEffect(() => {
|
|
192
|
-
if (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
208
|
-
'The field Mobile phone is required.',
|
|
209
|
-
),
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
list.map((item: any, i: number) => {
|
|
213
|
-
stringError +=
|
|
214
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
215
|
-
});
|
|
216
|
-
showToast(ToastType.Error, stringError);
|
|
217
|
-
}
|
|
218
|
-
}, [errors]);
|
|
192
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
193
|
+
else setValue('cellphone', '')
|
|
194
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
register('cellphone', {
|
|
198
|
+
required: loginTab === 'cellphone'
|
|
199
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
200
|
+
: null
|
|
201
|
+
})
|
|
202
|
+
}, [register])
|
|
203
|
+
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
reset()
|
|
206
|
+
}, [loginTab])
|
|
219
207
|
|
|
220
208
|
return (
|
|
221
209
|
<Container>
|
|
@@ -284,43 +272,58 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
284
272
|
{(useLoginByCellphone || useLoginByEmail) && (
|
|
285
273
|
<FormInput>
|
|
286
274
|
{useLoginByEmail && loginTab === 'email' && (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
handleChangeInputEmail(e, onChange);
|
|
296
|
-
}}
|
|
297
|
-
value={value}
|
|
298
|
-
autoCapitalize="none"
|
|
299
|
-
autoCorrect={false}
|
|
300
|
-
type="email-address"
|
|
301
|
-
autoCompleteType="email"
|
|
302
|
-
returnKeyType="next"
|
|
303
|
-
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
304
|
-
blurOnSubmit={false}
|
|
305
|
-
forwardRef={emailRef}
|
|
306
|
-
/>
|
|
275
|
+
<>
|
|
276
|
+
{errors?.email && (
|
|
277
|
+
<OText
|
|
278
|
+
size={14}
|
|
279
|
+
color={theme.colors.danger5}
|
|
280
|
+
weight={'normal'}>
|
|
281
|
+
{errors?.email?.message}{errors?.email?.type === 'required' && '*'}
|
|
282
|
+
</OText>
|
|
307
283
|
)}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
284
|
+
<Controller
|
|
285
|
+
control={control}
|
|
286
|
+
render={({ onChange, value }: any) => (
|
|
287
|
+
<OInput
|
|
288
|
+
placeholder={t('EMAIL', 'Email')}
|
|
289
|
+
style={loginStyle.inputStyle}
|
|
290
|
+
icon={theme.images.general.email}
|
|
291
|
+
onChange={(e: any) => {
|
|
292
|
+
handleChangeInputEmail(e, onChange);
|
|
293
|
+
}}
|
|
294
|
+
value={value}
|
|
295
|
+
autoCapitalize="none"
|
|
296
|
+
autoCorrect={false}
|
|
297
|
+
type="email-address"
|
|
298
|
+
autoCompleteType="email"
|
|
299
|
+
returnKeyType="next"
|
|
300
|
+
onSubmitEditing={() => passwordRef.current?.focus()}
|
|
301
|
+
blurOnSubmit={false}
|
|
302
|
+
forwardRef={emailRef}
|
|
303
|
+
borderColor={errors?.email ? theme.colors.danger5 : theme.colors.border}
|
|
304
|
+
/>
|
|
305
|
+
)}
|
|
306
|
+
name="email"
|
|
307
|
+
rules={{
|
|
308
|
+
required: {
|
|
309
|
+
value: true,
|
|
310
|
+
message: t(
|
|
311
|
+
'VALIDATION_ERROR_EMAIL_REQUIRED',
|
|
312
|
+
'The field Email is required',
|
|
313
|
+
).replace('_attribute_', t('EMAIL', 'Email'))
|
|
314
|
+
},
|
|
315
|
+
pattern: {
|
|
316
|
+
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
|
|
317
|
+
message: t(
|
|
318
|
+
'INVALID_ERROR_EMAIL',
|
|
319
|
+
'Invalid email address',
|
|
320
|
+
).replace('_attribute_', t('EMAIL', 'Email')),
|
|
321
|
+
}
|
|
322
|
+
}}
|
|
323
|
+
defaultValue=""
|
|
324
|
+
/>
|
|
325
|
+
</>
|
|
326
|
+
|
|
324
327
|
)}
|
|
325
328
|
{useLoginByCellphone && loginTab === 'cellphone' && (
|
|
326
329
|
<View style={{ marginBottom: 28 }}>
|
|
@@ -331,10 +334,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
331
334
|
returnKeyType: 'next',
|
|
332
335
|
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
333
336
|
}}
|
|
337
|
+
isStartValidation={errors?.cellphone}
|
|
334
338
|
/>
|
|
335
339
|
</View>
|
|
336
340
|
)}
|
|
337
|
-
|
|
341
|
+
{errors?.password && (
|
|
342
|
+
<OText
|
|
343
|
+
size={14}
|
|
344
|
+
color={theme.colors.danger5}
|
|
345
|
+
weight={'normal'}>
|
|
346
|
+
{errors?.password?.message}{errors?.password?.type === 'required' && '*'}
|
|
347
|
+
</OText>
|
|
348
|
+
)}
|
|
338
349
|
<Controller
|
|
339
350
|
control={control}
|
|
340
351
|
render={({ onChange, value }: any) => (
|
|
@@ -366,14 +377,18 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
366
377
|
returnKeyType="done"
|
|
367
378
|
onSubmitEditing={handleSubmit(onSubmit)}
|
|
368
379
|
blurOnSubmit
|
|
380
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
369
381
|
/>
|
|
370
382
|
)}
|
|
371
383
|
name="password"
|
|
372
384
|
rules={{
|
|
373
|
-
required:
|
|
385
|
+
required: {
|
|
386
|
+
value: true,
|
|
387
|
+
message: t(
|
|
374
388
|
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
375
389
|
'The field Password is required',
|
|
376
|
-
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
390
|
+
).replace('_attribute_', t('PASSWORD', 'Password'))
|
|
391
|
+
}
|
|
377
392
|
}}
|
|
378
393
|
defaultValue=""
|
|
379
394
|
/>
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
PaymentOptions as PaymentOptionsController,
|
|
11
11
|
useLanguage,
|
|
12
|
+
ToastType,
|
|
13
|
+
useToast,
|
|
12
14
|
} from 'ordering-components/native';
|
|
13
15
|
import { useTheme } from 'styled-components/native';
|
|
14
16
|
import { PaymentOptionCash } from '../PaymentOptionCash';
|
|
@@ -59,7 +61,7 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
59
61
|
} = props
|
|
60
62
|
|
|
61
63
|
const theme = useTheme();
|
|
62
|
-
|
|
64
|
+
const [, { showToast }] = useToast();
|
|
63
65
|
|
|
64
66
|
const getPayIcon = (method: string) => {
|
|
65
67
|
switch (method) {
|
|
@@ -95,11 +97,18 @@ const PaymentOptionsUI = (props: any) => {
|
|
|
95
97
|
// ]
|
|
96
98
|
|
|
97
99
|
const handlePaymentMethodClick = (paymethod: any) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if (cart?.balance > 0) {
|
|
101
|
+
const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
|
|
102
|
+
if (webViewPaymentGateway.includes(paymethod?.gateway)) {
|
|
103
|
+
handlePaymentMethodClickCustom(paymethod)
|
|
104
|
+
}
|
|
105
|
+
handlePaymethodClick(paymethod, isPopupMethod)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
showToast(
|
|
109
|
+
ToastType.Error,
|
|
110
|
+
t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
|
|
111
|
+
;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
114
|
useEffect(() => {
|
|
@@ -22,18 +22,23 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
22
22
|
textStyle,
|
|
23
23
|
flagStyle,
|
|
24
24
|
noDropIcon,
|
|
25
|
-
isDisabled
|
|
25
|
+
isDisabled,
|
|
26
|
+
isStartValidation
|
|
26
27
|
} = props
|
|
27
28
|
|
|
28
29
|
const theme = useTheme();
|
|
29
30
|
|
|
31
|
+
const [, t] = useLanguage()
|
|
32
|
+
const [{ configs }] = useConfig()
|
|
33
|
+
const phoneInput = useRef<PhoneInput>(null);
|
|
34
|
+
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
30
35
|
|
|
31
36
|
const style = StyleSheet.create({
|
|
32
37
|
input: {
|
|
33
38
|
backgroundColor: theme.colors.white,
|
|
34
39
|
borderRadius: 7.6,
|
|
35
40
|
borderWidth: 1,
|
|
36
|
-
borderColor: theme.colors.border,
|
|
41
|
+
borderColor: (isStartValidation && userphoneNumber === '') ? theme.colors.danger5 : theme.colors.border,
|
|
37
42
|
paddingBottom: 0,
|
|
38
43
|
paddingTop: 0,
|
|
39
44
|
flexGrow: 1,
|
|
@@ -48,12 +53,6 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
48
53
|
}
|
|
49
54
|
})
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
const [, t] = useLanguage()
|
|
53
|
-
const [{ configs }] = useConfig()
|
|
54
|
-
const phoneInput = useRef<PhoneInput>(null);
|
|
55
|
-
const [userphoneNumber, setUserphoneNumber] = useState('');
|
|
56
|
-
|
|
57
56
|
const handleChangeNumber = (number: any) => {
|
|
58
57
|
setUserphoneNumber(number)
|
|
59
58
|
}
|
|
@@ -97,6 +96,14 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
|
|
|
97
96
|
|
|
98
97
|
return (
|
|
99
98
|
<Wrapper onPress={() => forwardRef?.current?.focus?.()}>
|
|
99
|
+
{(isStartValidation && userphoneNumber === '') && (
|
|
100
|
+
<OText
|
|
101
|
+
size={14}
|
|
102
|
+
color={theme.colors.danger5}
|
|
103
|
+
>
|
|
104
|
+
{t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))}*
|
|
105
|
+
</OText>
|
|
106
|
+
)}
|
|
100
107
|
<PhoneInput
|
|
101
108
|
ref={phoneInput}
|
|
102
109
|
disabled={isDisabled}
|
|
@@ -68,7 +68,6 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
68
68
|
|
|
69
69
|
const theme = useTheme();
|
|
70
70
|
|
|
71
|
-
|
|
72
71
|
const style = StyleSheet.create({
|
|
73
72
|
btnOutline: {
|
|
74
73
|
backgroundColor: '#FFF',
|
|
@@ -77,7 +76,6 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
77
76
|
inputStyle: {
|
|
78
77
|
marginBottom: 20,
|
|
79
78
|
borderWidth: 1,
|
|
80
|
-
borderColor: theme.colors.border,
|
|
81
79
|
borderRadius: 7.6,
|
|
82
80
|
},
|
|
83
81
|
wrappText: {
|
|
@@ -102,7 +100,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
102
100
|
const [, t] = useLanguage();
|
|
103
101
|
const [, { login }] = useSession();
|
|
104
102
|
const [{ configs }] = useConfig();
|
|
105
|
-
const { control, handleSubmit, errors } = useForm();
|
|
103
|
+
const { control, handleSubmit, errors, register, setValue } = useForm();
|
|
106
104
|
|
|
107
105
|
const [passwordSee, setPasswordSee] = useState(false);
|
|
108
106
|
const [formValues, setFormValues] = useState(null);
|
|
@@ -227,7 +225,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
227
225
|
handleButtonSignupClick &&
|
|
228
226
|
handleButtonSignupClick({
|
|
229
227
|
...values,
|
|
230
|
-
...phoneInputData.phone,
|
|
228
|
+
...((phoneInputData.phone.cellphone !== null && phoneInputData.phone.country_phone_code !== null) && {...phoneInputData.phone}),
|
|
231
229
|
});
|
|
232
230
|
if (
|
|
233
231
|
!formState.loading &&
|
|
@@ -298,36 +296,23 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
298
296
|
|
|
299
297
|
useEffect(() => {
|
|
300
298
|
if (Object.keys(errors).length > 0) {
|
|
301
|
-
// Convert all errors in one string to show in toast provider
|
|
302
|
-
const list = Object.values(errors);
|
|
303
|
-
if (phoneInputData.error) {
|
|
304
|
-
list.push({ message: phoneInputData.error });
|
|
305
|
-
}
|
|
306
|
-
if (
|
|
307
|
-
!phoneInputData.error &&
|
|
308
|
-
!phoneInputData.phone.country_phone_code &&
|
|
309
|
-
!phoneInputData.phone.cellphone &&
|
|
310
|
-
((validationFields?.fields?.checkout?.cellphone?.enabled &&
|
|
311
|
-
validationFields?.fields?.checkout?.cellphone?.required) ||
|
|
312
|
-
configs?.verification_phone_required?.value === '1')
|
|
313
|
-
) {
|
|
314
|
-
list.push({
|
|
315
|
-
message: t(
|
|
316
|
-
'VALIDATION_ERROR_MOBILE_PHONE_REQUIRED',
|
|
317
|
-
'The field Mobile phone is required.',
|
|
318
|
-
),
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
let stringError = '';
|
|
322
|
-
list.map((item: any, i: number) => {
|
|
323
|
-
stringError +=
|
|
324
|
-
i + 1 === list.length ? `- ${item.message}` : `- ${item.message}\n`;
|
|
325
|
-
});
|
|
326
|
-
showToast(ToastType.Error, stringError);
|
|
327
299
|
setIsLoadingVerifyModal(false);
|
|
328
300
|
}
|
|
329
301
|
}, [errors]);
|
|
330
302
|
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
register('cellphone', {
|
|
305
|
+
required: isRequiredField('cellphone')
|
|
306
|
+
? t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required').replace('_attribute_', t('CELLPHONE', 'Cellphone'))
|
|
307
|
+
: null
|
|
308
|
+
})
|
|
309
|
+
}, [register])
|
|
310
|
+
|
|
311
|
+
useEffect(() => {
|
|
312
|
+
if (phoneInputData?.phone?.cellphone) setValue('cellphone', phoneInputData?.phone?.cellphone, '')
|
|
313
|
+
else setValue('cellphone', '')
|
|
314
|
+
}, [phoneInputData?.phone?.cellphone])
|
|
315
|
+
|
|
331
316
|
useEffect(() => {
|
|
332
317
|
if (verifyPhoneState && !verifyPhoneState?.loading) {
|
|
333
318
|
if (verifyPhoneState.result?.error) {
|
|
@@ -412,48 +397,58 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
412
397
|
!notValidationFields.includes(field.code) &&
|
|
413
398
|
showField &&
|
|
414
399
|
showField(field.code) && (
|
|
415
|
-
<
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
field.code === 'email'
|
|
424
|
-
? theme.images.general.email
|
|
425
|
-
: theme.images.general.user
|
|
426
|
-
}
|
|
427
|
-
value={value}
|
|
428
|
-
onChange={(val: any) =>
|
|
429
|
-
field.code !== 'email'
|
|
430
|
-
? onChange(val)
|
|
431
|
-
: handleChangeInputEmail(val, onChange)
|
|
432
|
-
}
|
|
433
|
-
autoCapitalize={
|
|
434
|
-
field.code === 'email' ? 'none' : 'sentences'
|
|
435
|
-
}
|
|
436
|
-
autoCorrect={field.code === 'email' && false}
|
|
437
|
-
type={
|
|
438
|
-
field.code === 'email' ? 'email-address' : 'default'
|
|
439
|
-
}
|
|
440
|
-
autoCompleteType={
|
|
441
|
-
field.code === 'email' ? 'email' : 'off'
|
|
442
|
-
}
|
|
443
|
-
returnKeyType="next"
|
|
444
|
-
blurOnSubmit={false}
|
|
445
|
-
forwardRef={(ref: any) => handleRefs(ref, field.code)}
|
|
446
|
-
onSubmitEditing={() =>
|
|
447
|
-
field.code === 'email'
|
|
448
|
-
? phoneRef?.current?.focus?.()
|
|
449
|
-
: handleFocusRef(getNextFieldCode(i))
|
|
450
|
-
}
|
|
451
|
-
/>
|
|
400
|
+
<React.Fragment key={field.id}>
|
|
401
|
+
{errors?.[`${field.code}`] && (
|
|
402
|
+
<OText
|
|
403
|
+
size={14}
|
|
404
|
+
color={theme.colors.danger5}
|
|
405
|
+
weight={'normal'}>
|
|
406
|
+
{errors?.[`${field.code}`]?.message} {errors?.[`${field.code}`]?.type === 'required' && '*'}
|
|
407
|
+
</OText>
|
|
452
408
|
)}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
409
|
+
<Controller
|
|
410
|
+
control={control}
|
|
411
|
+
render={({ onChange, value }: any) => (
|
|
412
|
+
<OInput
|
|
413
|
+
placeholder={t(field.name)}
|
|
414
|
+
style={style.inputStyle}
|
|
415
|
+
icon={
|
|
416
|
+
field.code === 'email'
|
|
417
|
+
? theme.images.general.email
|
|
418
|
+
: theme.images.general.user
|
|
419
|
+
}
|
|
420
|
+
value={value}
|
|
421
|
+
onChange={(val: any) =>
|
|
422
|
+
field.code !== 'email'
|
|
423
|
+
? onChange(val)
|
|
424
|
+
: handleChangeInputEmail(val, onChange)
|
|
425
|
+
}
|
|
426
|
+
autoCapitalize={
|
|
427
|
+
field.code === 'email' ? 'none' : 'sentences'
|
|
428
|
+
}
|
|
429
|
+
autoCorrect={field.code === 'email' && false}
|
|
430
|
+
type={
|
|
431
|
+
field.code === 'email' ? 'email-address' : 'default'
|
|
432
|
+
}
|
|
433
|
+
autoCompleteType={
|
|
434
|
+
field.code === 'email' ? 'email' : 'off'
|
|
435
|
+
}
|
|
436
|
+
returnKeyType="next"
|
|
437
|
+
blurOnSubmit={false}
|
|
438
|
+
forwardRef={(ref: any) => handleRefs(ref, field.code)}
|
|
439
|
+
onSubmitEditing={() =>
|
|
440
|
+
field.code === 'email'
|
|
441
|
+
? phoneRef?.current?.focus?.()
|
|
442
|
+
: handleFocusRef(getNextFieldCode(i))
|
|
443
|
+
}
|
|
444
|
+
borderColor={errors?.[`${field.code}`] ? theme.colors.danger5 : theme.colors.border}
|
|
445
|
+
/>
|
|
446
|
+
)}
|
|
447
|
+
name={field.code}
|
|
448
|
+
rules={getInputRules(field)}
|
|
449
|
+
defaultValue=""
|
|
450
|
+
/>
|
|
451
|
+
</React.Fragment>
|
|
457
452
|
),
|
|
458
453
|
)}
|
|
459
454
|
|
|
@@ -467,6 +462,7 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
467
462
|
returnKeyType: 'next',
|
|
468
463
|
onSubmitEditing: () => passwordRef?.current?.focus?.(),
|
|
469
464
|
}}
|
|
465
|
+
isStartValidation={errors?.cellphone}
|
|
470
466
|
/>
|
|
471
467
|
</View>
|
|
472
468
|
)}
|
|
@@ -499,99 +495,122 @@ const SignupFormUI = (props: SignupParams) => {
|
|
|
499
495
|
</View>
|
|
500
496
|
|
|
501
497
|
{configs?.terms_and_conditions?.value === 'true' && (
|
|
502
|
-
|
|
498
|
+
<>
|
|
499
|
+
{errors?.termsAccept && (
|
|
500
|
+
<OText
|
|
501
|
+
size={14}
|
|
502
|
+
color={theme.colors.danger5}
|
|
503
|
+
weight={'normal'}>
|
|
504
|
+
{errors?.termsAccept?.message}*
|
|
505
|
+
</OText>
|
|
506
|
+
)}
|
|
507
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 20 }}>
|
|
508
|
+
<Controller
|
|
509
|
+
control={control}
|
|
510
|
+
render={({ onChange, value }: any) => (
|
|
511
|
+
<CheckBox
|
|
512
|
+
value={value}
|
|
513
|
+
onValueChange={newValue => {
|
|
514
|
+
onChange(newValue)
|
|
515
|
+
}}
|
|
516
|
+
boxType={'square'}
|
|
517
|
+
tintColors={{
|
|
518
|
+
true: theme.colors.primary,
|
|
519
|
+
false: theme.colors.disabled
|
|
520
|
+
}}
|
|
521
|
+
tintColor={theme.colors.disabled}
|
|
522
|
+
onCheckColor={theme.colors.primary}
|
|
523
|
+
onTintColor={theme.colors.primary}
|
|
524
|
+
style={Platform.OS === 'ios' && style.checkBoxStyle}
|
|
525
|
+
/>
|
|
526
|
+
)}
|
|
527
|
+
name='termsAccept'
|
|
528
|
+
rules={{
|
|
529
|
+
required: t('VALIDATION_ERROR_ACCEPTED', 'The _attribute_ must be accepted.').replace('_attribute_', t('TERMS_AND_CONDITIONS', 'Terms & Conditions'))
|
|
530
|
+
}}
|
|
531
|
+
defaultValue={false}
|
|
532
|
+
/>
|
|
533
|
+
<OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('TERMS_AND_CONDITIONS_TEXT', 'I agree with')}</OText>
|
|
534
|
+
<OButton
|
|
535
|
+
imgRightSrc={null}
|
|
536
|
+
text={t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
|
|
537
|
+
bgColor='#FFF'
|
|
538
|
+
borderColor='#FFF'
|
|
539
|
+
style={{ paddingLeft: 0, paddingRight: 0, height: 30, shadowColor: '#FFF' }}
|
|
540
|
+
textStyle={{ color: theme.colors.primary, marginLeft: 0, marginRight: 0 }}
|
|
541
|
+
onClick={() => handleOpenTermsUrl(configs?.terms_and_conditions_url?.value)}
|
|
542
|
+
/>
|
|
543
|
+
</View>
|
|
544
|
+
</>
|
|
545
|
+
|
|
546
|
+
)}
|
|
547
|
+
|
|
548
|
+
{signupTab !== 'cellphone' && (
|
|
549
|
+
<>
|
|
550
|
+
{errors?.password && (
|
|
551
|
+
<OText
|
|
552
|
+
size={14}
|
|
553
|
+
color={theme.colors.danger5}
|
|
554
|
+
weight={'normal'}>
|
|
555
|
+
{errors?.password?.message} {errors?.password?.type === 'required' && '*'}
|
|
556
|
+
</OText>
|
|
557
|
+
)}
|
|
503
558
|
<Controller
|
|
504
559
|
control={control}
|
|
505
560
|
render={({ onChange, value }: any) => (
|
|
506
|
-
<
|
|
561
|
+
<OInput
|
|
562
|
+
isSecured={!passwordSee ? true : false}
|
|
563
|
+
placeholder={t('PASSWORD', 'Password')}
|
|
564
|
+
style={style.inputStyle}
|
|
565
|
+
icon={theme.images.general.lock}
|
|
566
|
+
iconCustomRight={
|
|
567
|
+
!passwordSee ? (
|
|
568
|
+
<MaterialCommunityIcons
|
|
569
|
+
name="eye-outline"
|
|
570
|
+
color={theme.colors.disabled}
|
|
571
|
+
size={24}
|
|
572
|
+
onPress={() => setPasswordSee(!passwordSee)}
|
|
573
|
+
/>
|
|
574
|
+
) : (
|
|
575
|
+
<MaterialCommunityIcons
|
|
576
|
+
name="eye-off-outline"
|
|
577
|
+
color={theme.colors.disabled}
|
|
578
|
+
size={24}
|
|
579
|
+
onPress={() => setPasswordSee(!passwordSee)}
|
|
580
|
+
/>
|
|
581
|
+
)
|
|
582
|
+
}
|
|
507
583
|
value={value}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
false: theme.colors.disabled
|
|
515
|
-
}}
|
|
516
|
-
tintColor={theme.colors.disabled}
|
|
517
|
-
onCheckColor={theme.colors.primary}
|
|
518
|
-
onTintColor={theme.colors.primary}
|
|
519
|
-
style={Platform.OS === 'ios' && style.checkBoxStyle}
|
|
584
|
+
onChange={(val: any) => onChange(val)}
|
|
585
|
+
returnKeyType="done"
|
|
586
|
+
onSubmitEditing={handleSubmit(onSubmit)}
|
|
587
|
+
blurOnSubmit
|
|
588
|
+
forwardRef={passwordRef}
|
|
589
|
+
borderColor={errors?.password ? theme.colors.danger5 : theme.colors.border}
|
|
520
590
|
/>
|
|
521
591
|
)}
|
|
522
|
-
name=
|
|
592
|
+
name="password"
|
|
523
593
|
rules={{
|
|
524
|
-
required:
|
|
594
|
+
required: isRequiredField('password')
|
|
595
|
+
? t(
|
|
596
|
+
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
597
|
+
'The field Password is required',
|
|
598
|
+
).replace('_attribute_', t('PASSWORD', 'password'))
|
|
599
|
+
: null,
|
|
600
|
+
minLength: {
|
|
601
|
+
value: 8,
|
|
602
|
+
message: t(
|
|
603
|
+
'VALIDATION_ERROR_PASSWORD_MIN_STRING',
|
|
604
|
+
'The Password must be at least 8 characters.',
|
|
605
|
+
)
|
|
606
|
+
.replace('_attribute_', t('PASSWORD', 'Password'))
|
|
607
|
+
.replace('_min_', 8),
|
|
608
|
+
},
|
|
525
609
|
}}
|
|
526
|
-
defaultValue=
|
|
527
|
-
/>
|
|
528
|
-
<OText style={{ fontSize: 14, paddingHorizontal: 5 }}>{t('TERMS_AND_CONDITIONS_TEXT', 'I agree with')}</OText>
|
|
529
|
-
<OButton
|
|
530
|
-
imgRightSrc={null}
|
|
531
|
-
text={t('TERMS_AND_CONDITIONS', 'Terms & Conditions')}
|
|
532
|
-
bgColor='#FFF'
|
|
533
|
-
borderColor='#FFF'
|
|
534
|
-
style={{ paddingLeft: 0, paddingRight: 0, height: 30, shadowColor: '#FFF' }}
|
|
535
|
-
textStyle={{ color: theme.colors.primary, marginLeft: 0, marginRight: 0 }}
|
|
536
|
-
onClick={() => handleOpenTermsUrl(configs?.terms_and_conditions_url?.value)}
|
|
610
|
+
defaultValue=""
|
|
537
611
|
/>
|
|
538
|
-
|
|
539
|
-
)}
|
|
612
|
+
</>
|
|
540
613
|
|
|
541
|
-
{signupTab !== 'cellphone' && (
|
|
542
|
-
<Controller
|
|
543
|
-
control={control}
|
|
544
|
-
render={({ onChange, value }: any) => (
|
|
545
|
-
<OInput
|
|
546
|
-
isSecured={!passwordSee ? true : false}
|
|
547
|
-
placeholder={t('PASSWORD', 'Password')}
|
|
548
|
-
style={style.inputStyle}
|
|
549
|
-
icon={theme.images.general.lock}
|
|
550
|
-
iconCustomRight={
|
|
551
|
-
!passwordSee ? (
|
|
552
|
-
<MaterialCommunityIcons
|
|
553
|
-
name="eye-outline"
|
|
554
|
-
color={theme.colors.disabled}
|
|
555
|
-
size={24}
|
|
556
|
-
onPress={() => setPasswordSee(!passwordSee)}
|
|
557
|
-
/>
|
|
558
|
-
) : (
|
|
559
|
-
<MaterialCommunityIcons
|
|
560
|
-
name="eye-off-outline"
|
|
561
|
-
color={theme.colors.disabled}
|
|
562
|
-
size={24}
|
|
563
|
-
onPress={() => setPasswordSee(!passwordSee)}
|
|
564
|
-
/>
|
|
565
|
-
)
|
|
566
|
-
}
|
|
567
|
-
value={value}
|
|
568
|
-
onChange={(val: any) => onChange(val)}
|
|
569
|
-
returnKeyType="done"
|
|
570
|
-
onSubmitEditing={handleSubmit(onSubmit)}
|
|
571
|
-
blurOnSubmit
|
|
572
|
-
forwardRef={passwordRef}
|
|
573
|
-
/>
|
|
574
|
-
)}
|
|
575
|
-
name="password"
|
|
576
|
-
rules={{
|
|
577
|
-
required: isRequiredField('password')
|
|
578
|
-
? t(
|
|
579
|
-
'VALIDATION_ERROR_PASSWORD_REQUIRED',
|
|
580
|
-
'The field Password is required',
|
|
581
|
-
).replace('_attribute_', t('PASSWORD', 'password'))
|
|
582
|
-
: null,
|
|
583
|
-
minLength: {
|
|
584
|
-
value: 8,
|
|
585
|
-
message: t(
|
|
586
|
-
'VALIDATION_ERROR_PASSWORD_MIN_STRING',
|
|
587
|
-
'The Password must be at least 8 characters.',
|
|
588
|
-
)
|
|
589
|
-
.replace('_attribute_', t('PASSWORD', 'Password'))
|
|
590
|
-
.replace('_min_', 8),
|
|
591
|
-
},
|
|
592
|
-
}}
|
|
593
|
-
defaultValue=""
|
|
594
|
-
/>
|
|
595
614
|
)}
|
|
596
615
|
</>
|
|
597
616
|
) : (
|