ordering-ui-react-native 0.15.20 → 0.15.23

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,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.20",
3
+ "version": "0.15.23",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager } from 'react-native'
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import { View, StyleSheet, BackHandler, TouchableOpacity, I18nManager, AppState } from 'react-native'
3
3
  import LinearGradient from 'react-native-linear-gradient'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
@@ -64,7 +64,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
64
64
  isFromRoot,
65
65
  driverLocation,
66
66
  goToBusinessList,
67
- onNavigationRedirect
67
+ onNavigationRedirect,
68
+ getOrder
68
69
  } = props
69
70
 
70
71
  const theme = useTheme()
@@ -108,6 +109,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
108
109
  const [isReviewed, setIsReviewed] = useState(false)
109
110
  const [openOrderCreating, setOpenOrderCreating] = useState(false)
110
111
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
112
+ const appState = useRef(AppState.currentState)
113
+
111
114
  const { order, loading, businessData, error } = props.order
112
115
 
113
116
  const getOrderStatus = (s: string) => {
@@ -256,6 +259,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
256
259
  })
257
260
  }, [])
258
261
 
262
+ useEffect(() => {
263
+ const onFocusApp = (nextAppState: any) => {
264
+ if (
265
+ appState.current.match(/inactive|background/) &&
266
+ nextAppState === "active"
267
+ ) {
268
+ getOrder && getOrder()
269
+ }
270
+ appState.current = nextAppState;
271
+ }
272
+
273
+ AppState.addEventListener("change", onFocusApp);
274
+ return () => {
275
+ AppState.removeEventListener('change', onFocusApp);
276
+ };
277
+ }, [])
278
+
279
+
259
280
  return (
260
281
  <OrderDetailsContainer keyboardShouldPersistTaps='handled'>
261
282
  {order && order?.id && !error && !loading && (
@@ -287,6 +287,7 @@ export interface OrderDetailsParams {
287
287
  isFromRoot?: any;
288
288
  goToBusinessList?: any;
289
289
  onNavigationRedirect?: any;
290
+ getOrder?: () => {}
290
291
  }
291
292
  export interface ProductItemAccordionParams {
292
293
  key?: any;
@@ -6,6 +6,7 @@ import {
6
6
  BusinessController as BusinessSingleCard,
7
7
  useUtils,
8
8
  } from 'ordering-components/native';
9
+ import FastImage from 'react-native-fast-image'
9
10
 
10
11
  import { Card, BusinessLogo } from './styles';
11
12
 
@@ -26,6 +27,16 @@ export const BusinessControllerUI = (props: any) => {
26
27
  alignItems: 'center',
27
28
  textAlign: 'center',
28
29
  marginTop: 10
30
+ },
31
+ logoStyle: {
32
+ width: 120,
33
+ height: 120,
34
+ borderRadius: 8,
35
+ borderWidth: 1,
36
+ borderColor: theme.colors.border,
37
+ flexDirection: 'column',
38
+ justifyContent: 'center',
39
+ alignItems: 'center',
29
40
  }
30
41
  });
31
42
 
@@ -39,12 +50,22 @@ export const BusinessControllerUI = (props: any) => {
39
50
  activeOpacity={1}
40
51
  onPress={() => handleBusinessClick(business)}
41
52
  >
42
- <BusinessLogo
43
- source={business?.logo ? {
44
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
45
- } : theme.images.dummies.businessLogo}
46
- resizeMode='contain'
47
- />
53
+ {business?.logo ? (
54
+ <FastImage
55
+ style={styles.logoStyle}
56
+ source={{
57
+ uri: business?.logo,
58
+ priority: FastImage.priority.high,
59
+ cache:FastImage.cacheControl.web
60
+ }}
61
+ resizeMode={FastImage.resizeMode.contain}
62
+ />
63
+ ) : (
64
+ <BusinessLogo
65
+ source={theme.images.dummies.businessLogo}
66
+ resizeMode='contain'
67
+ />
68
+ )}
48
69
  <OText
49
70
  size={WIDTH_SCREEN * 0.012}
50
71
  numberOfLines={2}
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components/native';
3
3
  export const Card = styled.TouchableOpacity`
4
4
  display: flex;
5
5
  flex-direction: column;
6
- justify-content: center;
6
+ justify-content: flex-start;
7
7
  align-items: center;
8
8
  margin: 0 15px 20px;
9
9
  width: 120px;
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { View, StyleSheet, ScrollView, TouchableOpacity } from 'react-native'
2
+ import { View, StyleSheet, ScrollView, TouchableOpacity, ImageBackground } from 'react-native'
3
3
  import { BusinessAndProductList, useLanguage } from 'ordering-components/native'
4
4
  import { BusinessProductsListingParams, Business } from '../../types'
5
5
  import { OCard, OText, OIcon } from '../shared'
@@ -7,6 +7,7 @@ import GridContainer from '../../layouts/GridContainer'
7
7
  import Spinner from 'react-native-loading-spinner-overlay';
8
8
  import { LANDSCAPE, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
9
9
  import styled, { useTheme } from 'styled-components/native';
10
+ import FastImage from 'react-native-fast-image'
10
11
 
11
12
  const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
12
13
  const {navigation, businessState, resetInactivityTimeout, clearInactivityTimeout, bottomSheetVisibility } = props;
@@ -59,17 +60,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
59
60
  );
60
61
 
61
62
  const RenderCategories = ({ item, cardStyle, widthScreen }: any) => {
62
- const Category = styled.ImageBackground`
63
- position: relative;
64
- height: 150px;
65
- width: ${(props: any) => props.w * 0.45}px;
66
- border-radius: 10px;
67
- padding: 10px;
68
- display: flex;
69
- flex-direction: column;
70
- justify-content: center;
71
- align-items: center;
72
- `
63
+ const stylesCat = StyleSheet.create({
64
+ categoryStyle: {
65
+ height: 150,
66
+ borderRadius: 10,
67
+ padding: 10,
68
+ flexDirection: 'column',
69
+ justifyContent: 'center',
70
+ alignItems: 'center',
71
+ }
72
+ })
73
+
73
74
  const WrapText = styled.View`
74
75
  height: 90px;
75
76
  display: flex;
@@ -78,6 +79,25 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
78
79
  border-radius: 10px;
79
80
  `
80
81
 
82
+ const Category = (props: any) => {
83
+ const imageProps = {
84
+ style: props.style,
85
+ source: props.source,
86
+ resizeMode: props.resizeMode,
87
+ }
88
+ return (
89
+ props.uri ? (
90
+ <FastImage {...imageProps}>
91
+ {props.children}
92
+ </FastImage>
93
+ ) : (
94
+ <ImageBackground {...imageProps}>
95
+ {props.children}
96
+ </ImageBackground>
97
+ )
98
+ )
99
+ }
100
+
81
101
  return (
82
102
  <TouchableOpacity
83
103
  key={item.id}
@@ -92,11 +112,17 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
92
112
  }}
93
113
  >
94
114
  <Category
95
- style={cardStyle}
96
- source={item.images ? {uri: item.images} : theme.images.categories.all}
97
- resizeMode="cover"
98
- w={widthScreen}
99
- borderRadius={16}
115
+ style={{ ...cardStyle, ...stylesCat.categoryStyle, width: widthScreen * 0.45 }}
116
+ uri={!!item.images}
117
+ source={!!item.images
118
+ ? {
119
+ uri: item.images,
120
+ priority: FastImage.priority.high,
121
+ cache:FastImage.cacheControl.web
122
+ }
123
+ : theme.images.categories.all
124
+ }
125
+ resizeMode={FastImage.resizeMode.cover}
100
126
  >
101
127
  {item?.inventoried && (
102
128
  <View style={styles.soldOut}>
@@ -111,7 +137,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
111
137
  mLeft={0}
112
138
  size={32}
113
139
  numberOfLines={1}
114
- // mBottom={8}
115
140
  style={{...props?.titleStyle}}
116
141
  weight="bold"
117
142
  >
@@ -121,7 +146,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
121
146
  <OText
122
147
  color={theme.colors.white}
123
148
  numberOfLines={1}
124
- // mBottom={4}
125
149
  size={18}
126
150
  style={{...props?.descriptionStyle}}
127
151
  weight="400"
@@ -161,7 +185,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
161
185
  const _renderCategories = (): React.ReactElement => (
162
186
  <>
163
187
  {_renderTitle(t('CATEGORIES', 'Categories'))}
164
- <GridContainer
188
+ <GridContainer
165
189
  style={{
166
190
  paddingLeft: orientationState?.orientation === LANDSCAPE
167
191
  ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.004 :orientationState?.dimensions?.width * 0.008
@@ -171,9 +195,12 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
171
195
  {_categories && _categories.map((category: any) => (
172
196
  <OCard
173
197
  key={category.id}
198
+ isCentered
199
+ isUri={!!category.image}
174
200
  title={category?.name || ''}
175
- image={category.images ? {uri: category.images} : theme.images.categories.all}
201
+ image={category.image ? {uri: category.image} : theme.images.categories.all}
176
202
  style={{
203
+ borderRadius: 10,
177
204
  width:
178
205
  orientationState?.orientation === LANDSCAPE
179
206
  ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
@@ -156,13 +156,17 @@ const CategoriesMenu = (props: any): React.ReactElement => {
156
156
  <OCard
157
157
  key={product.id}
158
158
  title={product?.name}
159
- image={{ uri: product?.images }}
159
+ isUri={!!product.images}
160
+ image={product.images ? {uri: product.images} : theme.images.dummies.product}
161
+ price={parsePrice(product?.price)}
162
+ description={product?.description}
163
+ prevPrice={product?.offer_price > 0 && parsePrice(product?.offer_price)}
160
164
  style={{
165
+ borderRadius: 10,
161
166
  width: orientationState?.orientation === LANDSCAPE
162
167
  ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.145 :orientationState?.dimensions?.width * 0.16
163
168
  : orientationState?.dimensions?.width * 0.20
164
169
  }}
165
- titleStyle={{marginTop: Platform.OS === 'ios' ? orientationState?.orientation === LANDSCAPE ? orientationState?.dimensions.height * 0.05 : orientationState?.dimensions.width * 0.05 : 0}}
166
170
  onPress={() => {
167
171
  resetInactivityTimeout()
168
172
  if (isDrawer) {
@@ -176,9 +180,6 @@ const CategoriesMenu = (props: any): React.ReactElement => {
176
180
  });
177
181
  }
178
182
  }}
179
- {...(!!product?.description && { description: product?.description } )}
180
- {...(!!product?.price && { price: parsePrice(product?.price) } )}
181
- {...(product?.in_offer && { prevPrice: `$${product?.offer_price}` } )}
182
183
  />
183
184
  ))}
184
185
  </GridContainer>
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { TouchableOpacity, View, StyleSheet } from 'react-native'
3
- import { LanguageSelector as LanguageSelectorController } from 'ordering-components/native'
2
+ import { TouchableOpacity, View, StyleSheet, ActivityIndicator } from 'react-native'
3
+ import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
4
4
  import CountryPicker, { Flag } from 'react-native-country-picker-modal'
5
5
 
6
6
  import { Container, LanguageItem } from './styles'
@@ -40,6 +40,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
40
40
  (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
41
41
  )
42
42
 
43
+ const [orderState] = useOrder()
43
44
  const [isCountryModalVisible, setCountryModalVisible] = useState(false);
44
45
 
45
46
  const countryCodes = _languages?.map((item:any) => item.countryCode);
@@ -48,7 +49,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
48
49
 
49
50
  return (
50
51
  <>
51
- { languagesState.loading ?
52
+ { languagesState.loading ?
52
53
  (<Container>
53
54
  <Placeholder style={{ width: 130, paddingTop: 10 }} Animation={Fade}>
54
55
  <PlaceholderLine height={15}/>
@@ -66,8 +67,8 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
66
67
  closeButtonStyle={styles.closeIcon}
67
68
  renderFlagButton={() => (
68
69
  <TouchableOpacity
69
- onPress={() => setCountryModalVisible(true)}
70
- disabled={languagesState.loading}
70
+ onPress={() => orderState.loading ? {} : setCountryModalVisible(true)}
71
+ // disabled={orderState.loading}
71
72
  >
72
73
  <LanguageItem>
73
74
  <Flag
@@ -76,7 +77,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
76
77
  countryCode={currentLanguageData?.countryCode}
77
78
  />
78
79
  <OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
79
- <MatarialIcon name='keyboard-arrow-down' size={24}/>
80
+ {orderState.loading ? (
81
+ <ActivityIndicator size="small" color={theme.colors.primary} style={{ marginLeft: 5 }} />
82
+ ) : (
83
+ <MatarialIcon name='keyboard-arrow-down' size={24}/>
84
+ )}
80
85
  </LanguageItem>
81
86
  </TouchableOpacity>
82
87
  )}
@@ -87,11 +92,10 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
87
92
  renderItem: ({item} : any) => (
88
93
  <TouchableOpacity
89
94
  onPress={() => {
90
- /* @ts-ignore */
91
95
  handleChangeLanguage(item.value);
92
96
  setCountryModalVisible(false);
93
97
  }}
94
- disabled={languagesState.loading}
98
+ disabled={orderState.loading}
95
99
  >
96
100
  <LanguageItem>
97
101
  <View style={styles.flagsContainer} />
@@ -1,110 +1,144 @@
1
1
  import React from 'react';
2
- import { TextStyle, ViewStyle, Platform } from 'react-native';
2
+ import { TextStyle, ImageBackground, StyleSheet } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
+ import FastImage from 'react-native-fast-image'
4
5
 
5
- import styled from 'styled-components/native';
6
- import OImage from './OImage';
6
+ import styled, { css } from 'styled-components/native';
7
7
  import OText from './OText';
8
8
 
9
9
  const CardContainer = styled.TouchableOpacity`
10
- width: 21%;
11
- margin: 10px 20px;
12
- overflow: hidden;
10
+ position: relative;
11
+ flex-direction: column;
12
+ border-radius: 10px;
13
+ position: relative;
14
+ margin: 0 30px 30px 0;
15
+ align-self: flex-start;
13
16
  `
14
17
 
15
- const CardBody = styled.View`
16
- padding: 4%;
18
+ const WrapPrice = styled.View`
19
+ display: flex;
20
+ flex-direction: row;
21
+ align-items: center;
22
+ margin-top: 10px;
17
23
  `
18
24
 
19
- const CardBadge = styled.Text`
20
- padding: 2% 4%;
21
- position: absolute;
22
- background-color: ${(props: any) => props.theme.theme.colors.primary};
23
- z-index: 100;
24
- border-radius: 5px;
25
- color: #fff;
26
- font-weight: bold;
27
- margin: 10px 0;
25
+ const WrapImage = styled.View`
26
+ width: 100%;
27
+ height: 120px;
28
+ `
29
+
30
+ const WrapContent = styled.View`
31
+ display: flex;
32
+ flex-direction: column;
33
+ ${(props: any) => props.isCentered && css`
34
+ align-items: center;
35
+ `}
28
36
  `
29
37
 
30
38
  const OCard = (props: Props): React.ReactElement => {
31
39
  const theme = useTheme()
32
40
 
41
+ const styles = StyleSheet.create({
42
+ textStyle: {
43
+ marginTop: 10
44
+ },
45
+ image: {
46
+ width: '100%',
47
+ height: '100%',
48
+ borderBottomLeftRadius: 0,
49
+ borderBottomRightRadius: 0,
50
+ }
51
+ })
52
+
33
53
  return (
34
54
  <CardContainer
35
- style={{...props.style}}
36
- onPress={props?.onPress}
37
- disabled={!props?.onPress}
38
- activeOpacity={1}
39
- >
40
- {props?.badgeText && (
41
- <CardBadge>
42
- {props?.badgeText}
43
- </CardBadge>
44
- )}
45
- <OImage
46
- source={props.image}
47
- height={120}
48
- resizeMode="cover"
49
- borderRadius={16}
50
- />
51
- <CardBody>
52
- <OText
53
- mLeft={0}
54
- size={18}
55
- numberOfLines={2}
56
- mBottom={8}
57
- style={{...props?.titleStyle}}
58
- >
59
- {props.title}
60
- </OText>
61
-
62
- {props?.description && (
63
- <OText
64
- color={theme.colors.mediumGray}
65
- numberOfLines={3}
66
- mBottom={8}
67
- style={{...props?.descriptionStyle}}
68
- >
69
- {props.description}
70
- </OText>
55
+ activeOpacity={1}
56
+ style={props.style}
57
+ onPress={props?.onPress}
58
+ disabled={!props?.onPress}
59
+ >
60
+ <WrapImage>
61
+ {props.isUri ? (
62
+ <FastImage
63
+ style={[styles.image, props.style]}
64
+ source={{
65
+ uri: props.image?.uri,
66
+ priority: FastImage.priority.normal,
67
+ // cache:FastImage.cacheControl.web
68
+ }}
69
+ resizeMode={FastImage.resizeMode.cover}
70
+ />
71
+ ) : (
72
+ <ImageBackground
73
+ style={[styles.image, props.style]}
74
+ source={props.image}
75
+ imageStyle={{
76
+ borderBottomLeftRadius: 0,
77
+ borderBottomRightRadius: 0,
78
+ borderRadius: 10
79
+ }}
80
+ resizeMode='cover'
81
+ />
71
82
  )}
72
-
73
- {props?.price && (
74
- <OText>
75
- <OText
76
- color={theme.colors.primary}
77
- weight="bold"
78
- >
79
- {props.price}
80
- </OText>
81
-
82
- <OText
83
- color={theme.colors.mediumGray}
84
- size={12}
85
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
86
- >
87
- {props?.prevPrice ? ` ${props?.prevPrice} ` : ''}
88
- </OText>
89
- </OText>
90
- )}
91
-
92
- </CardBody>
93
- </CardContainer>
94
- );
83
+ </WrapImage>
84
+ <WrapContent isCentered={props.isCentered}>
85
+ <OText
86
+ size={18}
87
+ numberOfLines={1}
88
+ ellipsizeMode='tail'
89
+ style={styles.textStyle}
90
+ >
91
+ {props.title}
92
+ </OText>
93
+ {!!props?.description && (
94
+ <OText
95
+ color={theme.colors.mediumGray}
96
+ size={18}
97
+ numberOfLines={3}
98
+ ellipsizeMode='tail'
99
+ style={styles.textStyle}
100
+ >
101
+ {props?.description}
102
+ </OText>
103
+ )}
104
+ <WrapPrice>
105
+ <OText
106
+ size={18}
107
+ >
108
+ {props.price}
109
+ </OText>
110
+ {props?.prevPrice && (
111
+ <OText
112
+ size={18}
113
+ color={theme.colors.mediumGray}
114
+ style={{
115
+ textDecorationLine: 'line-through',
116
+ textDecorationStyle: 'solid',
117
+ marginLeft: 20,
118
+ }}
119
+ >
120
+ {props?.prevPrice}
121
+ </OText>
122
+ )}
123
+ </WrapPrice>
124
+ </WrapContent>
125
+ </CardContainer>
126
+ )
95
127
  }
96
128
 
97
129
  interface Props {
98
130
  badgeText?: string;
131
+ isUri?: boolean;
99
132
  onPress?(): void;
100
- image: string | { uri: string };
133
+ image: any;
134
+ isCentered?: any;
101
135
  title: string;
102
136
  titleStyle?: TextStyle;
103
137
  description?: string;
104
138
  descriptionStyle?: TextStyle;
105
139
  price?: string;
106
140
  prevPrice?: string;
107
- style?: ViewStyle;
141
+ style?: any;
108
142
  }
109
143
 
110
144
  export default OCard;
@@ -87,6 +87,7 @@ const CouponControlUI = (props: any) => {
87
87
  ) : (
88
88
  <CCWrapper>
89
89
  <OInput
90
+ value={couponInput}
90
91
  placeholder={t('DISCOUNT_COUPON', 'Discount coupon')}
91
92
  onChange={(e: any) => onChangeInputCoupon(e)}
92
93
  style={styles.inputsStyle}
@@ -5,7 +5,7 @@ import {
5
5
  useLanguage,
6
6
  OrderDetails as OrderDetailsConTableoller,
7
7
  useUtils,
8
- useConfig,
8
+ useConfig
9
9
  } from 'ordering-components/native';
10
10
  import { useTheme } from 'styled-components/native';
11
11
  import {
@@ -28,6 +28,7 @@ import {
28
28
  OrderDriver,
29
29
  Map,
30
30
  Divider,
31
+ OrderAction
31
32
  } from './styles';
32
33
  import { OButton, OIcon, OModal, OText } from '../shared';
33
34
  import { ProductItemAccordion } from '../ProductItemAccordion';
@@ -48,6 +49,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
48
49
  readMessages,
49
50
  isFromCheckout,
50
51
  driverLocation,
52
+ onNavigationRedirect,
53
+ reorderState,
54
+ handleReorder
51
55
  } = props;
52
56
 
53
57
  const theme = useTheme();
@@ -83,11 +87,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
83
87
  const [, t] = useLanguage();
84
88
  const [{ parsePrice, parseNumber, parseDate }] = useUtils();
85
89
  const [{ configs }] = useConfig();
86
-
87
90
  const [isReviewed, setIsReviewed] = useState(false)
88
91
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
89
92
 
90
- const { order } = props.order;
93
+ const { order, businessData } = props.order;
91
94
 
92
95
  const walletName: any = {
93
96
  cash: {
@@ -310,8 +313,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
310
313
  business: type === 'business',
311
314
  driver: type === 'driver',
312
315
  onClose: () => navigation?.canGoBack()
313
- ? navigation.goBack()
314
- : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
316
+ ? navigation.goBack()
317
+ : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
315
318
  }
316
319
  )
317
320
  }
@@ -356,6 +359,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
356
359
  )
357
360
  }
358
361
 
362
+
363
+ useEffect(() => {
364
+ if (reorderState?.error) {
365
+ navigation.navigate('Business', { store: businessData?.slug })
366
+ }
367
+ if (!reorderState?.error && reorderState?.result?.uuid) {
368
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
369
+ }
370
+ }, [reorderState])
371
+
359
372
  useEffect(() => {
360
373
  BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
361
374
  return () => {
@@ -737,16 +750,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
737
750
  'Once business accepts your order, we will send you an email, thank you!',
738
751
  )}
739
752
  </OText>
740
- <OButton
741
- text={t('YOUR_ORDERS', 'Your Orders')}
742
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
743
- imgRightSrc={null}
744
- borderColor={theme.colors.primary}
745
- bgColor={theme.colors.clear}
746
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
747
- parentStyle={{ marginTop: 29, width: '50%' }}
748
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
749
- />
753
+ <OrderAction>
754
+ <OButton
755
+ text={t('YOUR_ORDERS', 'Your Orders')}
756
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
757
+ imgRightSrc={null}
758
+ borderColor={theme.colors.primary}
759
+ bgColor={theme.colors.clear}
760
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
761
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
762
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
763
+ />
764
+ {(
765
+ parseInt(order?.status) === 1 ||
766
+ parseInt(order?.status) === 2 ||
767
+ parseInt(order?.status) === 5 ||
768
+ parseInt(order?.status) === 6 ||
769
+ parseInt(order?.status) === 10 ||
770
+ parseInt(order?.status) === 11 ||
771
+ parseInt(order?.status) === 12
772
+ ) && (
773
+ <OButton
774
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
775
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
776
+ imgRightSrc={null}
777
+ borderColor='transparent'
778
+ bgColor={theme.colors.primary + 10}
779
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
780
+ onClick={() => handleReorder && handleReorder(order.id)}
781
+ />
782
+ )}
783
+ </OrderAction>
750
784
  </HeaderInfo>
751
785
  <OrderProducts>
752
786
  {order?.products?.length &&
@@ -125,3 +125,6 @@ export const Divider = styled.View`
125
125
  margin-top: 5px;
126
126
  margin-bottom: 5px;
127
127
  `
128
+ export const OrderAction = styled.View`
129
+ flex-direction: row;
130
+ `
@@ -991,14 +991,14 @@ export const ProductOptionsUI = (props: any) => {
991
991
  ? t('UPDATE', 'Update')
992
992
  : t('ADD', 'Add')
993
993
  }`}
994
- isDisabled={isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order}
994
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order))}
995
995
  textStyle={{
996
996
  color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
997
997
  fontSize: orderState.loading || editMode ? 10 : 14
998
998
  }}
