ordering-ui-react-native 0.15.21 → 0.15.23-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.
Files changed (151) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/LanguageSelector/index.tsx +1 -0
  8. package/src/components/OrderDetails/index.tsx +26 -5
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/StripeElementsForm/index.tsx +27 -48
  12. package/src/components/UserProfileForm/index.tsx +63 -6
  13. package/src/components/UserProfileForm/styles.tsx +8 -0
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/config.json +0 -2
  16. package/src/navigators/HomeNavigator.tsx +6 -0
  17. package/src/pages/BusinessProductsList.tsx +1 -0
  18. package/src/pages/BusinessesListing.tsx +1 -1
  19. package/src/pages/Checkout.tsx +1 -1
  20. package/src/pages/Sessions.tsx +22 -0
  21. package/src/types/index.tsx +3 -9
  22. package/src/utils/index.tsx +68 -1
  23. package/themes/business/index.tsx +2 -0
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
  26. package/themes/business/src/components/Chat/index.tsx +38 -86
  27. package/themes/business/src/components/Home/index.tsx +128 -55
  28. package/themes/business/src/components/Home/styles.tsx +8 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  30. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  34. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  35. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  36. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  37. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  38. package/themes/business/src/components/OrdersOption/index.tsx +53 -49
  39. package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
  40. package/themes/business/src/types/index.tsx +2 -1
  41. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  42. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  43. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  45. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  46. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  47. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  48. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  49. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  50. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  51. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  52. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  53. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  55. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  56. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  60. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  61. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  64. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  66. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  67. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  68. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  69. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +178 -1
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  82. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  83. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  84. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  91. package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
  92. package/themes/original/src/components/Cart/index.tsx +18 -14
  93. package/themes/original/src/components/CartContent/index.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +42 -27
  95. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  96. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  97. package/themes/original/src/components/Help/index.tsx +21 -4
  98. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  99. package/themes/original/src/components/Home/index.tsx +1 -1
  100. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  101. package/themes/original/src/components/LoginForm/index.tsx +73 -2
  102. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  103. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  104. package/themes/original/src/components/Messages/index.tsx +34 -25
  105. package/themes/original/src/components/Messages/styles.tsx +1 -3
  106. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  107. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  108. package/themes/original/src/components/OrderDetails/index.tsx +34 -27
  109. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  110. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  111. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  112. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  113. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  114. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  115. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  116. package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
  117. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  118. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  119. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  120. package/themes/original/src/components/ProductForm/index.tsx +40 -33
  121. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  122. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  123. package/themes/original/src/components/Promotions/index.tsx +250 -0
  124. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  125. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  126. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  127. package/themes/original/src/components/Sessions/index.tsx +160 -0
  128. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  129. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  130. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  131. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  132. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  133. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  134. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  135. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  136. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  137. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  138. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  139. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  140. package/themes/original/src/components/Wallets/index.tsx +75 -8
  141. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  142. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  143. package/themes/original/src/components/shared/index.tsx +2 -0
  144. package/themes/original/src/config/constants.tsx +6 -6
  145. package/themes/original/src/types/index.tsx +46 -4
  146. package/themes/original/src/utils/index.tsx +12 -2
  147. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  148. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  149. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  150. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  151. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -51,3 +51,8 @@ export const Total = styled.View`
51
51
  padding-vertical: 10px;
52
52
  `
53
53
 
54
+ export const OSRow = styled.View`
55
+ flex-direction: row;
56
+ overflow: hidden;
57
+ width: 80%;
58
+ `
@@ -169,7 +169,7 @@ const OrderSummaryUI = (props: any) => {
169
169
  isCartProduct
170
170
  productCart={curProduct}
171
171
  businessSlug={cart?.business?.slug}
172
- businessId={curProduct?.business_id}
172
+ businessId={cart?.business_id}
173
173
  categoryId={curProduct?.category_id}
174
174
  productId={curProduct?.id}
175
175
  onSave={handlerProductAction}
@@ -15,8 +15,6 @@ import { Container } from '../../layouts/Container'
15
15
  import NavBar from '../NavBar'
16
16
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
17
17
  import GridContainer from '../../layouts/GridContainer'
18
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
19
- import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
20
18
 
21
19
  const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
22
20
  const {
@@ -29,7 +27,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
29
27
  callback
30
28
  } = props
31
29
 
32
- const theme = useTheme();
30
+ const theme = useTheme();
33
31
  const [, t] = useLanguage();
34
32
  const [orientationState] = useDeviceOrientation();
35
33
  const [orderState] = useOrder()
@@ -47,7 +45,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
47
45
  }
