ordering-ui-react-native 0.21.8 → 0.21.10
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/components/shared/OToast.tsx +3 -2
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +6 -9
- package/themes/original/src/components/LoginForm/index.tsx +1 -1
- package/themes/original/src/components/ProductForm/index.tsx +1 -1
- package/themes/original/src/components/UserVerification/index.tsx +52 -49
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Animated, StyleSheet, Text, View
|
|
2
|
+
import { Animated, StyleSheet, Text, View } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
3
4
|
import { ToastType, useToast, useLanguage } from "ordering-components/native";
|
|
4
5
|
import { useTheme } from 'styled-components/native';
|
|
5
6
|
import { getTraduction } from '../../utils'
|
|
6
7
|
|
|
7
8
|
const fadeDuration = 300;
|
|
8
|
-
const topPosition = Platform.OS === 'ios' ? 40 : 20
|
|
9
9
|
|
|
10
10
|
export const Toast = (props: any) => {
|
|
11
11
|
const [toastConfig, { hideToast }] = useToast();
|
|
12
12
|
const [, t] = useLanguage()
|
|
13
13
|
const opacity = React.useRef(new Animated.Value(0)).current;
|
|
14
14
|
const theme = useTheme();
|
|
15
|
+
const { top: topPosition } = useSafeAreaInsets();
|
|
15
16
|
|
|
16
17
|
const fadeIn = React.useCallback(() => {
|
|
17
18
|
Animated.timing(opacity, {
|
|
@@ -375,7 +375,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
375
375
|
)}
|
|
376
376
|
<View style={{
|
|
377
377
|
height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
|
|
378
|
-
marginTop: Platform.OS == 'ios' ? 0 : 50,
|
|
378
|
+
marginTop: isChewLayout ? 0 : Platform.OS == 'ios' ? 0 : 50,
|
|
379
379
|
backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
|
|
380
380
|
}}
|
|
381
381
|
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { formatSeconds } from '../../../utils'
|
|
3
|
-
import { StyleSheet, TouchableOpacity, View,
|
|
3
|
+
import { StyleSheet, TouchableOpacity, View, SafeAreaView } from 'react-native';
|
|
4
4
|
import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
|
|
5
5
|
import { useLanguage } from 'ordering-components/native';
|
|
6
6
|
import { OTPContainer } from './styles';
|
|
@@ -87,20 +87,19 @@ export const Otp = (props: otpParams) => {
|
|
|
87
87
|
fontSize: 16
|
|
88
88
|
},
|
|
89
89
|
wrapperIcon: {
|
|
90
|
-
marginTop: Platform.OS === 'ios' ? 40 : 12,
|
|
91
|
-
marginBottom: 20,
|
|
92
90
|
alignItems: 'center',
|
|
93
91
|
justifyContent: 'center',
|
|
94
|
-
paddingRight:
|
|
92
|
+
paddingRight: 20
|
|
95
93
|
},
|
|
96
94
|
closeContainer: {
|
|
97
95
|
width: '100%',
|
|
98
96
|
flexDirection: 'row',
|
|
97
|
+
alignItems: 'center'
|
|
99
98
|
}
|
|
100
99
|
});
|
|
101
100
|
|
|
102
101
|
return (
|
|
103
|
-
|
|
102
|
+
<SafeAreaView style={{ flex: 1, backgroundColor: theme.colors.backgroundPage }}>
|
|
104
103
|
<OTPContainer>
|
|
105
104
|
<View
|
|
106
105
|
style={loginStyle.closeContainer}>
|
|
@@ -110,9 +109,7 @@ export const Otp = (props: otpParams) => {
|
|
|
110
109
|
width={22}
|
|
111
110
|
/>
|
|
112
111
|
</TouchableOpacity>
|
|
113
|
-
<OText size={22}
|
|
114
|
-
marginTop: 5
|
|
115
|
-
}}>
|
|
112
|
+
<OText size={22}>
|
|
116
113
|
{t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
|
|
117
114
|
</OText>
|
|
118
115
|
</View>
|
|
@@ -150,6 +147,6 @@ export const Otp = (props: otpParams) => {
|
|
|
150
147
|
text={t('CANCEL', 'Cancel')}
|
|
151
148
|
/>
|
|
152
149
|
</OTPContainer>
|
|
153
|
-
|
|
150
|
+
</SafeAreaView>
|
|
154
151
|
)
|
|
155
152
|
}
|
|
@@ -179,7 +179,7 @@ const LoginFormUI = (props: LoginParams) => {
|
|
|
179
179
|
vibrateApp()
|
|
180
180
|
return
|
|
181
181
|
}
|
|
182
|
-
if (
|
|
182
|
+
if (otpType === 'cellphone' && phoneInputData?.error && !phoneInputData?.phone?.cellphone) {
|
|
183
183
|
showToast(ToastType.Error, t('PHONE_NUMBER_REQUIRED', 'Phone number is required'));
|
|
184
184
|
return
|
|
185
185
|
}
|
|
@@ -613,7 +613,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
613
613
|
>
|
|
614
614
|
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
615
615
|
<FastImage
|
|
616
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio:
|
|
616
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
617
617
|
source={typeof img !== 'number' ? {
|
|
618
618
|
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
619
619
|
priority: FastImage.priority.normal,
|
|
@@ -195,38 +195,39 @@ const UserVerificationUI = (props: any) => {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
useEffect(() => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
198
|
+
if (verificationState.phone) {
|
|
199
|
+
let _timer = TIME_COUNTDOWN - 1;
|
|
200
|
+
let minutes = 0;
|
|
201
|
+
let seconds = 0;
|
|
202
|
+
const interval = setInterval(() => {
|
|
203
|
+
minutes = _timer / 60;
|
|
204
|
+
seconds = _timer % 60;
|
|
205
|
+
|
|
206
|
+
minutes = minutes < 10 ? 0 + minutes : minutes;
|
|
207
|
+
seconds = seconds < 10 ? 0 + seconds : seconds;
|
|
208
|
+
|
|
209
|
+
const formatMinutes = parseInt(minutes.toString()) < 10
|
|
210
|
+
? `0${parseInt(minutes.toString())}`
|
|
211
|
+
: parseInt(minutes.toString());
|
|
212
|
+
|
|
213
|
+
const formatseconds = parseInt(seconds.toString()) < 10
|
|
214
|
+
? `0${parseInt(seconds.toString())}`
|
|
215
|
+
: parseInt(seconds.toString());
|
|
216
|
+
|
|
217
|
+
setTimer(`${formatMinutes}:${formatseconds}`);
|
|
218
|
+
|
|
219
|
+
if (--_timer < 0) {
|
|
220
|
+
clearInterval(interval);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (timer === `${TIME_COUNTDOWN / 60}:00` && isSendCodeAgain) {
|
|
224
|
+
setIsSendCodeAgain(false)
|
|
225
|
+
clearInterval(interval);
|
|
226
|
+
}
|
|
227
|
+
}, 1000);
|
|
228
|
+
return () => clearInterval(interval)
|
|
229
|
+
}
|
|
230
|
+
}, [isSendCodeAgain, verificationState.phone])
|
|
230
231
|
|
|
231
232
|
useEffect(() => {
|
|
232
233
|
if (otpState?.length === CODE_LENGTH) {
|
|
@@ -460,23 +461,25 @@ const UserVerificationUI = (props: any) => {
|
|
|
460
461
|
)}
|
|
461
462
|
|
|
462
463
|
</Container>
|
|
463
|
-
|
|
464
|
-
<
|
|
465
|
-
<
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
464
|
+
{!!phoneState?.cellphone && (
|
|
465
|
+
<ButtonsActions>
|
|
466
|
+
<View style={{ width: '100%' }}>
|
|
467
|
+
<OButton
|
|
468
|
+
onClick={(verificationState.email || verificationState.phone)
|
|
469
|
+
? () => setVerificationState({ email: false, phone: false })
|
|
470
|
+
: () => handleSendOtp(isPhoneVerifyRequired && !isEmailVerifyRequired ? 'phone' : '')
|
|
471
|
+
}
|
|
472
|
+
text={(verificationState.email || verificationState.phone) ? t('CANCEL', 'Cancel') : t('SEND_CODE', 'Send code')}
|
|
473
|
+
bgColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
|
|
474
|
+
borderColor={(verificationState.email || verificationState.phone) ? theme.colors.secundary : theme.colors.primary}
|
|
475
|
+
textStyle={{ color: (verificationState.email || verificationState.phone) ? 'black' : 'white' }}
|
|
476
|
+
imgRightSrc={null}
|
|
477
|
+
isLoading={verifyEmailState?.loadingSendCode || verifyEmailState?.loadingCheckCode || verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
|
|
478
|
+
style={(verificationState.email || verificationState.phone) ? style.btnStyle : { borderRadius: 7.6 }}
|
|
479
|
+
/>
|
|
480
|
+
</View>
|
|
481
|
+
</ButtonsActions>
|
|
482
|
+
)}
|
|
480
483
|
<View style={{ paddingHorizontal: 20, paddingBottom: 80 }}>
|
|
481
484
|
<UserDetails
|
|
482
485
|
user={user}
|