999
999
  style={{
1000
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.lightGray : theme.colors.primary,
1001
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || productCart?.quantity < product?.minimum_per_order || productCart?.quantity > product?.maximum_per_order ? theme.colors.white : theme.colors.primary,
1000
+ backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
1001
+ borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && (productCart?.quantity < product?.minimum_per_order)) || (product?.maximum_per_order && (productCart?.quantity > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
1002
1002
  opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
1003
1003
  borderRadius: 7.6,
1004
1004
  height: 44,
@@ -40,9 +40,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
40
40
 
41
41
  const handleSuboptionClick = () => {
42
42
  toggleSelect()
43
- if (error) {
43
+
44
+ if (balance === option?.max - 1 && !state.selected) {
44
45
  scrollDown(option?.id)
45
46
  }
47
+
46
48
  if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
47
49
  setShowMessage(true)
48
50
  }
@@ -143,9 +143,9 @@ export interface BusinessesListingParams {
143
143
  export interface HighestRatedBusinessesParams {
144
144
  businessesList: { businesses: Array<any>, loading: boolean, error: null | string };
145
145
  onBusinessClick?: void;
146
- navigation? :any;
146
+ navigation?: any;
147
147
  isLoading?: boolean;
148
- getBusinesses: (newFetch : boolean) => void
148
+ getBusinesses: (newFetch: boolean) => void
149
149
  }
150
150
  export interface BusinessTypeFilterParams {
151
151
  businessTypes?: Array<any>;
@@ -182,7 +182,7 @@ export interface BusinessProductsListingParams {
182
182
  header?: any;
183
183
  logo?: any;
184
184
  productModal?: any;
185
- getNextProducts?: () => {};
185
+ getNextProducts?: () => {};
186
186
  handleChangeCategory: (value: any) => {};
187
187
  setProductLogin?: () => {};
188
188
  updateProductModal?: (value: any) => {};
@@ -209,8 +209,8 @@ export interface BusinessProductsCategoriesParams {
209
209
  categoriesLayout?: any;
210
210
  selectedCategoryId?: any;
211
211
  lazyLoadProductsRecommended?: any;
212
- setSelectedCategoryId?: any
213
- setCategoryClicked?: any
212
+ setSelectedCategoryId?: any
213
+ setCategoryClicked?: any
214
214
  }
215
215
  export interface BusinessProductsListParams {
216
216
  errors?: any;
@@ -321,7 +321,10 @@ export interface OrderDetailsParams {
321
321
  isFromCheckout?: boolean,
322
322
  driverLocation?: any,
323
323
  isFromRoot?: any,
324
- goToBusinessList?: boolean
324
+ goToBusinessList?: boolean,
325
+ onNavigationRedirect?: any,
326
+ reorderState?: any,
327
+ handleReorder?: any,
325
328
  }
326
329
  export interface ProductItemAccordionParams {
327
330
  key?: any;
@@ -355,7 +358,7 @@ export interface ReviewProductParams {
355
358
  formState?: any,
356
359
  handleChangeFormState?: any,
357
360
  handleSendProductReview?: any
358
- }
361
+ }
359
362
  export interface SingleProductReviewParams {
360
363
  product: any,
361
364
  formState?: any,
@@ -522,34 +525,34 @@ export interface HelpGuideParams {
522
525
  export interface HelpAccountAndPaymentParams {
523
526
  navigation: any;
524
527
  }
525
-
528
+
526
529
  export interface MessageListingParams {
527
530
  navigation: any;
528
531
  franchiseId?: any;
529
532
  }
530
533
 
531
- export interface BusinessSearchParams {
534
+ export interface BusinessSearchParams {
532
535
  navigation: any,
533
- businessesSearchList: any,
534
- onBusinessClick: any,
535
- handleChangeTermValue: (term: string) => void,
536
- termValue: string,
537
- paginationProps: any,
538
- handleSearchbusinessAndProducts: (newFetch?: boolean) => void,
539
- handleChangeFilters: (prop : string, value : any) => void,
540
- filters: any,
541
- businessTypes: Array<number>,
542
- setFilters: (filters: any) => void,
536
+ businessesSearchList: any,
537
+ onBusinessClick: any,
538
+ handleChangeTermValue: (term: string) => void,
539
+ termValue: string,
540
+ paginationProps: any,
541
+ handleSearchbusinessAndProducts: (newFetch?: boolean) => void,
542
+ handleChangeFilters: (prop: string, value: any) => void,
543
+ filters: any,
544
+ businessTypes: Array<number>,
545
+ setFilters: (filters: any) => void,
543
546
  lazySearch?: boolean
544
547
  }
545
-
548
+
546
549
  export interface NoNetworkParams {
547
550
  image?: any,
548
551
  }
549
552
 
550
553
  export interface PlaceSpotParams {
551
554
  isOpenPlaceSpot?: boolean,
552
- cart?: any ,
555
+ cart?: any,
553
556
  placesState?: any,
554
557
  handleChangePlace?: any,
555
558
  getPlacesList?: any,