ordering-ui-react-native 0.12.70 → 0.12.74
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/ActiveOrders/styles.tsx +1 -1
- package/src/components/Messages/index.tsx +1 -1
- package/src/utils/index.tsx +3 -1
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +7 -7
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +1 -1
- package/themes/doordash/src/components/BusinessProductsCategories/index.tsx +30 -30
- package/themes/instacart/src/components/ActiveOrders/styles.tsx +1 -1
- package/themes/original/src/components/ActiveOrders/index.tsx +3 -5
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +29 -32
- package/themes/original/src/components/BusinessProductsListing/index.tsx +25 -8
- package/themes/original/src/components/BusinessTypeFilter/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +1 -1
- package/themes/original/src/types/index.tsx +3 -1
- package/themes/uber-eats/src/components/Account/index.tsx +3 -2
- package/themes/uber-eats/src/components/ActiveOrders/styles.tsx +1 -1
- package/themes/uber-eats/src/components/AddressList/index.tsx +0 -8
- package/themes/uber-eats/src/layouts/Container.tsx +8 -9
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const ActiveOrdersContainer = styled.ScrollView`
|
|
4
4
|
margin-bottom: 20px;
|
|
5
|
-
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '
|
|
5
|
+
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
6
6
|
max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
7
7
|
`
|
|
8
8
|
|
|
@@ -118,7 +118,7 @@ const MessagesUI = (props: MessagesParams) => {
|
|
|
118
118
|
const messageConsole = (message: any) => {
|
|
119
119
|
return message.change?.attribute !== 'driver_id'
|
|
120
120
|
?
|
|
121
|
-
`${t('ORDER', 'Order')} ${message.change.attribute} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
121
|
+
`${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
|
|
122
122
|
: message.change.new
|
|
123
123
|
?
|
|
124
124
|
`${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
|
package/src/utils/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import FontAwesome from 'react-native-vector-icons/FontAwesome';
|
|
3
3
|
import {CODES} from 'ordering-components/native'
|
|
4
|
+
import { useLanguage } from 'ordering-components/native'
|
|
4
5
|
|
|
5
6
|
export const flatArray = (arr: any) => [].concat(...arr)
|
|
6
7
|
|
|
@@ -42,10 +43,11 @@ export const getTraduction = (key: string, t: any) => {
|
|
|
42
43
|
* @param {string} time business delivery time
|
|
43
44
|
*/
|
|
44
45
|
export const convertHoursToMinutes = (time: any) => {
|
|
46
|
+
const [, t] = useLanguage()
|
|
45
47
|
if (!time) return '0min'
|
|
46
48
|
const [hour, minute] = time.split(':')
|
|
47
49
|
const result = (parseInt(hour, 10) * 60) + parseInt(minute, 10)
|
|
48
|
-
return `${result}min`
|
|
50
|
+
return `${result}${t('MIN', 'min')}`
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export const getIconCard = (brand: string, size: number) => {
|
|
@@ -150,11 +150,11 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
150
150
|
{t('CUSTOMER_DETAILS', 'Customer details')}
|
|
151
151
|
</OText>
|
|
152
152
|
{
|
|
153
|
-
(order?.customer?.name || order?.customer?.lastname) && (
|
|
153
|
+
(!!order?.customer?.name || !!order?.customer?.lastname) && (
|
|
154
154
|
<View style={{ flexDirection: 'row' }}>
|
|
155
155
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', flex: 1 }}>
|
|
156
156
|
<View style={{ flexDirection: 'row' }}>
|
|
157
|
-
{order?.customer?.name && (
|
|
157
|
+
{!!order?.customer?.name && (
|
|
158
158
|
<OText
|
|
159
159
|
numberOfLines={1}
|
|
160
160
|
mBottom={4}
|
|
@@ -163,7 +163,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
163
163
|
{order?.customer?.name}
|
|
164
164
|
</OText>
|
|
165
165
|
)}
|
|
166
|
-
{order?.customer?.middle_name && (
|
|
166
|
+
{!!order?.customer?.middle_name && (
|
|
167
167
|
<OText
|
|
168
168
|
numberOfLines={1}
|
|
169
169
|
mBottom={4}
|
|
@@ -172,7 +172,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
172
172
|
{order?.customer?.middle_name}
|
|
173
173
|
</OText>
|
|
174
174
|
)}
|
|
175
|
-
{order?.customer?.lastname && (
|
|
175
|
+
{!!order?.customer?.lastname && (
|
|
176
176
|
<OText
|
|
177
177
|
numberOfLines={1}
|
|
178
178
|
mBottom={4}
|
|
@@ -182,7 +182,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
182
182
|
</OText>
|
|
183
183
|
)}
|
|
184
184
|
{
|
|
185
|
-
order?.customer?.second_lastname && (
|
|
185
|
+
!!order?.customer?.second_lastname && (
|
|
186
186
|
<OText
|
|
187
187
|
numberOfLines={1}
|
|
188
188
|
mBottom={4}
|
|
@@ -193,7 +193,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
193
193
|
)
|
|
194
194
|
}
|
|
195
195
|
</View>
|
|
196
|
-
{order?.user_review?.qualification && (
|
|
196
|
+
{!!order?.user_review?.qualification && (
|
|
197
197
|
<View style={{ flexDirection: 'row' }}>
|
|
198
198
|
<MaterialIcon style={{ bottom: 2 }} name='star' size={24} color={theme.colors.arrowColor} />
|
|
199
199
|
<OText mLeft={5}>
|
|
@@ -440,7 +440,7 @@ export const OrderContentComponent = (props: OrderContent) => {
|
|
|
440
440
|
{parsePrice(order?.summary?.total ?? 0)}
|
|
441
441
|
</OText>
|
|
442
442
|
</Table>
|
|
443
|
-
{order?.comment && (
|
|
443
|
+
{!!order?.comment && (
|
|
444
444
|
<Table>
|
|
445
445
|
<OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
|
|
446
446
|
<OText style={{ maxWidth: '70%' }}>
|
|
@@ -161,7 +161,7 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
|
|
|
161
161
|
|
|
162
162
|
<OText numberOfLines={2} size={20} weight="600">
|
|
163
163
|
<>
|
|
164
|
-
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order
|
|
164
|
+
{`${t('INVOICE_ORDER_NO', 'Order No.')} ${order?.id} `}
|
|
165
165
|
{!order?.isLogistic && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
|
|
166
166
|
<>
|
|
167
167
|
{t('IS', 'is')}{' '}
|
|
@@ -26,7 +26,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
26
26
|
|
|
27
27
|
const [tabLayouts, setTabLayouts] = useState<any>({});
|
|
28
28
|
const [scrollOffsetX, setScrollOffsetX] = useState<any>(0);
|
|
29
|
-
|
|
29
|
+
const tabsRef = useRef<any>(null);
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
const theme = useTheme();
|
|
@@ -56,47 +56,47 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
56
56
|
const handleCategoryScroll = (category: any) => {
|
|
57
57
|
setCategoryClicked(true);
|
|
58
58
|
setSelectedCategoryId(`cat_${category?.id}`);
|
|
59
|
-
|
|
60
|
-
if (!lazyLoadProductsRecommended) {
|
|
61
|
-
if (category?.id) {
|
|
62
|
-
scrollViewRef.current.scrollTo({
|
|
63
|
-
y: categoriesLayout[`cat_${category?.id}`]?.y + productListLayout?.y + 270,
|
|
64
|
-
animated: true
|
|
65
|
-
})
|
|
66
|
-
} else {
|
|
67
|
-
scrollViewRef.current.scrollTo({
|
|
68
|
-
y: productListLayout?.y - 70,
|
|
69
|
-
animated: true
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
handlerClickCategory(category)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
59
|
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
if (!lazyLoadProductsRecommended) {
|
|
61
|
+
if (category?.id) {
|
|
62
|
+
scrollViewRef.current.scrollTo({
|
|
63
|
+
y: categoriesLayout[`cat_${category?.id}`]?.y + productListLayout?.y + 270,
|
|
64
|
+
animated: true
|
|
65
|
+
})
|
|
66
|
+
} else {
|
|
67
|
+
scrollViewRef.current.scrollTo({
|
|
68
|
+
y: productListLayout?.y - 70,
|
|
69
|
+
animated: true
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
handlerClickCategory(category)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
const handleOnLayout = (event: any, categoryId: any) => {
|
|
79
79
|
const _tabLayouts = { ...tabLayouts }
|
|
80
80
|
const categoryKey = 'cat_' + categoryId
|
|
81
81
|
_tabLayouts[categoryKey] = event.nativeEvent.layout
|
|
82
82
|
setTabLayouts(_tabLayouts)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
if (!selectedCategoryId || Object.keys(tabLayouts).length === 0) return
|
|
87
|
+
tabsRef.current.scrollTo({
|
|
88
|
+
x: tabLayouts[selectedCategoryId]?.x - 40,
|
|
89
|
+
animated: true
|
|
90
|
+
})
|
|
91
|
+
}, [selectedCategoryId, tabLayouts])
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
return (
|
|
95
|
-
<ScrollView ref={tabsRef} horizontal contentContainerStyle={contentStyle}
|
|
95
|
+
<ScrollView ref={tabsRef} horizontal contentContainerStyle={contentStyle}
|
|
96
96
|
style={{ ...styles.container, borderBottomWidth: loading ? 0 : 1 }} showsHorizontalScrollIndicator={false}
|
|
97
97
|
onScroll={(e: any) => setScrollOffsetX(e.nativeEvent.contentOffset.x)}
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
scrollEventThrottle={16}
|
|
99
|
+
>
|
|
100
100
|
{loading && (
|
|
101
101
|
<Placeholder Animation={Fade}>
|
|
102
102
|
<View style={{ flexDirection: 'row' }}>
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const ActiveOrdersContainer = styled.ScrollView`
|
|
4
4
|
margin-bottom: 20px;
|
|
5
|
-
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '
|
|
5
|
+
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
6
6
|
max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
7
7
|
`
|
|
8
8
|
|
|
@@ -117,10 +117,8 @@ export const ActiveOrders = (props: ActiveOrdersParams) => {
|
|
|
117
117
|
{pagination?.totalPages && pagination?.currentPage < pagination?.totalPages && (
|
|
118
118
|
<LoadMore>
|
|
119
119
|
<OButton
|
|
120
|
-
|
|
121
|
-
textStyle={{ color: theme.colors.primary, fontSize: 14 }}
|
|
120
|
+
textStyle={{ color: '#fff' }}
|
|
122
121
|
text={t('LOAD_MORE_ORDERS', 'Load more orders')}
|
|
123
|
-
borderColor={theme.colors.primary}
|
|
124
122
|
onClick={loadMoreOrders}
|
|
125
123
|
style={styles.loadMoreButton}
|
|
126
124
|
/>
|
|
@@ -154,9 +152,9 @@ const styles = StyleSheet.create({
|
|
|
154
152
|
minWidth: 230,
|
|
155
153
|
},
|
|
156
154
|
loadMoreButton: {
|
|
157
|
-
width:
|
|
158
|
-
height: 46,
|
|
155
|
+
width: '100%',
|
|
159
156
|
marginLeft: 'auto',
|
|
160
157
|
marginRight: 'auto',
|
|
158
|
+
borderRadius: 7.6
|
|
161
159
|
},
|
|
162
160
|
});
|
|
@@ -18,7 +18,9 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
18
18
|
categoriesLayout,
|
|
19
19
|
selectedCategoryId,
|
|
20
20
|
handlerClickCategory,
|
|
21
|
-
lazyLoadProductsRecommended
|
|
21
|
+
lazyLoadProductsRecommended,
|
|
22
|
+
setCategoryClicked,
|
|
23
|
+
setSelectedCategoryId
|
|
22
24
|
} = props;
|
|
23
25
|
|
|
24
26
|
const theme = useTheme();
|
|
@@ -36,9 +38,23 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
36
38
|
featuredStyle: {
|
|
37
39
|
display: 'none',
|
|
38
40
|
},
|
|
41
|
+
tabStyle: {
|
|
42
|
+
marginTop: 10,
|
|
43
|
+
height: 4,
|
|
44
|
+
borderTopStartRadius: 4,
|
|
45
|
+
borderTopEndRadius: 4,
|
|
46
|
+
backgroundColor: theme.colors.textPrimary,
|
|
47
|
+
},
|
|
48
|
+
tabDeactived: {
|
|
49
|
+
marginTop: 10,
|
|
50
|
+
height: 4
|
|
51
|
+
}
|
|
39
52
|
});
|
|
40
53
|
|
|
41
54
|
const handleCategoryScroll = (category: any) => {
|
|
55
|
+
setCategoryClicked(true);
|
|
56
|
+
setSelectedCategoryId(`cat_${category?.id}`);
|
|
57
|
+
|
|
42
58
|
if (!lazyLoadProductsRecommended) {
|
|
43
59
|
if (category?.id) {
|
|
44
60
|
scrollViewRef.current.scrollTo({
|
|
@@ -57,11 +73,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
57
73
|
}
|
|
58
74
|
|
|
59
75
|
const handleOnLayout = (event: any, categoryId: any) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
const _tabLayouts = { ...tabLayouts }
|
|
77
|
+
const categoryKey = 'cat_' + categoryId
|
|
78
|
+
_tabLayouts[categoryKey] = event.nativeEvent.layout
|
|
79
|
+
setTabLayouts(_tabLayouts)
|
|
80
|
+
}
|
|
65
81
|
|
|
66
82
|
useEffect(() => {
|
|
67
83
|
if (!selectedCategoryId || Object.keys(tabLayouts).length === 0) return
|
|
@@ -102,39 +118,20 @@ const BusinessProductsCategoriesUI = (props: any) => {
|
|
|
102
118
|
{
|
|
103
119
|
borderColor:
|
|
104
120
|
(!lazyLoadProductsRecommended
|
|
105
|
-
?
|
|
106
|
-
:
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
? (selectedCategoryId === (category.id ? `cat_${category.id}` : null))
|
|
122
|
+
: (categorySelected?.id === category.id))
|
|
123
|
+
? theme.colors.textNormal
|
|
124
|
+
: theme.colors.border,
|
|
109
125
|
},
|
|
110
126
|
]}
|
|
111
127
|
onLayout={(event: any) => handleOnLayout(event, category.id)}
|
|
112
128
|
>
|
|
113
129
|
<OText
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
? (selectedCategoryId === (category.id ? `cat_${category.id}` : null))
|
|
117
|
-
: (categorySelected?.id === category.id))
|
|
118
|
-
? 14
|
|
119
|
-
: 12
|
|
120
|
-
}
|
|
121
|
-
weight={
|
|
122
|
-
(!lazyLoadProductsRecommended
|
|
123
|
-
? (selectedCategoryId === (category.id ? `cat_${category.id}` : null))
|
|
124
|
-
: (categorySelected?.id === category.id))
|
|
125
|
-
? '600'
|
|
126
|
-
: '400'
|
|
127
|
-
}
|
|
128
|
-
color={
|
|
129
|
-
(!lazyLoadProductsRecommended
|
|
130
|
-
? (selectedCategoryId === (category.id ? `cat_${category.id}` : null))
|
|
131
|
-
: (categorySelected?.id === category.id))
|
|
132
|
-
? theme.colors.textNormal
|
|
133
|
-
: theme.colors.textSecondary
|
|
134
|
-
}
|
|
135
|
-
style={{ alignSelf: 'center' }}>
|
|
130
|
+
color={selectedCategoryId === `cat_${category.id}` ? theme.colors.textPrimary : theme.colors.textSecondary}
|
|
131
|
+
>
|
|
136
132
|
{category.name}
|
|
137
133
|
</OText>
|
|
134
|
+
<View style={selectedCategoryId === `cat_${category.id}` ? styles.tabStyle : styles.tabDeactived} />
|
|
138
135
|
</Tab>
|
|
139
136
|
))}
|
|
140
137
|
</ScrollView>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, SafeAreaView, Platform } from 'react-native'
|
|
3
3
|
import { useTheme } from 'styled-components/native';
|
|
4
4
|
import {
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
import { FloatingButton } from '../FloatingButton'
|
|
28
28
|
import { ProductForm } from '../ProductForm'
|
|
29
29
|
import { UpsellingProducts } from '../UpsellingProducts'
|
|
30
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
31
|
+
import Animated from 'react-native-reanimated'
|
|
30
32
|
|
|
31
33
|
const PIXELS_TO_SCROLL = 1000
|
|
32
34
|
|
|
@@ -53,7 +55,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
53
55
|
const [{ auth }] = useSession()
|
|
54
56
|
const [orderState] = useOrder()
|
|
55
57
|
const [{ parsePrice }] = useUtils()
|
|
56
|
-
|
|
58
|
+
const [, { showToast }] = useToast()
|
|
59
|
+
const { top } = useSafeAreaInsets();
|
|
57
60
|
|
|
58
61
|
const styles = StyleSheet.create({
|
|
59
62
|
mainContainer: {
|
|
@@ -90,6 +93,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
90
93
|
const scrollViewRef = useRef<any>(null)
|
|
91
94
|
const [categoriesLayout, setCategoriesLayout] = useState<any>({})
|
|
92
95
|
const [productListLayout, setProductListLayout] = useState<any>(null)
|
|
96
|
+
const [isCategoryClicked, setCategoryClicked] = useState(false)
|
|
93
97
|
|
|
94
98
|
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
95
99
|
|
|
@@ -131,7 +135,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
131
135
|
|
|
132
136
|
const [selectedCategoryId, setSelectedCategoryId] = useState<any>(null)
|
|
133
137
|
|
|
134
|
-
const
|
|
138
|
+
const handlePageScroll = useCallback(({ nativeEvent }: any) => {
|
|
135
139
|
const scrollOffset = nativeEvent.contentOffset.y
|
|
136
140
|
if (businessState?.business?.lazy_load_products_recommended) {
|
|
137
141
|
const height = nativeEvent.contentSize.height
|
|
@@ -141,9 +145,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
141
145
|
showToast(ToastType.Info, t('LOADING_MORE_PRODUCTS', 'Loading more products'))
|
|
142
146
|
}
|
|
143
147
|
} else {
|
|
144
|
-
if (!scrollOffset || !categoriesLayout || !productListLayout) return
|
|
148
|
+
if (!scrollOffset || !categoriesLayout || !productListLayout || isCategoryClicked) return
|
|
149
|
+
|
|
145
150
|
for (const key in categoriesLayout) {
|
|
146
151
|
const categoryOffset = categoriesLayout[key].y + productListLayout?.y - 70
|
|
152
|
+
if (scrollOffset < 10) {
|
|
153
|
+
setSelectedCategoryId('cat_all');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
147
156
|
if (categoryOffset - 50 <= scrollOffset && scrollOffset <= categoryOffset + 50) {
|
|
148
157
|
if (selectedCategoryId !== key) {
|
|
149
158
|
setSelectedCategoryId(key)
|
|
@@ -151,7 +160,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
}
|
|
154
|
-
}
|
|
163
|
+
}, [isCategoryClicked, selectedCategoryId, productListLayout])
|
|
164
|
+
|
|
165
|
+
const handleTouchDrag = useCallback(() => {
|
|
166
|
+
setCategoryClicked(false);
|
|
167
|
+
}, []);
|
|
168
|
+
|
|
155
169
|
|
|
156
170
|
useEffect(() => {
|
|
157
171
|
if (!orderState.loading) {
|
|
@@ -163,7 +177,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
163
177
|
<SafeAreaView
|
|
164
178
|
style={{ flex: 1 }}
|
|
165
179
|
>
|
|
166
|
-
<
|
|
180
|
+
<Animated.View style={{ position: 'relative' }}>
|
|
167
181
|
<TopHeader>
|
|
168
182
|
{!isOpenSearchBar && (
|
|
169
183
|
<>
|
|
@@ -201,13 +215,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
201
215
|
</WrapSearchBar>
|
|
202
216
|
)}
|
|
203
217
|
</TopHeader>
|
|
204
|
-
</
|
|
218
|
+
</Animated.View>
|
|
205
219
|
<BusinessProductsListingContainer
|
|
206
220
|
stickyHeaderIndices={[2]}
|
|
207
221
|
style={styles.mainContainer}
|
|
208
222
|
ref={scrollViewRef}
|
|
209
223
|
isActiveFloatingButtom={currentCart?.products?.length > 0 && categoryState.products.length !== 0}
|
|
210
|
-
onScroll={
|
|
224
|
+
onScroll={handlePageScroll}
|
|
225
|
+
onScrollBeginDrag={handleTouchDrag}
|
|
211
226
|
scrollEventThrottle={16}
|
|
212
227
|
>
|
|
213
228
|
<BusinessBasicInformation
|
|
@@ -232,6 +247,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
232
247
|
categoriesLayout={categoriesLayout}
|
|
233
248
|
selectedCategoryId={selectedCategoryId}
|
|
234
249
|
lazyLoadProductsRecommended={business?.lazy_load_products_recommended}
|
|
250
|
+
setSelectedCategoryId={setSelectedCategoryId}
|
|
251
|
+
setCategoryClicked={setCategoryClicked}
|
|
235
252
|
/>
|
|
236
253
|
)}
|
|
237
254
|
</>
|
|
@@ -203,7 +203,7 @@ export const OrdersOption = (props: OrdersOptionParams) => {
|
|
|
203
203
|
useDefualtSessionManager: true,
|
|
204
204
|
paginationSettings: {
|
|
205
205
|
initialPage: 1,
|
|
206
|
-
pageSize:
|
|
206
|
+
pageSize: 10,
|
|
207
207
|
controlType: 'infinity'
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -170,7 +170,7 @@ export interface BusinessProductsListingParams {
|
|
|
170
170
|
getNextProducts?: () => {};
|
|
171
171
|
handleChangeCategory: (value: any) => {};
|
|
172
172
|
setProductLogin?: () => {};
|
|
173
|
-
updateProductModal?: (value: any) => {}
|
|
173
|
+
updateProductModal?: (value: any) => {};
|
|
174
174
|
}
|
|
175
175
|
export interface BusinessBasicInformationParams {
|
|
176
176
|
navigation?: any;
|
|
@@ -193,6 +193,8 @@ export interface BusinessProductsCategoriesParams {
|
|
|
193
193
|
categoriesLayout?: any;
|
|
194
194
|
selectedCategoryId?: any;
|
|
195
195
|
lazyLoadProductsRecommended?: any;
|
|
196
|
+
setSelectedCategoryId?: any
|
|
197
|
+
setCategoryClicked?: any
|
|
196
198
|
}
|
|
197
199
|
export interface BusinessProductsListParams {
|
|
198
200
|
errors?: any;
|
|
@@ -73,8 +73,9 @@ const AccountUI = (props: AccountParams) => {
|
|
|
73
73
|
console.log('ImagePicker Error: ', response.errorMessage);
|
|
74
74
|
showToast(ToastType.Error, response.errorMessage);
|
|
75
75
|
} else {
|
|
76
|
-
if (response
|
|
77
|
-
const
|
|
76
|
+
if (response?.assets?.[0]?.uri) {
|
|
77
|
+
const image = response?.assets?.[0]
|
|
78
|
+
const url = `data:${image?.type};base64,${image?.base64}`;
|
|
78
79
|
handleButtonUpdateClick(null, true, url);
|
|
79
80
|
} else {
|
|
80
81
|
showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
|
|
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
|
|
|
2
2
|
|
|
3
3
|
export const ActiveOrdersContainer = styled.ScrollView`
|
|
4
4
|
margin-bottom: 20px;
|
|
5
|
-
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '
|
|
5
|
+
height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
6
6
|
max-height: ${({ isMiniCards }: { isMiniCards: boolean }) => !isMiniCards ? '150px' : '220px'};
|
|
7
7
|
`
|
|
8
8
|
|
|
@@ -300,14 +300,6 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
300
300
|
/>
|
|
301
301
|
</>
|
|
302
302
|
)}
|
|
303
|
-
{!isFromProfile && addressList?.addresses?.length > 0 && (
|
|
304
|
-
<OButton
|
|
305
|
-
text={t('CONTINUE', 'Continue')}
|
|
306
|
-
style={styles.button}
|
|
307
|
-
onClick={() => onNavigatorRedirect()}
|
|
308
|
-
textStyle={{ color: theme.colors.white }}
|
|
309
|
-
/>
|
|
310
|
-
)}
|
|
311
303
|
</AddressListContainer>
|
|
312
304
|
)}
|
|
313
305
|
</Container>
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import styled, { css } from 'styled-components/native';
|
|
3
4
|
|
|
4
5
|
const ContainerStyled = styled.ScrollView`
|
|
5
6
|
flex: 1;
|
|
7
|
+
${(props: any) => !props.nopadding && css`
|
|
8
|
+
padding: ${Platform.OS === 'ios' ? '0px 30px 0px' : '30px'};
|
|
9
|
+
`}
|
|
10
|
+
background-color: ${(props: any) => props.theme.colors.backgroundPage};
|
|
6
11
|
`;
|
|
7
12
|
|
|
8
13
|
const SafeAreaStyled = styled.SafeAreaView`
|
|
@@ -10,19 +15,13 @@ const SafeAreaStyled = styled.SafeAreaView`
|
|
|
10
15
|
background-color: ${(props: any) => props.theme.colors.backgroundPage};
|
|
11
16
|
`;
|
|
12
17
|
|
|
13
|
-
const ContentView = styled.View`
|
|
14
|
-
padding-horizontal: 30px;
|
|
15
|
-
`
|
|
16
|
-
|
|
17
18
|
|
|
18
19
|
export const Container = (props: any) => {
|
|
19
20
|
return (
|
|
20
21
|
<SafeAreaStyled>
|
|
21
|
-
<ContainerStyled ref={props?.forwardRef} keyboardShouldPersistTaps='handled'>
|
|
22
|
-
<ContentView>
|
|
22
|
+
<ContainerStyled ref={props?.forwardRef} style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
|
|
23
23
|
{props.children}
|
|
24
|
-
</ContentView>
|
|
25
24
|
</ContainerStyled>
|
|
26
25
|
</SafeAreaStyled>
|
|
27
26
|
)
|
|
28
|
-
}
|
|
27
|
+
}
|