ordering-ui-react-native 0.19.5-release → 0.19.6-release
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
2
|
-
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler } from 'react-native';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
|
|
3
3
|
import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
|
|
4
4
|
import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
|
|
5
5
|
import Picker from 'react-native-country-picker-modal';
|
|
@@ -448,9 +448,9 @@ const CheckoutUI = (props: any) => {
|
|
|
448
448
|
|
|
449
449
|
return (
|
|
450
450
|
<>
|
|
451
|
-
<
|
|
452
|
-
<
|
|
453
|
-
|
|
451
|
+
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
452
|
+
<View style={styles.wrapperNavbar}>
|
|
453
|
+
<TopHeader>
|
|
454
454
|
<TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
|
|
455
455
|
<IconAntDesign
|
|
456
456
|
name='arrowleft'
|
|
@@ -468,10 +468,10 @@ const CheckoutUI = (props: any) => {
|
|
|
468
468
|
{t('CHECKOUT', 'Checkout')}
|
|
469
469
|
</OText>
|
|
470
470
|
)}
|
|
471
|
-
|
|
472
|
-
</
|
|
473
|
-
</
|
|
474
|
-
<Container forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
471
|
+
</TopHeader>
|
|
472
|
+
</View>
|
|
473
|
+
</SafeAreaView>
|
|
474
|
+
<Container pt={0} forwardRef={containerRef} noPadding onScroll={handleScroll}>
|
|
475
475
|
<View style={styles.wrapperNavbar}>
|
|
476
476
|
<NavBar
|
|
477
477
|
hideArrowLeft
|
|
@@ -10,8 +10,9 @@ import {
|
|
|
10
10
|
ToastType,
|
|
11
11
|
MultiCheckout as MultiCheckoutController
|
|
12
12
|
} from 'ordering-components/native'
|
|
13
|
-
import { View, StyleSheet, Platform, ScrollView } from 'react-native'
|
|
13
|
+
import { View, StyleSheet, Platform, ScrollView, SafeAreaView } from 'react-native'
|
|
14
14
|
import { useTheme } from 'styled-components/native';
|
|
15
|
+
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
15
16
|
import { Container } from '../../layouts/Container';
|
|
16
17
|
import NavBar from '../NavBar';
|
|
17
18
|
import { OText, OIcon, OModal, OButton } from '../shared';
|
|
@@ -30,6 +31,8 @@ import { SignupForm } from '../SignupForm'
|
|
|
30
31
|
import { LoginForm } from '../LoginForm'
|
|
31
32
|
|
|
32
33
|
import {
|
|
34
|
+
TopHeader,
|
|
35
|
+
TopActions,
|
|
33
36
|
ChContainer,
|
|
34
37
|
ChSection,
|
|
35
38
|
ChHeader,
|
|
@@ -76,7 +79,11 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
76
79
|
paddingLeft: 20,
|
|
77
80
|
paddingRight: 20
|
|
78
81
|
},
|
|
79
|
-
wrapperNavbar: {
|
|
82
|
+
wrapperNavbar: {
|
|
83
|
+
paddingHorizontal: 20,
|
|
84
|
+
backgroundColor: theme?.colors?.white,
|
|
85
|
+
borderWidth: 0
|
|
86
|
+
},
|
|
80
87
|
detailWrapper: {
|
|
81
88
|
paddingHorizontal: 20,
|
|
82
89
|
width: '100%'
|
|
@@ -136,6 +143,7 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
136
143
|
?.reduce((sum: any, cart: any) => sum + clearAmount((cart?.subtotal + getIncludedTaxes(cart)) * accumulationRateBusiness(cart?.business_id)), 0)
|
|
137
144
|
?.toFixed(configs.format_number_decimal_length?.value ?? 2)
|
|
138
145
|
|
|
146
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
139
147
|
const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
|
|
140
148
|
const [phoneUpdate, setPhoneUpdate] = useState(false);
|
|
141
149
|
const [userErrors, setUserErrors] = useState<any>([]);
|
|
@@ -233,6 +241,10 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
233
241
|
if (user) setOpenModal({ ...openModal, login: false })
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
245
|
+
setShowTitle(contentOffset.y > 30)
|
|
246
|
+
}
|
|
247
|
+
|
|
236
248
|
useEffect(() => {
|
|
237
249
|
if (validationFields && validationFields?.fields?.checkout) {
|
|
238
250
|
checkValidationFields()
|
|
@@ -273,15 +285,44 @@ const MultiCheckoutUI = (props: any) => {
|
|
|
273
285
|
|
|
274
286
|
return (
|
|
275
287
|
<>
|
|
276
|
-
<
|
|
288
|
+
<SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
|
|
289
|
+
<View style={styles.wrapperNavbar}>
|
|
290
|
+
<TopHeader>
|
|
291
|
+
<>
|
|
292
|
+
<TopActions onPress={() => navigation?.canGoBack() && navigation.goBack()}>
|
|
293
|
+
<IconAntDesign
|
|
294
|
+
name='arrowleft'
|
|
295
|
+
size={26}
|
|
296
|
+
/>
|
|
297
|
+
</TopActions>
|
|
298
|
+
{showTitle && (
|
|
299
|
+
<OText
|
|
300
|
+
size={16}
|
|
301
|
+
style={{ flex: 1, textAlign: 'center', right: 15 }}
|
|
302
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
303
|
+
numberOfLines={2}
|
|
304
|
+
ellipsizeMode='tail'
|
|
305
|
+
>
|
|
306
|
+
{t('CHECKOUT', 'Checkout')}
|
|
307
|
+
</OText>
|
|
308
|
+
)}
|
|
309
|
+
</>
|
|
310
|
+
</TopHeader>
|
|
311
|
+
</View>
|
|
312
|
+
</SafeAreaView>
|
|
313
|
+
<Container pt={0} noPadding onScroll={handleScroll}>
|
|
277
314
|
<View style={styles.wrapperNavbar}>
|
|
278
315
|
<NavBar
|
|
316
|
+
hideArrowLeft
|
|
279
317
|
title={t('CHECKOUT', 'Checkout')}
|
|
280
318
|
titleAlign={'center'}
|
|
281
319
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
282
320
|
showCall={false}
|
|
283
321
|
paddingTop={Platform.OS === 'ios' ? 0 : 4}
|
|
284
322
|
btnStyle={{ paddingLeft: 0 }}
|
|
323
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
324
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
325
|
+
style={{ marginTop: 20 }}
|
|
285
326
|
/>
|
|
286
327
|
</View>
|
|
287
328
|
<ChContainer style={styles.pagePadding}>
|
|
@@ -53,6 +53,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
53
53
|
const [{ configs }] = useConfig()
|
|
54
54
|
|
|
55
55
|
const isTaxIncludedOnPrice = orders.every((_order: any) => _order.taxes?.length ? _order.taxes?.every((_tax: any) => _tax.type === 1) : true)
|
|
56
|
+
const deliveryType = orders.find((order: any) => order.delivery_type)?.delivery_type
|
|
56
57
|
const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
|
|
57
58
|
const showBarInOrder = ['group', 'both']
|
|
58
59
|
const showBarInIndividual = ['individual', 'both']
|
|
@@ -171,19 +172,23 @@ export const MultiOrdersDetailsUI = (props: any) => {
|
|
|
171
172
|
))}
|
|
172
173
|
</Section>
|
|
173
174
|
<Divider />
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
175
|
+
{deliveryType === 1 && (
|
|
176
|
+
<>
|
|
177
|
+
<Section>
|
|
178
|
+
<OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={20}>
|
|
179
|
+
{t('DELIVERYA_V21', 'Delivery address')}
|
|
180
|
+
</OText>
|
|
181
|
+
{loading ? (
|
|
182
|
+
<PlaceholderLine height={18} noMargin style={{ borderRadius: 2 }} />
|
|
183
|
+
) : (
|
|
184
|
+
<OText size={12} lineHeight={18} color={theme.colors.textNormal} mBottom={2}>
|
|
185
|
+
{customer?.address}
|
|
186
|
+
</OText>
|
|
187
|
+
)}
|
|
188
|
+
</Section>
|
|
189
|
+
<Divider />
|
|
190
|
+
</>
|
|
191
|
+
)}
|
|
187
192
|
{loading ? (
|
|
188
193
|
<Placeholder Animation={Fade}>
|
|
189
194
|
<PlaceholderLine
|