48
46
 
49
47
  useEffect(() => {
50
- if (isCardCliked) {
48
+ if(isCardCliked){
51
49
  callback?.()
52
50
  setIsCardClicked(false)
53
51
  setIsLoadingCard(null)
@@ -59,8 +57,8 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
59
57
  <Container>
60
58
  <NavBar
61
59
  title={t('ORDER_TYPE_X_ID', 'Order type')}
62
- {...(goBack && { onActionLeft: goBack })}
63
- btnStyle={{ paddingLeft: 0 }}
60
+ {...(goBack && { onActionLeft: goBack } )}
61
+ btnStyle={{paddingLeft: 0}}
64
62
  />
65
63
 
66
64
  <View style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
@@ -85,13 +83,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
85
83
  style={cardStyle}
86
84
  isDisabled={isCardCliked}
87
85
  isLoading={isLoadingCard === 'Eat In'}
88
- title={t('EAT_IN', 'Eat In')}
86
+ title={t('EAT_IN','Eat In')}
89
87
  description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
90
88
  bgImage={theme.images.general.eatIn}
91
- VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
89
+ icon={theme.images.general.pushPin}
92
90
  callToActionText={t('START_MY_ORDER', 'Start my order')}
93
91
  onClick={() => {
94
- if (_eatIn?.value !== orderState?.options?.type) {
92
+ if(_eatIn?.value !== orderState?.options?.type){
95
93
  handleChangeOrderType(_eatIn?.value);
96
94
  setIsCardClicked(true)
97
95
  setIsLoadingCard('Eat In')
@@ -108,15 +106,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
108
106
 
109
107
  <OptionCard
110
108
  style={cardStyle}
111
- title={t('TAKE_OUT', 'Take out')}
109
+ title={t('TAKE_OUT','Take out')}
112
110
  isDisabled={isCardCliked}
113
111
  isLoading={isLoadingCard === 'Take out'}
114
112
  description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
115
113
  bgImage={theme.images.general.takeOut}
116
- VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
114
+ icon={theme.images.general.shoppingCart}
117
115
  callToActionText={t('START_MY_ORDER', 'Start my order')}
118
116
  onClick={() => {
119
- if (_takeOut?.value !== orderState?.options?.type) {
117
+ if(_takeOut?.value !== orderState?.options?.type){
120
118
  handleChangeOrderType(_takeOut?.value);
121
119
  setIsCardClicked(true)
122
120
  setIsLoadingCard('Take out')
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react'
2
+ import FastImage from 'react-native-fast-image'
2
3
  import {
3
4
  View,
4
5
  TouchableOpacity,
@@ -69,7 +70,7 @@ export const ProductOptionsUI = (props: any) => {
69
70
 
70
71
  const { product, loading, error } = productObject;
71
72
 
72
- const HEADER_EXPANDED_HEIGHT = Platform.OS === 'ios' ? orientationState?.dimensions?.height * 0.65 : orientationState?.dimensions?.height * 0.4;
73
+ const HEADER_EXPANDED_HEIGHT = orientationState?.dimensions?.height * 0.4;
73
74
  const HEADER_COLLAPSED_HEIGHT = orientationState?.dimensions?.height * 0.2;
74
75
 
75
76
  const isError = (id: number) => {
@@ -203,7 +204,6 @@ export const ProductOptionsUI = (props: any) => {
203
204
  },
204
205
  scrollContainer: {
205
206
  padding: 16,
206
- paddingTop: HEADER_EXPANDED_HEIGHT
207
207
  },
208
208
  header: {
209
209
  backgroundColor: '#fff',
@@ -225,6 +225,10 @@ export const ProductOptionsUI = (props: any) => {
225
225
  shadowOpacity: 0.4,
226
226
  shadowRadius: 3,
227
227
  elevation: 5,
228
+ },
229
+ imageStyle: {
230
+ width: '100%',
231
+ height: HEADER_EXPANDED_HEIGHT,
228
232
  }
229
233
  });
230
234
 
@@ -232,118 +236,173 @@ export const ProductOptionsUI = (props: any) => {
232
236
  <>
233
237
  <ScrollView
234
238
  style={styles.mainContainer}
235
- contentContainerStyle={styles.scrollContainer}
236
239
  onScroll={Animated.event(
237
240
  [{ nativeEvent: { contentOffset: { y: scrollY } } }],
238
241
  { useNativeDriver: false })
239
242
  }
240
243
  scrollEventThrottle={16}
241
244
  >
242
- <Animated.View style={[styles.header, { height: headerHeight }]}>
243
- {!isDrawer && (<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
244
- <NavBar
245
- {...navBarProps}
246
- titleColor={theme.colors.white}
247
- btnStyle={{
248
- width: 55,
249
- height: 55,
250
- overflow: 'scroll',
251
- backgroundColor: 'black',
252
- borderRadius: 100,
253
- color: 'white',
254
- opacity: 0.8,
255
- left: 20,
256
- }}
257
- />
258
- </Animated.View>
259
- )}
260
- <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
261
- <NavBar
262
- {...navBarProps}
263
- btnStyle={{
264
- width: 55,
265
- height: 55,
266
- backgroundColor: 'transparent',
267
- borderRadius: 100,
268
- left: 20,
269
- }}
270
- />
271
- </Animated.View>
245
+ {!isDrawer ? (
246
+ <Animated.View style={[styles.header, { height: headerHeight }]}>
247
+ {!isDrawer && (
248
+ <Animated.View style={{ opacity: navBar1ContainerOpacity }}>
249
+ <NavBar
250
+ {...navBarProps}
251
+ titleColor={theme.colors.white}
252
+ btnStyle={{
253
+ width: 55,
254
+ height: 55,
255
+ overflow: 'scroll',
256
+ backgroundColor: 'black',
257
+ borderRadius: 100,
258
+ color: 'white',
259
+ opacity: 0.8,
260
+ left: 20,
261
+ }}
262
+ />
263
+ </Animated.View>
264
+ )}
265
+ <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
266
+ <NavBar
267
+ {...navBarProps}
268
+ btnStyle={{
269
+ width: 55,
270
+ height: 55,
271
+ backgroundColor: 'transparent',
272
+ borderRadius: 100,
273
+ left: 20,
274
+ }}
275
+ />
276
+ </Animated.View>
272
277
 
273
- <Animated.View style={{
274
- backgroundColor: 'white',
275
- width: orientationState?.dimensions?.width,
276
- opacity: collapsedBarContainerOpacity,
277
- }}>
278
- <View
279
- style={{
280
- flexDirection: 'row',
281
- alignItems: 'center',
282
- padding: 20,
283
- paddingTop: 0,
284
- paddingBottom: 10
285
- }}
286
- >
287
- <OImage
288
- source={{ uri: product?.images }}
289
- width={70}
290
- height={70}
291
- resizeMode="cover"
292
- borderRadius={6}
278
+ <Animated.View style={{
279
+ backgroundColor: 'white',
280
+ width: orientationState?.dimensions?.width,
281
+ opacity: collapsedBarContainerOpacity,
282
+ }}>
283
+ <View
284
+ style={{
285
+ flexDirection: 'row',
286
+ alignItems: 'center',
287
+ padding: 20,
288
+ paddingTop: 0,
289
+ paddingBottom: 10
290
+ }}
291
+ >
292
+ {product?.images ? (
293
+ <FastImage
294
+ style={{ height: 70, width: 70, borderRadius: 6 }}
295
+ source={{
296
+ uri: product?.images,
297
+ priority: FastImage.priority.normal,
298
+ // cache:FastImage.cacheControl.web
299
+ }}
300
+ resizeMode={FastImage.resizeMode.cover}
301
+ />
302
+ ) : (
303
+ <ImageBackground
304
+ style={{ height: 70, width: 70, borderRadius: 6 }}
305
+ source={theme.images.dummies.product}
306
+ imageStyle={{ borderRadius: 6 }}
307
+ resizeMode='cover'
308
+ />
309
+ )}
310
+ <OText
311
+ size={orientationState?.dimensions?.width * 0.025}
312
+ weight="bold"
313
+ mLeft={20}
314
+ numberOfLines={2}
315
+ >
316
+ {product?.name}
317
+ </OText>
318
+ </View>
319
+ <View
320
+ style={{
321
+ position: 'absolute',
322
+ bottom: -2,
323
+ height: 1,
324
+ backgroundColor: 'white',
325
+ width: orientationState?.dimensions?.width,
326
+ ...styles.shadow,
327
+ }}
293
328
  />
294
- <OText
295
- size={orientationState?.dimensions?.width * 0.025}
296
- weight="bold"
297
- mLeft={20}
298
- numberOfLines={2}
329
+ </Animated.View>
330
+
331
+ <Animated.View style={{
332
+ opacity: heroContainerOpacity,
333
+ position: 'absolute',
334
+ zIndex: -100,
335
+ transform: [{ translateY: heroTranslateY }],
336
+ }}>
337
+ <View
338
+ style={{
339
+ width: orientationState?.dimensions?.width,
340
+ height: HEADER_EXPANDED_HEIGHT,
341
+ position: 'absolute',
342
+ zIndex: 1,
343
+ backgroundColor: 'rgba(24, 28, 50, 0.4)',
344
+ }}
299
345
  >
300
- {product?.name}
301
- </OText>
302
- </View>
303
- <View
304
- style={{
305
- position: 'absolute',
306
- bottom: -2,
307
- height: 1,
308
- backgroundColor: 'white',
309
- width: orientationState?.dimensions?.width,
310
- ...styles.shadow,
311
- }}
312
- />
346
+ {product?.images ? (
347
+ <FastImage
348
+ style={{ flex: 1, justifyContent: 'center' }}
349
+ source={{
350
+ uri: product?.images,
351
+ priority: FastImage.priority.normal,
352
+ // cache:FastImage.cacheControl.web
353
+ }}
354
+ resizeMode={FastImage.resizeMode.cover}
355
+ />
356
+ ) : (
357
+ <ImageBackground
358
+ style={{ flex: 1, justifyContent: 'center' }}
359
+ source={theme.images.dummies.product}
360
+ resizeMode='cover'
361
+ />
362
+ )}
363
+ </View>
364
+ </Animated.View>
313
365
  </Animated.View>
314
-
315
- <Animated.View style={{
316
- opacity: heroContainerOpacity,
317
- position: 'absolute',
318
- zIndex: -100,
319
- transform: [{ translateY: heroTranslateY }],
320
- }}>
321
- <View
366
+ ) : (
367
+ <View style={{...styles.imageStyle}}>
368
+ <Animated.View
322
369
  style={{
323
- width: orientationState?.dimensions?.width,
324
- height: HEADER_EXPANDED_HEIGHT,
370
+ ...styles.imageStyle,
371
+ opacity: heroContainerOpacity,
325
372
  position: 'absolute',
326
- zIndex: 1,
327
- backgroundColor: 'rgba(24, 28, 50, 0.4)',
373
+ zIndex: -100,
374
+ transform: [{ translateY: heroTranslateY }],
328
375
  }}
329
376
  >
330
- <ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex: 1, justifyContent: 'center' }} />
377
+ <View style={styles.imageStyle}>
378
+ {product?.images ? (
379
+ <FastImage
380
+ style={{ flex: 1 }}
381
+ source={{
382
+ uri: product?.images,
383
+ priority: FastImage.priority.normal,
384
+ // cache:FastImage.cacheControl.web
385
+ }}
386
+ resizeMode={FastImage.resizeMode.cover}
387
+ />
388
+ ) : (
389
+ <ImageBackground
390
+ style={{ flex: 1, justifyContent: 'center' }}
391
+ source={theme.images.dummies.product}
392
+ resizeMode='cover'
393
+ />
394
+ )}
395
+ </View>
396
+ </Animated.View>
397
+ </View>
398
+ )}
331
399
 
332
- </View>
333
400
 
334
- <Animated.View
335
- style={{
336
- transform: [{ translateY: heroTranslateY }],
337
- width: orientationState?.dimensions?.width * 0.75,
338
- height: HEADER_EXPANDED_HEIGHT / 2,
339
- position: 'relative',
340
- top: HEADER_EXPANDED_HEIGHT / 3,
341
- zIndex: 100,
342
- padding: 20,
343
- }}
344
- >
401
+ {!loading && !error && product && (
402
+ <View style={{ paddingTop: isDrawer ? 20 : HEADER_EXPANDED_HEIGHT, paddingBottom: 80, paddingHorizontal: 16 }}>
403
+ <WrapContent isDrawer={isDrawer}>
345
404
  <OText
346
- color={theme.colors.white}
405
+ style={{ marginTop: 20 }}
347
406
  size={orientationState?.dimensions?.width * 0.038}
348
407
  weight="bold"
349
408
  mBottom={10}
@@ -352,33 +411,23 @@ export const ProductOptionsUI = (props: any) => {
352
411
  {product?.name || productCart?.name}
353
412
  </OText>
354
413
 
355
- <OText
356
- color={theme.colors.white}
357
- numberOfLines={4}
358
- >
359
- {product?.description || productCart?.description}
360
- </OText>
361
- </Animated.View>
362
- </Animated.View>
363
- </Animated.View>
414
+ {(product?.description || productCart?.description) && (
415
+ <OText
416
+ numberOfLines={4}
417
+ >
418
+ {product?.description || productCart?.description}
419
+ </OText>
420
+ )}
421
+
422
+ {((product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
423
+ (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
424
+ ) && (
425
+ <ProductDescription>
426
+ <OText size={20}>{t('SKU', 'Sku')}</OText>
427
+ <OText>{product?.sku || productCart?.sku}</OText>
428
+ </ProductDescription>
429
+ )}
364
430
 
365
- {/* {!isFromCheckout && (
366
- <Spinner visible={loading} />
367
- )} */}
368
- {!loading && !error && product && (
369
- <View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
370
- <WrapContent isDrawer={isDrawer}>
371
- <ProductDescription>
372
- {(
373
- (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
374
- (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
375
- ) && (
376
- <>
377
- <OText size={20}>{t('SKU', 'Sku')}</OText>
378
- <OText>{product?.sku || productCart?.sku}</OText>
379
- </>
380
- )}
381
- </ProductDescription>
382
431
  <ProductEditions>
383
432
  {product?.ingredients.length > 0 && (
384
433
  <View style={styles.optionContainer}>
@@ -397,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
397
446
  </WrapperIngredients>
398
447
  </View>
399
448
  )}
400
- {product?.extras.map((extra: any) => extra.options.map((option: any) => {
449
+ {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) => extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
401
450
  const currentState = productCart.options[`id:${option.id}`] || {}
402
451
  return (
403
452
  <React.Fragment key={option.id}>
@@ -411,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
411
460
  >
412
461
  <WrapperSubOption style={{ backgroundColor: isError(option.id) }}>
413
462
  {
414
- option.suboptions.map((suboption: any) => {
463
+ option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => {
415
464
  const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {}
416
465
  const balance = productCart.options[`id:${option.id}`]?.balance || 0
417
466
  return (
@@ -40,7 +40,7 @@ export const ProductTitle = styled.View`
40
40
  `
41
41
 
42
42
  export const ProductDescription = styled.View`
43
- margin-bottom: 30px;
43
+ margin-top: 10px;
44
44
  `
45
45
 
46
46
  export const ProductEditions = styled.View`
@@ -32,6 +32,7 @@ const ProductOptionUI = (props: any) => {
32
32
  <OText
33
33
  size={26}
34
34
  weight="bold"
35
+ style={{ width: '80%' }}
35
36
  >
36
37
  {option.name}
37
38
  </OText>
@@ -12,4 +12,5 @@ export const WrapHeader = styled.View`
12
12
  background-color: ${(props: any) => props.theme.colors.paleGray};
13
13
  border-top-left-radius: 10px;
14
14
  border-top-right-radius: 10px;
15
+ width: 100%;
15
16
  `
@@ -1,6 +1,6 @@
1
1
  import React,{ useState, useEffect } from 'react'
2
2
  import Spinner from 'react-native-loading-spinner-overlay';
3
- import { StyleSheet, View, Platform } from 'react-native'
3
+ import { StyleSheet, View, Platform, ImageBackground } from 'react-native'
4
4
  import {
5
5
  UpsellingPage as UpsellingPageController,
6
6
  useUtils,
@@ -20,6 +20,7 @@ import { Container } from '../../layouts/Container';
20
20
  import GridContainer from '../../layouts/GridContainer';
21
21
  import { PORTRAIT, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
22
22
  import { useTheme } from 'styled-components/native';
23
+ import FastImage from 'react-native-fast-image';
23
24
 
24
25
  const UpsellingProductsUI = (props: UpsellingProductsParams) => {
25
26
  const {
@@ -114,7 +115,24 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
114
115
  {
115
116
  !upsellingProducts.error ? upsellingProducts.products.map((product: any) => (
116
117
  <Item key={product.id}>
117
- <OImage source={{ uri: product.images }} style={styles.imageStyle} />
118
+ {product?.images ? (
119
+ <FastImage
120
+ style={styles.imageStyle}
121
+ source={{
122
+ uri: product?.images,
123
+ priority: FastImage.priority.normal,
124
+ // cache:FastImage.cacheControl.web
125
+ }}
126
+ resizeMode={FastImage.resizeMode.cover}
127
+ />
128
+ ) : (
129
+ <ImageBackground
130
+ style={styles.imageStyle}
131
+ source={theme.images.dummies.product}
132
+ imageStyle={{ borderRadius: 10 }}
133
+ resizeMode='cover'
134
+ />
135
+ )}
118
136
  <Details>
119
137
  <OText
120
138
  weight="500"
@@ -125,24 +143,22 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
125
143
  {product.name}
126
144
  </OText>
127
145
 
128
- {!!product?.price && (
129
- <OText>
130
- <OText
131
- color={theme.colors.primary}
132
- weight="500"
133
- >
134
- {parsePrice(product.price)}
135
- </OText>
146
+ <OText>
147
+ <OText
148
+ color={theme.colors.primary}
149
+ weight="500"
150
+ >
151
+ {parsePrice(product.price)}
152
+ </OText>
136
153
 
137
- <OText
138
- color={theme.colors.mediumGray}
139
- size={12}
140
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
141
- >
142
- {product?.offer_price ? ` ${parsePrice(product?.offer_price)} ` : ''}
143
- </OText>
154
+ <OText
155
+ color={theme.colors.mediumGray}
156
+ size={12}
157
+ style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
158
+ >
159
+ {product?.offer_price ? ` ${parsePrice(product?.offer_price)} ` : ''}
144
160
  </OText>
145
- )}
161
+ </OText>
146
162
  </Details>
147
163
 
148
164
  <OButton
@@ -200,24 +216,22 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
200
216
  {product.name}
201
217
  </OText>
202
218
 
203
- {!!product?.price && (
204
- <OText>
205
- <OText
206
- color={theme.colors.primary}
207
- weight="500"
208
- >
209
- {parsePrice(product.price)}
210
- </OText>
219
+ <OText>
220
+ <OText
221
+ color={theme.colors.primary}
222
+ weight="500"
223
+ >
224
+ {parsePrice(product.price)}
225
+ </OText>
211
226
 
212
- <OText
213
- color={theme.colors.mediumGray}
214
- size={12}
215
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
216
- >
217
- {product?.offer_price ? parsePrice(product?.offer_price) : ''}
218
- </OText>
227
+ <OText
228
+ color={theme.colors.mediumGray}
229
+ size={12}
230
+ style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
231
+ >
232
+ {product?.offer_price ? parsePrice(product?.offer_price) : ''}
219
233
  </OText>
220
- )}
234
+ </OText>
221
235
  </Details>
222
236
  <OButton
223
237
  text={t('ADD_PRODUCT', 'add product')}
@@ -10,8 +10,6 @@ import {
10
10
 
11
11
  import * as React from 'react';
12
12
  import styled from 'styled-components/native';
13
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
14
- import { Icon, IconProps } from 'react-native-vector-icons/Icon';
15
13
 
16
14
  const StyledButton = styled.View<Props>`
17
15
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -79,19 +77,17 @@ interface Props {
79
77
  isCircle?: boolean;
80
78
  bgColor?: string;
81
79
  borderColor?: string;
82
- iconProps?: IconProps;
83
- IconCustom?: React.FunctionComponent
84
80
  }
85
81
 
86
82
  const OButton = (props: Props): React.ReactElement => {
87
83
  if (props.isDisabled) {
88
84
  return (
89
85
  <View style={props.parentStyle}>
90
- <StyledButtonDisabled style={props.style}>
91
- <StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
92
- {props.text}
93
- </StyledTextDisabled>
94
- </StyledButtonDisabled>
86
+ <StyledButtonDisabled style={props.style}>
87
+ <StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
88
+ {props.text}
89
+ </StyledTextDisabled>
90
+ </StyledButtonDisabled>
95
91
  </View>
96
92
  );
97
93
  }
@@ -115,15 +111,6 @@ const OButton = (props: Props): React.ReactElement => {
115
111
  {props.imgLeftSrc ? (
116
112
  <StyledImage style={props.imgLeftStyle} source={props.imgLeftSrc} />
117
113
  ) : null}
118
- {props.iconProps ? (
119
- <>
120
- {props?.IconCustom ? (
121
- <props.IconCustom {...props.iconProps} />
122
- ) : (
123
- <AntDesignIcon {...props.iconProps} />
124
- )}
125
- </>
126
- ) : null}
127
114
  {props.text ? (
128
115
  <StyledText style={props.textStyle}>{props.text}</StyledText>
129
116
  ) : null}