ordering-ui-react-native 0.11.60 → 0.12.2
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/BusinessBasicInformation/index.tsx +6 -2
- package/src/components/SingleProductCard/index.tsx +14 -4
- package/src/config.json +1 -1
- package/themes/business/index.tsx +2 -1
- package/themes/business/src/components/MapView/index.tsx +52 -21
- package/themes/business/src/components/shared/OFab.tsx +8 -3
- package/themes/business/src/types/index.tsx +3 -1
- package/themes/kiosk/src/components/BusinessMenu/index.tsx +49 -5
- package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +6 -2
- package/themes/kiosk/src/components/CartBottomSheet/index.tsx +10 -1
- package/themes/kiosk/src/components/CartContent/index.tsx +7 -1
- package/themes/kiosk/src/components/CategoriesMenu/index.tsx +11 -1
- package/themes/kiosk/src/components/CustomerName/index.tsx +91 -64
- package/themes/kiosk/src/components/UpsellingProducts/index.tsx +13 -3
- package/themes/kiosk/src/types/index.d.ts +5 -0
- package/themes/single-business/index.tsx +108 -16
- package/themes/single-business/src/components/BusinessBasicInformation/index.tsx +13 -3
- package/themes/single-business/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/single-business/src/components/BusinessInformation/index.tsx +59 -13
- package/themes/single-business/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/single-business/src/components/Checkout/index.tsx +5 -6
- package/themes/single-business/src/components/DriverTips/index.tsx +1 -0
- package/themes/single-business/src/components/DriverTips/styles.tsx +10 -9
- package/themes/single-business/src/components/PaymentOptions/index.tsx +16 -14
- package/themes/single-business/src/components/PaymentOptions/styles.tsx +4 -6
- package/themes/single-business/src/components/shared/index.tsx +10 -8
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
WrapBusinessInfo
|
|
22
22
|
} from './styles'
|
|
23
23
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
24
|
+
import { ScrollView } from 'react-native-gesture-handler';
|
|
24
25
|
const types = ['food', 'laundry', 'alcohol', 'groceries']
|
|
25
26
|
|
|
26
27
|
export const BusinessBasicInformation = (props: BusinessBasicInformationParams) => {
|
|
@@ -83,7 +84,10 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
83
84
|
<PlaceholderLine height={30} width={20} />
|
|
84
85
|
</Placeholder>
|
|
85
86
|
) : (
|
|
86
|
-
<
|
|
87
|
+
<ScrollView
|
|
88
|
+
horizontal
|
|
89
|
+
style={{ maxWidth: isBusinessInfoShow ? '85%' : '75%' }}
|
|
90
|
+
>
|
|
87
91
|
<OText
|
|
88
92
|
size={20}
|
|
89
93
|
weight='bold'
|
|
@@ -92,7 +96,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
|
|
|
92
96
|
>
|
|
93
97
|
{business?.name}
|
|
94
98
|
</OText>
|
|
95
|
-
</
|
|
99
|
+
</ScrollView>
|
|
96
100
|
)}
|
|
97
101
|
{!isBusinessInfoShow && (
|
|
98
102
|
<WrapBusinessInfo
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
2
|
import { useLanguage, useConfig, useOrder, useUtils } from 'ordering-components/native'
|
|
3
3
|
import { SingleProductCardParams } from '../../types'
|
|
4
4
|
import {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { StyleSheet } from 'react-native'
|
|
10
10
|
import { OText, OIcon } from '../shared'
|
|
11
11
|
import { useTheme } from 'styled-components/native'
|
|
12
|
+
import { ScrollView } from 'react-native-gesture-handler'
|
|
12
13
|
|
|
13
14
|
export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
14
15
|
const {
|
|
@@ -33,7 +34,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
33
34
|
soldOutBackgroundStyle: {
|
|
34
35
|
backgroundColor: '#B8B8B8',
|
|
35
36
|
},
|
|
36
|
-
soldOutTextStyle
|
|
37
|
+
soldOutTextStyle: {
|
|
37
38
|
textTransform: 'uppercase'
|
|
38
39
|
},
|
|
39
40
|
productStyle: {
|
|
@@ -62,12 +63,19 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
62
63
|
maxCartProductInventory = !isNaN(maxCartProductInventory) ? maxCartProductInventory : maxCartProductConfig
|
|
63
64
|
|
|
64
65
|
const maxProductQuantity = Math.min(maxCartProductConfig, maxCartProductInventory)
|
|
66
|
+
const descriptionRef = useRef()
|
|
65
67
|
|
|
68
|
+
const handleClickProduct = (e, product) => {
|
|
69
|
+
console.log(descriptionRef?.current?.tar)
|
|
70
|
+
// if (descriptionRef?.current?.contains(e?.target)) {
|
|
71
|
+
// console.log(":)")
|
|
72
|
+
// }
|
|
73
|
+
}
|
|
66
74
|
return (
|
|
67
75
|
<CardContainer
|
|
68
76
|
style={[styles.container, (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle]}
|
|
69
77
|
activeOpacity={1}
|
|
70
|
-
onPress={() =>
|
|
78
|
+
onPress={(e) => handleClickProduct(e, product)}
|
|
71
79
|
>
|
|
72
80
|
<OIcon
|
|
73
81
|
url={optimizeImage(product?.images, 'h_200,c_limit')}
|
|
@@ -75,7 +83,9 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
|
|
|
75
83
|
/>
|
|
76
84
|
<CardInfo>
|
|
77
85
|
<OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
|
|
78
|
-
<
|
|
86
|
+
<ScrollView horizontal ref={(ref : any) => descriptionRef.current = ref}>
|
|
87
|
+
<OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
|
|
88
|
+
</ScrollView>
|
|
79
89
|
<OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
|
|
80
90
|
</CardInfo>
|
|
81
91
|
|
package/src/config.json
CHANGED
|
@@ -34,7 +34,7 @@ import { UserFormDetailsUI } from './src/components/UserFormDetails';
|
|
|
34
34
|
import { UserProfileForm } from './src/components/UserProfileForm';
|
|
35
35
|
import { VerifyPhone } from './src/components/VerifyPhone';
|
|
36
36
|
import { DriverMap } from './src/components/DriverMap';
|
|
37
|
-
|
|
37
|
+
import { MapViewUI as MapView } from './src/components/MapView'
|
|
38
38
|
//OComponents
|
|
39
39
|
import {
|
|
40
40
|
OText,
|
|
@@ -74,6 +74,7 @@ export {
|
|
|
74
74
|
LogoutButton,
|
|
75
75
|
MessagesOption,
|
|
76
76
|
NotFoundSource,
|
|
77
|
+
MapView,
|
|
77
78
|
OrderDetailsBusiness,
|
|
78
79
|
OrderDetailsDelivery,
|
|
79
80
|
OrderMessage,
|
|
@@ -12,16 +12,17 @@ import Alert from '../../providers/AlertProvider';
|
|
|
12
12
|
import { useTheme } from 'styled-components/native';
|
|
13
13
|
import { useLocation } from '../../hooks/useLocation';
|
|
14
14
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
|
15
|
-
import { OIcon, OText } from '../shared'
|
|
16
|
-
|
|
15
|
+
import { OIcon, OText, OFab } from '../shared'
|
|
17
16
|
const MapViewComponent = (props: MapViewParams) => {
|
|
18
17
|
|
|
19
18
|
const {
|
|
20
|
-
onNavigationRedirect,
|
|
21
19
|
isLoadingBusinessMarkers,
|
|
22
|
-
getBusinessLocations,
|
|
23
20
|
markerGroups,
|
|
24
|
-
customerMarkerGroups
|
|
21
|
+
customerMarkerGroups,
|
|
22
|
+
alertState,
|
|
23
|
+
setAlertState,
|
|
24
|
+
onNavigationRedirect,
|
|
25
|
+
getBusinessLocations,
|
|
25
26
|
} = props;
|
|
26
27
|
|
|
27
28
|
const theme = useTheme();
|
|
@@ -29,16 +30,10 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
29
30
|
const [{ user }] = useSession()
|
|
30
31
|
const { width, height } = Dimensions.get('window');
|
|
31
32
|
const ASPECT_RATIO = width / height;
|
|
32
|
-
const mapRef = useRef<MapView>(null);
|
|
33
|
+
const mapRef = useRef<MapView | any>(null);
|
|
33
34
|
const following = useRef<boolean>(true);
|
|
34
35
|
const [isFocused, setIsFocused] = useState(false)
|
|
35
36
|
const [locationSelected, setLocationSelected] = useState<any>(null)
|
|
36
|
-
const [alertState, setAlertState] = useState<{
|
|
37
|
-
open: boolean;
|
|
38
|
-
content: Array<string>;
|
|
39
|
-
key?: string | null;
|
|
40
|
-
}>({ open: false, content: [], key: null });
|
|
41
|
-
|
|
42
37
|
const {
|
|
43
38
|
initialPosition,
|
|
44
39
|
userLocation,
|
|
@@ -72,6 +67,24 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
72
67
|
}
|
|
73
68
|
};
|
|
74
69
|
|
|
70
|
+
const onPressZoomIn = () => {
|
|
71
|
+
const lastRegion = mapRef?.current?.__lastRegion
|
|
72
|
+
mapRef?.current && mapRef.current.animateToRegion({
|
|
73
|
+
...mapRef?.current?.__lastRegion,
|
|
74
|
+
longitudeDelta: lastRegion.longitudeDelta / 8,
|
|
75
|
+
latitudeDelta: lastRegion.longitudeDelta / 8
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const onPressZoomOut = () => {
|
|
80
|
+
const lastRegion = mapRef?.current?.__lastRegion
|
|
81
|
+
mapRef?.current && mapRef.current.animateToRegion({
|
|
82
|
+
...lastRegion,
|
|
83
|
+
longitudeDelta: lastRegion.longitudeDelta * 8,
|
|
84
|
+
latitudeDelta: lastRegion.longitudeDelta * 8
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
75
88
|
useEffect(() => {
|
|
76
89
|
fitCoordinates(locationSelected || userLocation);
|
|
77
90
|
}, [userLocation, locationSelected]);
|
|
@@ -91,7 +104,6 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
91
104
|
};
|
|
92
105
|
}, []);
|
|
93
106
|
|
|
94
|
-
|
|
95
107
|
useFocusEffect(
|
|
96
108
|
useCallback(() => {
|
|
97
109
|
setIsFocused(true)
|
|
@@ -125,8 +137,6 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
125
137
|
markerRef?.current?.props?.coordinate?.longitude === locationSelected?.longitude
|
|
126
138
|
) {
|
|
127
139
|
markerRef?.current?.showCallout()
|
|
128
|
-
} else {
|
|
129
|
-
markerRef?.current?.hideCallout()
|
|
130
140
|
}
|
|
131
141
|
}, [locationSelected])
|
|
132
142
|
|
|
@@ -200,19 +210,20 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
200
210
|
</Marker>
|
|
201
211
|
)
|
|
202
212
|
}
|
|
213
|
+
|
|
203
214
|
return (
|
|
204
215
|
<SafeAreaView style={{ flex: 1 }}>
|
|
205
216
|
<View style={{ flex: 1 }}>
|
|
206
|
-
|
|
207
|
-
{
|
|
217
|
+
{!isLoadingBusinessMarkers && isFocused && (
|
|
218
|
+
<View style={{ flex: 1 }}>
|
|
208
219
|
<MapView
|
|
209
220
|
ref={mapRef}
|
|
210
221
|
provider={PROVIDER_GOOGLE}
|
|
211
222
|
initialRegion={{
|
|
212
223
|
latitude: initialPosition.latitude,
|
|
213
224
|
longitude: initialPosition.longitude,
|
|
214
|
-
latitudeDelta: 0.
|
|
215
|
-
longitudeDelta: 0.
|
|
225
|
+
latitudeDelta: 0.001,
|
|
226
|
+
longitudeDelta: 0.001 * ASPECT_RATIO,
|
|
216
227
|
}}
|
|
217
228
|
style={{ flex: 1 }}
|
|
218
229
|
zoomTapEnabled
|
|
@@ -261,8 +272,28 @@ const MapViewComponent = (props: MapViewParams) => {
|
|
|
261
272
|
</Marker>
|
|
262
273
|
</>
|
|
263
274
|
</MapView>
|
|
264
|
-
|
|
265
|
-
|
|
275
|
+
<OFab
|
|
276
|
+
materialIcon
|
|
277
|
+
iconName="plus"
|
|
278
|
+
onPress={() => onPressZoomIn()}
|
|
279
|
+
style={{
|
|
280
|
+
position: 'absolute',
|
|
281
|
+
bottom: 75,
|
|
282
|
+
right: 20,
|
|
283
|
+
}}
|
|
284
|
+
/>
|
|
285
|
+
<OFab
|
|
286
|
+
materialIcon
|
|
287
|
+
iconName="minus"
|
|
288
|
+
onPress={() => onPressZoomOut()}
|
|
289
|
+
style={{
|
|
290
|
+
position: 'absolute',
|
|
291
|
+
bottom: 35,
|
|
292
|
+
right: 20,
|
|
293
|
+
}}
|
|
294
|
+
/>
|
|
295
|
+
</View>
|
|
296
|
+
)}
|
|
266
297
|
</View>
|
|
267
298
|
<View>
|
|
268
299
|
<Alert
|
|
@@ -7,20 +7,25 @@ import {
|
|
|
7
7
|
TouchableOpacity,
|
|
8
8
|
} from 'react-native';
|
|
9
9
|
import Icon from 'react-native-vector-icons/Ionicons';
|
|
10
|
-
|
|
10
|
+
import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
|
|
11
11
|
interface Props {
|
|
12
12
|
iconName: string;
|
|
13
13
|
onPress: () => void;
|
|
14
14
|
style?: StyleProp<ViewStyle>;
|
|
15
|
+
materialIcon?: boolean
|
|
15
16
|
}
|
|
16
|
-
const OFab = ({ iconName, onPress, style = {} }: Props) => {
|
|
17
|
+
const OFab = ({ iconName, materialIcon, onPress, style = {} }: Props) => {
|
|
17
18
|
return (
|
|
18
19
|
<View style={{ ...(style as any) }}>
|
|
19
20
|
<TouchableOpacity
|
|
20
21
|
activeOpacity={0.8}
|
|
21
22
|
onPress={onPress}
|
|
22
23
|
style={styles.blackButton}>
|
|
23
|
-
|
|
24
|
+
{materialIcon ? (
|
|
25
|
+
<MaterialIcon name={iconName} color="white" size={20} />
|
|
26
|
+
) : (
|
|
27
|
+
<Icon name={iconName} color="white" size={20} />
|
|
28
|
+
)}
|
|
24
29
|
</TouchableOpacity>
|
|
25
30
|
</View>
|
|
26
31
|
);
|
|
@@ -545,5 +545,7 @@ export interface MapViewParams {
|
|
|
545
545
|
getBusinessLocations: () => void,
|
|
546
546
|
isLoadingBusinessMarkers?: boolean,
|
|
547
547
|
markerGroups: Array<any>,
|
|
548
|
-
customerMarkerGroups: Array<any
|
|
548
|
+
customerMarkerGroups: Array<any>,
|
|
549
|
+
alertState: { open: boolean, content: Array<string>, key?: string | null },
|
|
550
|
+
setAlertState: ({open, content, key} : { open: boolean, content: Array<string>, key?: string | null }) => void
|
|
549
551
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { PanResponder, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
useLanguage,
|
|
5
5
|
useOrder,
|
|
@@ -27,7 +27,8 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
27
27
|
|
|
28
28
|
const { navigation, businessProductsListingProps } = props;
|
|
29
29
|
|
|
30
|
-
const [{ carts }] = useOrder();
|
|
30
|
+
const [{ carts }, {clearCart} ] = useOrder();
|
|
31
|
+
const [isClearCart, setClearCart] = useState(false)
|
|
31
32
|
const cartsList = (carts && Object.values(carts).filter((cart: any) => cart.products.length > 0)) || []
|
|
32
33
|
const VISIBLE_CART_BOTTOM_SHEET_HEIGHT = orientationState?.dimensions?.height * (orientationState.orientation === PORTRAIT ? 0.5 : 1);
|
|
33
34
|
|
|
@@ -36,6 +37,39 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
36
37
|
if (cartsList?.length > 0) {
|
|
37
38
|
cart = cartsList?.find((item: any) => item.business_id == businessProductsListingProps.slug);
|
|
38
39
|
}
|
|
40
|
+
const clearCartWhenTimeOut = () => {
|
|
41
|
+
if (cart?.uuid) clearCart(cart?.uuid)
|
|
42
|
+
}
|
|
43
|
+
const timerId = useRef(false);
|
|
44
|
+
|
|
45
|
+
const clearInactivityTimeout = () =>{
|
|
46
|
+
clearTimeout(timerId.current);
|
|
47
|
+
}
|
|
48
|
+
const panResponder = React.useRef(
|
|
49
|
+
PanResponder.create({
|
|
50
|
+
onStartShouldSetPanResponderCapture: () => {
|
|
51
|
+
resetInactivityTimeout()
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
).current
|
|
55
|
+
const resetInactivityTimeout = useCallback(() => {
|
|
56
|
+
clearTimeout(timerId.current);
|
|
57
|
+
timerId.current = setTimeout(() => {
|
|
58
|
+
setClearCart(true)
|
|
59
|
+
navigation.reset({
|
|
60
|
+
routes: [{ name: 'Intro' }],
|
|
61
|
+
})
|
|
62
|
+
}, 1000*10);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if(isClearCart && cart?.uuid) clearCart(cart?.uuid)
|
|
67
|
+
}, [cart, isClearCart]);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
resetInactivityTimeout();
|
|
71
|
+
hideCartBottomSheet()
|
|
72
|
+
}, []);
|
|
39
73
|
|
|
40
74
|
const cartProps = {
|
|
41
75
|
...props,
|
|
@@ -51,7 +85,10 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
51
85
|
showNotFound: false
|
|
52
86
|
}
|
|
53
87
|
|
|
54
|
-
const goToBack = () =>
|
|
88
|
+
const goToBack = () => {
|
|
89
|
+
clearInactivityTimeout()
|
|
90
|
+
navigation.goBack()
|
|
91
|
+
}
|
|
55
92
|
|
|
56
93
|
const onToggleCart = () => {
|
|
57
94
|
if (bottomSheetVisibility) hideCartBottomSheet();
|
|
@@ -62,7 +99,9 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
62
99
|
<View style={{
|
|
63
100
|
flex: 1,
|
|
64
101
|
flexDirection: orientationState?.orientation === PORTRAIT ? 'column' : 'row'
|
|
65
|
-
}}
|
|
102
|
+
}}
|
|
103
|
+
{...panResponder.panHandlers}
|
|
104
|
+
>
|
|
66
105
|
<View
|
|
67
106
|
style={{
|
|
68
107
|
flex: 1,
|
|
@@ -100,6 +139,9 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
100
139
|
|
|
101
140
|
<BusinessProductsListing
|
|
102
141
|
{ ...businessProductsListingProps }
|
|
142
|
+
resetInactivityTimeout={resetInactivityTimeout}
|
|
143
|
+
clearInactivityTimeout={clearInactivityTimeout}
|
|
144
|
+
bottomSheetVisibility={bottomSheetVisibility}
|
|
103
145
|
/>
|
|
104
146
|
</Container>
|
|
105
147
|
</View>
|
|
@@ -112,6 +154,8 @@ const BusinessMenu = (props:any): React.ReactElement => {
|
|
|
112
154
|
>
|
|
113
155
|
<CartContent
|
|
114
156
|
{...cartProps}
|
|
157
|
+
resetInactivityTimeout={resetInactivityTimeout}
|
|
158
|
+
clearInactivityTimeout={clearInactivityTimeout}
|
|
115
159
|
/>
|
|
116
160
|
</View>
|
|
117
161
|
</View>
|
|
@@ -11,7 +11,7 @@ import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/Device
|
|
|
11
11
|
import { useTheme } from 'styled-components/native';
|
|
12
12
|
|
|
13
13
|
const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
14
|
-
const {navigation, businessState} = props;
|
|
14
|
+
const {navigation, businessState, resetInactivityTimeout, clearInactivityTimeout, bottomSheetVisibility } = props;
|
|
15
15
|
|
|
16
16
|
const business: Business = businessState.business;
|
|
17
17
|
|
|
@@ -47,6 +47,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
47
47
|
image={{uri: item?.images}}
|
|
48
48
|
isOutOfStock={!item?.inventoried}
|
|
49
49
|
onPress={() => {
|
|
50
|
+
resetInactivityTimeout()
|
|
50
51
|
navigation.navigate('ProductDetails', {
|
|
51
52
|
businessId: business?.api?.businessId,
|
|
52
53
|
businessSlug: business?.slug,
|
|
@@ -99,15 +100,18 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
|
|
|
99
100
|
style={{
|
|
100
101
|
width:
|
|
101
102
|
orientationState?.orientation === LANDSCAPE
|
|
102
|
-
? orientationState?.dimensions?.width * 0.16
|
|
103
|
+
? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.15 :orientationState?.dimensions?.width * 0.16
|
|
103
104
|
: orientationState?.dimensions?.width * 0.21,
|
|
104
105
|
}}
|
|
105
106
|
onPress={() => {
|
|
107
|
+
resetInactivityTimeout()
|
|
106
108
|
navigation.navigate('Category', {
|
|
107
109
|
category,
|
|
108
110
|
categories: business.original.categories,
|
|
109
111
|
businessId: business?.api?.businessId,
|
|
110
112
|
businessSlug: business?.slug,
|
|
113
|
+
clearInactivityTimeout,
|
|
114
|
+
resetInactivityTimeout,
|
|
111
115
|
});
|
|
112
116
|
}}
|
|
113
117
|
titleStyle={{textAlign: 'center'}}
|
|
@@ -34,6 +34,8 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
34
34
|
setIsCartsLoading,
|
|
35
35
|
isFromCart,
|
|
36
36
|
navigation,
|
|
37
|
+
clearInactivityTimeout,
|
|
38
|
+
resetInactivityTimeout,
|
|
37
39
|
} = props
|
|
38
40
|
|
|
39
41
|
const theme = useTheme()
|
|
@@ -87,6 +89,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
const handleUpsellingPage = () => {
|
|
92
|
+
clearInactivityTimeout()
|
|
90
93
|
onCloseUpselling()
|
|
91
94
|
navigation?.navigate('Cart', { businessId: cart?.business_id })
|
|
92
95
|
}
|
|
@@ -159,7 +162,10 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
159
162
|
borderColor={theme.colors.primary}
|
|
160
163
|
imgRightSrc={null}
|
|
161
164
|
textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
|
|
162
|
-
onClick={() =>
|
|
165
|
+
onClick={() => {
|
|
166
|
+
resetInactivityTimeout()
|
|
167
|
+
setOpenUpselling(true)
|
|
168
|
+
}}
|
|
163
169
|
style={{width: '100%', flexDirection: 'row', justifyContent: 'center'}}
|
|
164
170
|
/>
|
|
165
171
|
</StyledBottomContent>
|
|
@@ -192,6 +198,7 @@ const CartBottomSheetUI = (props: CartBottomSheetUIProps): React.ReactElement |
|
|
|
192
198
|
canOpenUpselling={canOpenUpselling}
|
|
193
199
|
setCanOpenUpselling={setCanOpenUpselling}
|
|
194
200
|
onClose={onCloseUpselling}
|
|
201
|
+
resetInactivityTimeout={resetInactivityTimeout}
|
|
195
202
|
/>
|
|
196
203
|
)}
|
|
197
204
|
</StyledContainer>
|
|
@@ -251,6 +258,8 @@ interface CartBottomSheetUIProps {
|
|
|
251
258
|
isFromCart: any,
|
|
252
259
|
navigation: any,
|
|
253
260
|
onNavigationRedirect: any,
|
|
261
|
+
clearInactivityTimeout: any,
|
|
262
|
+
resetInactivityTimeout: any,
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
export const CartBottomSheet = (props: any) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useLanguage } from 'ordering-components/native';
|
|
3
3
|
|
|
4
4
|
import { CCNotCarts } from './styles';
|
|
@@ -16,6 +16,8 @@ export const CartContent = (props: any) => {
|
|
|
16
16
|
CustomCartComponent,
|
|
17
17
|
extraPropsCustomCartComponent,
|
|
18
18
|
showNotFound,
|
|
19
|
+
clearInactivityTimeout,
|
|
20
|
+
resetInactivityTimeout,
|
|
19
21
|
}: Props = props
|
|
20
22
|
|
|
21
23
|
const [, t] = useLanguage()
|
|
@@ -27,6 +29,8 @@ export const CartContent = (props: any) => {
|
|
|
27
29
|
onNavigationRedirect: props.onNavigationRedirect,
|
|
28
30
|
isCartsLoading,
|
|
29
31
|
setIsCartsLoading,
|
|
32
|
+
clearInactivityTimeout,
|
|
33
|
+
resetInactivityTimeout,
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
const content = (
|
|
@@ -67,4 +71,6 @@ interface Props {
|
|
|
67
71
|
CustomCartComponent?: any,
|
|
68
72
|
extraPropsCustomCartComponent?: JSON,
|
|
69
73
|
showNotFound?: boolean,
|
|
74
|
+
clearInactivityTimeout: any,
|
|
75
|
+
resetInactivityTimeout: any,
|
|
70
76
|
}
|
|
@@ -31,6 +31,8 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
31
31
|
categories,
|
|
32
32
|
businessId,
|
|
33
33
|
businessSlug,
|
|
34
|
+
clearInactivityTimeout,
|
|
35
|
+
resetInactivityTimeout
|
|
34
36
|
}: Params = route.params;
|
|
35
37
|
|
|
36
38
|
const theme = useTheme()
|
|
@@ -40,7 +42,10 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
40
42
|
const [orientationState] = useDeviceOrientation();
|
|
41
43
|
const [bottomSheetVisibility, { showCartBottomSheet, hideCartBottomSheet }] = useCartBottomSheet();
|
|
42
44
|
|
|
43
|
-
const onChangeTabs = (idx: number) =>
|
|
45
|
+
const onChangeTabs = (idx: number) => {
|
|
46
|
+
resetInactivityTimeout();
|
|
47
|
+
setIndexCateg(idx);
|
|
48
|
+
}
|
|
44
49
|
|
|
45
50
|
const goToBack = () => navigation.goBack()
|
|
46
51
|
|
|
@@ -64,6 +69,8 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
64
69
|
orientationState,
|
|
65
70
|
height: VISIBLE_CART_BOTTOM_SHEET_HEIGHT,
|
|
66
71
|
visible: bottomSheetVisibility,
|
|
72
|
+
clearInactivityTimeout,
|
|
73
|
+
resetInactivityTimeout,
|
|
67
74
|
},
|
|
68
75
|
showNotFound: false,
|
|
69
76
|
showCartBottomSheet,
|
|
@@ -133,6 +140,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
|
|
|
133
140
|
}}
|
|
134
141
|
titleStyle={{marginTop: Platform.OS === 'ios' ? 10 : 0}}
|
|
135
142
|
onPress={() => {
|
|
143
|
+
resetInactivityTimeout()
|
|
136
144
|
navigation.navigate('ProductDetails', {
|
|
137
145
|
businessId,
|
|
138
146
|
businessSlug,
|
|
@@ -167,6 +175,8 @@ interface Params {
|
|
|
167
175
|
categories: Category[];
|
|
168
176
|
businessId: string;
|
|
169
177
|
businessSlug: string;
|
|
178
|
+
clearInactivityTimeout: any;
|
|
179
|
+
resetInactivityTimeout: any;
|
|
170
180
|
}
|
|
171
181
|
|
|
172
182
|
export default CategoriesMenu;
|