ordering-ui-react-native 0.12.14 → 0.12.18

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 (105) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressList/index.tsx +3 -1
  3. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +168 -156
  4. package/themes/business/src/components/NewOrderNotification/index.tsx +14 -1
  5. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -1
  6. package/themes/business/src/components/OrdersOption/index.tsx +19 -15
  7. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +389 -0
  8. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +36 -0
  9. package/themes/business/src/components 2/BusinessController/index.tsx +155 -0
  10. package/themes/business/src/components 2/BusinessController/styles.tsx +19 -0
  11. package/themes/business/src/components 2/Chat/index.tsx +1152 -0
  12. package/themes/business/src/components 2/Chat/styles.tsx +12 -0
  13. package/themes/business/src/components 2/Contacts/index.tsx +299 -0
  14. package/themes/business/src/components 2/Contacts/styles.tsx +42 -0
  15. package/themes/business/src/components 2/DriverMap/index.tsx +525 -0
  16. package/themes/business/src/components 2/FloatingButton/index.tsx +141 -0
  17. package/themes/business/src/components 2/FloatingButton/styles.tsx +35 -0
  18. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +204 -0
  19. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +11 -0
  20. package/themes/business/src/components 2/GoogleMap/index.tsx +347 -0
  21. package/themes/business/src/components 2/Home/index.tsx +111 -0
  22. package/themes/business/src/components 2/Home/styles.tsx +27 -0
  23. package/themes/business/src/components 2/LanguageSelector/index.tsx +124 -0
  24. package/themes/business/src/components 2/LanguageSelector/lang_country.json +152 -0
  25. package/themes/business/src/components 2/LanguageSelector/styles.tsx +17 -0
  26. package/themes/business/src/components 2/LoginForm/index.tsx +663 -0
  27. package/themes/business/src/components 2/LoginForm/styles.tsx +48 -0
  28. package/themes/business/src/components 2/LogoutButton/index.tsx +63 -0
  29. package/themes/business/src/components 2/MapView/index.tsx +317 -0
  30. package/themes/business/src/components 2/MessagesOption/index.tsx +337 -0
  31. package/themes/business/src/components 2/MessagesOption/styles.tsx +27 -0
  32. package/themes/business/src/components 2/NewOrderNotification/index.tsx +167 -0
  33. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +8 -0
  34. package/themes/business/src/components 2/NotFoundSource/index.tsx +52 -0
  35. package/themes/business/src/components 2/NotFoundSource/styles.tsx +17 -0
  36. package/themes/business/src/components 2/OrderDetails/Business.tsx +683 -0
  37. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +454 -0
  38. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +391 -0
  39. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +148 -0
  40. package/themes/business/src/components 2/OrderDetails/styles.tsx +84 -0
  41. package/themes/business/src/components 2/OrderMessage/index.tsx +344 -0
  42. package/themes/business/src/components 2/OrderMessage/styles.tsx +5 -0
  43. package/themes/business/src/components 2/OrderSummary/index.tsx +700 -0
  44. package/themes/business/src/components 2/OrderSummary/styles.tsx +61 -0
  45. package/themes/business/src/components 2/OrdersOption/index.tsx +755 -0
  46. package/themes/business/src/components 2/OrdersOption/styles.tsx +54 -0
  47. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +51 -0
  48. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +8 -0
  49. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +52 -0
  50. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +8 -0
  51. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +52 -0
  52. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +8 -0
  53. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +35 -0
  54. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +8 -0
  55. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +50 -0
  56. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +8 -0
  57. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +49 -0
  58. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +8 -0
  59. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +46 -0
  60. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +8 -0
  61. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +160 -0
  62. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +3 -0
  63. package/themes/business/src/components 2/PreviousMessages/index.tsx +304 -0
  64. package/themes/business/src/components 2/PreviousMessages/styles.tsx +32 -0
  65. package/themes/business/src/components 2/PreviousOrders/index.tsx +180 -0
  66. package/themes/business/src/components 2/PreviousOrders/styles.tsx +38 -0
  67. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +301 -0
  68. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +61 -0
  69. package/themes/business/src/components 2/SearchBar/index.tsx +112 -0
  70. package/themes/business/src/components 2/SignupForm/index.tsx +530 -0
  71. package/themes/business/src/components 2/SignupForm/styles.tsx +16 -0
  72. package/themes/business/src/components 2/StoresList/index.tsx +208 -0
  73. package/themes/business/src/components 2/StoresList/styles.tsx +26 -0
  74. package/themes/business/src/components 2/UserFormDetails/index.tsx +513 -0
  75. package/themes/business/src/components 2/UserFormDetails/styles.tsx +40 -0
  76. package/themes/business/src/components 2/UserProfileForm/index.tsx +496 -0
  77. package/themes/business/src/components 2/UserProfileForm/styles.tsx +36 -0
  78. package/themes/business/src/components 2/VerifyPhone/index.tsx +201 -0
  79. package/themes/business/src/components 2/VerifyPhone/styles.tsx +43 -0
  80. package/themes/business/src/components 2/shared/OAlert.tsx +52 -0
  81. package/themes/business/src/components 2/shared/OButton.tsx +149 -0
  82. package/themes/business/src/components 2/shared/OChatBubble.tsx +100 -0
  83. package/themes/business/src/components 2/shared/ODropDown.tsx +195 -0
  84. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +328 -0
  85. package/themes/business/src/components 2/shared/OFab.tsx +54 -0
  86. package/themes/business/src/components 2/shared/OIcon.tsx +67 -0
  87. package/themes/business/src/components 2/shared/OIconButton.tsx +127 -0
  88. package/themes/business/src/components 2/shared/OInput.tsx +144 -0
  89. package/themes/business/src/components 2/shared/OLink.tsx +76 -0
  90. package/themes/business/src/components 2/shared/OModal.tsx +275 -0
  91. package/themes/business/src/components 2/shared/OSegment.tsx +86 -0
  92. package/themes/business/src/components 2/shared/OText.tsx +55 -0
  93. package/themes/business/src/components 2/shared/OTextarea.tsx +46 -0
  94. package/themes/business/src/components 2/shared/OToast.tsx +92 -0
  95. package/themes/business/src/components 2/shared/index.tsx +27 -0
  96. package/themes/business/src/types/index.tsx +4 -1
  97. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +128 -83
  98. package/themes/kiosk/src/components/DrawerView/index.tsx +57 -0
  99. package/themes/kiosk/src/components/DrawerView/styles.tsx +30 -0
  100. package/themes/kiosk/src/components/LanguageSelector/index.tsx +78 -58
  101. package/themes/kiosk/src/components/OrderDetails/index.tsx +3 -1
  102. package/themes/kiosk/src/components/ProductForm/index.tsx +129 -127
  103. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  104. package/themes/original/src/components/BusinessesListing/index.tsx +9 -6
  105. package/themes/original/src/components/OrderProgress/index.tsx +32 -18
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { TouchableOpacity, View, StyleSheet } from 'react-native'
3
3
  import { LanguageSelector as LanguageSelectorController, useLanguage } from 'ordering-components/native'
4
4
  import CountryPicker, { Flag } from 'react-native-country-picker-modal'
@@ -9,6 +9,7 @@ import { LanguageSelectorParams } from '../../types'
9
9
  import { OText } from '../shared'
10
10
  import MatarialIcon from "react-native-vector-icons/MaterialIcons"
11
11
  import { useTheme } from 'styled-components/native'
12
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
12
13
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
13
14
  const {
14
15
  languagesState,
@@ -18,7 +19,7 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
18
19
 
19
20
  const theme = useTheme()
20
21
  const [{loading}] = useLanguage()
21
-
22
+ const [isLoading, setIsLoading] = useState(true)
22
23
  const styles = StyleSheet.create({
23
24
  closeIcon: {
24
25
  width: 48, marginLeft: 32
@@ -27,6 +28,15 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
27
28
  marginLeft: 40
28
29
  }
29
30
  })
31
+ useEffect(() => {
32
+ if (!isLoading) return
33
+ const loadingLanguage = setTimeout(() =>{
34
+ setIsLoading(false)
35
+ }, 1000);
36
+ return () => {
37
+ clearTimeout(loadingLanguage);
38
+ }
39
+ }, [])
30
40
 
31
41
  const _languages = languagesState?.languages?.map((language: any) => {
32
42
  return {
@@ -48,63 +58,73 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
48
58
  const currentLanguageData = _languages?.find((item:any) => item.value == currentLanguage);
49
59
 
50
60
  return (
51
- <Container>
52
- {languagesState?.languages && (
53
- <CountryPicker
54
- countryCode={currentLanguageData?.countryCode}
55
- visible={isCountryModalVisible}
56
- onClose={() => setCountryModalVisible(false)}
57
- withCountryNameButton
58
- countryCodes={countryCodes}
59
- closeButtonStyle={styles.closeIcon}
60
- renderFlagButton={() => (
61
- <TouchableOpacity
62
- onPress={() => setCountryModalVisible(true)}
63
- disabled={loading}
64
- >
65
- <LanguageItem>
66
- <Flag
67
- withEmoji
68
- flagSize={24}
69
- countryCode={currentLanguageData?.countryCode}
70
- />
71
- <OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
72
- <MatarialIcon name='keyboard-arrow-down' size={24}/>
73
- </LanguageItem>
74
- </TouchableOpacity>
61
+ <>
62
+ { isLoading ?
63
+ (<Container>
64
+ <Placeholder style={{ width: 130, paddingTop: 10 }} Animation={Fade}>
65
+ <PlaceholderLine height={15}/>
66
+ </Placeholder>
67
+ </Container>
68
+ ):(
69
+ <Container>
70
+ {languagesState?.languages && (
71
+ <CountryPicker
72
+ countryCode={currentLanguageData?.countryCode}
73
+ visible={isCountryModalVisible}
74
+ onClose={() => setCountryModalVisible(false)}
75
+ withCountryNameButton
76
+ countryCodes={countryCodes}
77
+ closeButtonStyle={styles.closeIcon}
78
+ renderFlagButton={() => (
79
+ <TouchableOpacity
80
+ onPress={() => setCountryModalVisible(true)}
81
+ disabled={loading}
82
+ >
83
+ <LanguageItem>
84
+ <Flag
85
+ withEmoji
86
+ flagSize={24}
87
+ countryCode={currentLanguageData?.countryCode}
88
+ />
89
+ <OText color={theme.colors.primary}>{currentLanguageData?.label}</OText>
90
+ <MatarialIcon name='keyboard-arrow-down' size={24}/>
91
+ </LanguageItem>
92
+ </TouchableOpacity>
93
+ )}
94
+ flatListProps={{
95
+ /* @ts-ignore */
96
+ keyExtractor: (item) => item.value,
97
+ data: _languages || [],
98
+ renderItem: ({item} : any) => (
99
+ <TouchableOpacity
100
+ onPress={() => {
101
+ /* @ts-ignore */
102
+ handleChangeLanguage(item.value);
103
+ setCountryModalVisible(false);
104
+ }}
105
+ disabled={loading}
106
+ >
107
+ <LanguageItem>
108
+ <View style={styles.flagsContainer} />
109
+ <Flag
110
+ withEmoji
111
+ flagSize={24}
112
+ /* @ts-ignore */
113
+ countryCode={item.countryCode}
114
+ />
115
+ <OText>{
116
+ /* @ts-ignore */
117
+ item.label
118
+ }</OText>
119
+ </LanguageItem>
120
+ </TouchableOpacity>
121
+ )
122
+ }}
123
+ />
75
124
  )}
76
- flatListProps={{
77
- /* @ts-ignore */
78
- keyExtractor: (item) => item.value,
79
- data: _languages || [],
80
- renderItem: ({item} : any) => (
81
- <TouchableOpacity
82
- onPress={() => {
83
- /* @ts-ignore */
84
- handleChangeLanguage(item.value);
85
- setCountryModalVisible(false);
86
- }}
87
- disabled={loading}
88
- >
89
- <LanguageItem>
90
- <View style={styles.flagsContainer} />
91
- <Flag
92
- withEmoji
93
- flagSize={24}
94
- /* @ts-ignore */
95
- countryCode={item.countryCode}
96
- />
97
- <OText>{
98
- /* @ts-ignore */
99
- item.label
100
- }</OText>
101
- </LanguageItem>
102
- </TouchableOpacity>
103
- )
104
- }}
105
- />
106
- )}
107
- </Container>
125
+ </Container>
126
+ )}
127
+ </>
108
128
  )
109
129
  }
110
130
 
@@ -33,7 +33,7 @@ import OptionSwitch, { Opt } from '../../components/shared/OOptionToggle';
33
33
  import { verifyDecimals } from '../../../../../src/utils'
34
34
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
35
35
  import { useTheme } from 'styled-components/native'
36
- import { _retrieveStoreData } from '../../../../../src/providers/StoreUtil';
36
+ import { _retrieveStoreData, _setStoreData } from '../../../../../src/providers/StoreUtil';
37
37
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
38
38
  import EvilIcons from 'react-native-vector-icons/EvilIcons'
39
39
  const _EMAIL = 'email';
@@ -218,6 +218,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
218
218
  }
219
219
  getCustomerName()
220
220
  const redirectHome = setTimeout(() =>{
221
+ _setStoreData('customer_name', {customerName: ''});
221
222
  navigation.reset({
222
223
  routes: [{ name: 'Intro' }],
223
224
  });
@@ -344,6 +345,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
344
345
  <OButton
345
346
  text={`${t('YOU_ARE_DONE', 'You are done! Click to close')}!`}
346
347
  onClick={() => {
348
+ _setStoreData('customer_name', {customerName: ''});
347
349
  navigation.reset({
348
350
  routes: [{ name: 'Intro' }],
349
351
  });
@@ -55,7 +55,8 @@ export const ProductOptionsUI = (props: any) => {
55
55
  handleChangeCommentState,
56
56
  productObject,
57
57
  onClose,
58
- isFromCheckout
58
+ isFromCheckout,
59
+ isDrawer
59
60
  } = props;
60
61
 
61
62
  const theme = useTheme();
@@ -230,145 +231,146 @@ export const ProductOptionsUI = (props: any) => {
230
231
 
231
232
  return (
232
233
  <>
233
- <Animated.View style={[styles.header, { height: headerHeight }]}>
234
- <Animated.View style={{ opacity: navBar1ContainerOpacity }}>
235
- <NavBar
236
- {...navBarProps}
237
- titleColor={theme.colors.white}
238
- {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left_white })}
239
- btnStyle={{
240
- width: 55,
241
- height: 55,
242
- backgroundColor: 'black',
243
- borderRadius: 100,
244
- opacity: 0.8,
245
- left: 20,
246
- }}
247
- imgLeftStyle={{ width: 27, height: 27 }}
248
- />
249
- </Animated.View>
250
- <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
251
- <NavBar
252
- {...navBarProps}
253
- {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
254
- btnStyle={{
255
- width: 55,
256
- height: 55,
257
- backgroundColor: 'transparent',
258
- borderRadius: 100,
259
- left: 20,
260
- }}
261
- imgLeftStyle={{ width: 27, height: 27 }}
262
- />
263
- </Animated.View>
264
-
265
- <Animated.View style={{
266
- backgroundColor: 'white',
267
- width: orientationState?.dimensions?.width,
268
- opacity: collapsedBarContainerOpacity,
269
- }}>
270
- <View
271
- style={{
272
- flexDirection: 'row',
273
- alignItems: 'center',
274
- padding: 20,
275
- paddingTop: 0,
276
- paddingBottom: 10
277
- }}
278
- >
279
- <OImage
280
- source={{uri: product?.images}}
281
- width={70}
282
- height={70}
283
- resizeMode="cover"
284
- borderRadius={6}
234
+ <ScrollView
235
+ style={styles.mainContainer}
236
+ contentContainerStyle={styles.scrollContainer}
237
+ onScroll={Animated.event(
238
+ [{ nativeEvent: { contentOffset: { y: scrollY }} }],
239
+ {useNativeDriver: false})
240
+ }
241
+ scrollEventThrottle={16}
242
+ >
243
+ <Animated.View style={[styles.header, { height: headerHeight }]}>
244
+ {!isDrawer && (<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
245
+ <NavBar
246
+ {...navBarProps}
247
+ titleColor={theme.colors.white}
248
+ {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left_white })}
249
+ btnStyle={{
250
+ width: 55,
251
+ height: 55,
252
+ backgroundColor: 'black',
253
+ borderRadius: 100,
254
+ opacity: 0.8,
255
+ left: 20,
256
+ }}
257
+ imgLeftStyle={{ width: 27, height: 27 }}
258
+ />
259
+ </Animated.View>
260
+ )}
261
+ <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
262
+ <NavBar
263
+ {...navBarProps}
264
+ {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
265
+ btnStyle={{
266
+ width: 55,
267
+ height: 55,
268
+ backgroundColor: 'transparent',
269
+ borderRadius: 100,
270
+ left: 20,
271
+ }}
272
+ imgLeftStyle={{ width: 27, height: 27 }}
285
273
  />
286
- <OText
287
- size={orientationState?.dimensions?.width * 0.025}
288
- weight="bold"
289
- mLeft={20}
290
- numberOfLines={2}
274
+ </Animated.View>
275
+
276
+ <Animated.View style={{
277
+ backgroundColor: 'white',
278
+ width: orientationState?.dimensions?.width,
279
+ opacity: collapsedBarContainerOpacity,
280
+ }}>
281
+ <View
282
+ style={{
283
+ flexDirection: 'row',
284
+ alignItems: 'center',
285
+ padding: 20,
286
+ paddingTop: 0,
287
+ paddingBottom: 10
288
+ }}
291
289
  >
292
- {product?.name}
293
- </OText>
294
- </View>
295
- <View
296
- style={{
297
- position: 'absolute',
298
- bottom: -2,
299
- height: 1,
300
- backgroundColor: 'white',
301
- width: orientationState?.dimensions?.width,
302
- ...styles.shadow,
303
- }}
304
- />
305
- </Animated.View>
290
+ <OImage
291
+ source={{uri: product?.images}}
292
+ width={70}
293
+ height={70}
294
+ resizeMode="cover"
295
+ borderRadius={6}
296
+ />
297
+ <OText
298
+ size={orientationState?.dimensions?.width * 0.025}
299
+ weight="bold"
300
+ mLeft={20}
301
+ numberOfLines={2}
302
+ >
303
+ {product?.name}
304
+ </OText>
305
+ </View>
306
+ <View
307
+ style={{
308
+ position: 'absolute',
309
+ bottom: -2,
310
+ height: 1,
311
+ backgroundColor: 'white',
312
+ width: orientationState?.dimensions?.width,
313
+ ...styles.shadow,
314
+ }}
315
+ />
316
+ </Animated.View>
306
317
 
307
- <Animated.View style={{
308
- opacity: heroContainerOpacity,
309
- position: 'absolute',
310
- zIndex: -100,
311
- transform: [{translateY: heroTranslateY }],
312
- }}>
313
- <View
314
- style={{
315
- width: orientationState?.dimensions?.width,
316
- height: HEADER_EXPANDED_HEIGHT,
317
- position: 'absolute',
318
- zIndex: 1,
319
- backgroundColor: 'rgba(24, 28, 50, 0.4)',
320
- }}
321
- >
322
- <ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
318
+ <Animated.View style={{
319
+ opacity: heroContainerOpacity,
320
+ position: 'absolute',
321
+ zIndex: -100,
322
+ transform: [{translateY: heroTranslateY }],
323
+ }}>
324
+ <View
325
+ style={{
326
+ width: orientationState?.dimensions?.width,
327
+ height: HEADER_EXPANDED_HEIGHT,
328
+ position: 'absolute',
329
+ zIndex: 1,
330
+ backgroundColor: 'rgba(24, 28, 50, 0.4)',
331
+ }}
332
+ >
333
+ <ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
323
334
 
324
- </View>
335
+ </View>
325
336
 
326
- <Animated.View
327
- style={{
328
- transform: [{translateY: heroTranslateY }],
329
- width: orientationState?.dimensions?.width * 0.75,
330
- height: HEADER_EXPANDED_HEIGHT / 2,
331
- position: 'relative',
332
- top: HEADER_EXPANDED_HEIGHT / 3,
333
- zIndex: 100,
334
- padding: 20,
335
- }}
336
- >
337
- <OText
338
- color={theme.colors.white}
339
- size={orientationState?.dimensions?.width * 0.048}
340
- weight="bold"
341
- mBottom={10}
342
- numberOfLines={2}
337
+ <Animated.View
338
+ style={{
339
+ transform: [{translateY: heroTranslateY }],
340
+ width: orientationState?.dimensions?.width * 0.75,
341
+ height: HEADER_EXPANDED_HEIGHT / 2,
342
+ position: 'relative',
343
+ top: HEADER_EXPANDED_HEIGHT / 3,
344
+ zIndex: 100,
345
+ padding: 20,
346
+ }}
343
347
  >
344
- {product?.name || productCart?.name}
345
- </OText>
348
+ <OText
349
+ color={theme.colors.white}
350
+ size={orientationState?.dimensions?.width * 0.048}
351
+ weight="bold"
352
+ mBottom={10}
353
+ numberOfLines={2}
354
+ >
355
+ {product?.name || productCart?.name}
356
+ </OText>
346
357
 
347
- <OText
348
- color={theme.colors.white}
349
- numberOfLines={4}
350
- >
351
- {product?.description || productCart?.description}
352
- </OText>
358
+ <OText
359
+ color={theme.colors.white}
360
+ numberOfLines={4}
361
+ >
362
+ {product?.description || productCart?.description}
363
+ </OText>
364
+ </Animated.View>
353
365
  </Animated.View>
354
366
  </Animated.View>
355
- </Animated.View>
356
367
 
357
- <ScrollView
358
- style={styles.mainContainer}
359
- contentContainerStyle={styles.scrollContainer}
360
- onScroll={Animated.event(
361
- [{ nativeEvent: { contentOffset: { y: scrollY }} }],
362
- {useNativeDriver: false})
363
- }
364
- scrollEventThrottle={16}
365
- >
366
368
  {!isFromCheckout && (
367
369
  <Spinner visible={loading} />
368
370
  )}
369
371
  {!loading && !error && product && (
370
- <View style={{ paddingTop: 20, paddingBottom: 80 }}>
371
- <WrapContent>
372
+ <View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
373
+ <WrapContent isDrawer={isDrawer}>
372
374
  <ProductDescription>
373
375
  {(
374
376
  (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
@@ -500,7 +502,7 @@ export const ProductOptionsUI = (props: any) => {
500
502
  </TouchableOpacity>
501
503
  </View>
502
504
  )}
503
- <View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : '80%' }}>
505
+ <View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%':'80%' }}>
504
506
  {productCart && !isSoldOut && maxProductQuantity > 0 && auth && orderState.options?.address_id && (
505
507
  <OButton
506
508
  onClick={() => handleSaveProduct()}
@@ -27,7 +27,7 @@ export const ProductHeader = styled.ImageBackground`
27
27
  `
28
28
 
29
29
  export const WrapContent = styled.View`
30
- padding: 0 20px;
30
+ padding: ${(props: any) => props.isDrawer ? '0 5px' : '0 20px'};
31
31
  position: relative;
32
32
  bottom: 20px;
33
33
  background-color: white;
@@ -40,6 +40,7 @@ import { BusinessFeaturedController } from '../BusinessFeaturedController';
40
40
  import { HighestRatedBusinesses } from '../HighestRatedBusinesses';
41
41
  import { getTypesText } from '../../utils';
42
42
  import { OrderProgress } from '../OrderProgress';
43
+ import { useIsFocused } from '@react-navigation/native';
43
44
 
44
45
  const PIXELS_TO_SCROLL = 1000;
45
46
 
@@ -56,7 +57,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
56
57
  } = props;
57
58
 
58
59
  const theme = useTheme();
59
-
60
+ const isFocused = useIsFocused();
60
61
 
61
62
  const styles = StyleSheet.create({
62
63
  container: {
@@ -226,11 +227,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
226
227
  </View>
227
228
  </OrderControlContainer>
228
229
  </HeaderWrapper>
229
- <OrderProgressWrapper>
230
- <OrderProgress
231
- {...props}
232
- />
233
- </OrderProgressWrapper>
230
+ {isFocused && (
231
+ <OrderProgressWrapper>
232
+ <OrderProgress
233
+ {...props}
234
+ />
235
+ </OrderProgressWrapper>
236
+ )}
234
237
  {featuredBusiness && featuredBusiness.length > 0 && (
235
238
  <FeaturedWrapper>
236
239
  <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('FEATURED_BUSINESS', 'Featured business')}</OText>
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import {
3
3
  OrderList,
4
4
  useLanguage,
@@ -10,7 +10,7 @@ import moment from 'moment';
10
10
  import { OText } from '../shared'
11
11
  import { NotFoundSource } from '../NotFoundSource'
12
12
  import { View, StyleSheet, TouchableOpacity } from 'react-native'
13
- import { Placeholder, Fade } from "rn-placeholder";
13
+ import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
14
14
  import FastImage from 'react-native-fast-image'
15
15
  import {
16
16
  ProgressContentWrapper,
@@ -29,8 +29,8 @@ const OrderProgressUI = (props: any) => {
29
29
  const theme = useTheme();
30
30
 
31
31
  const [, t] = useLanguage()
32
- const { loading, error, orders: values } = orderList
33
32
  const [{ optimizeImage, parseDate, parseTime }] = useUtils()
33
+ const [lastOrder, setLastOrder] = useState<any>(null)
34
34
  const imageFails = theme.images.general.emptyActiveOrders
35
35
 
36
36
  const styles = StyleSheet.create({
@@ -103,13 +103,14 @@ const OrderProgressUI = (props: any) => {
103
103
  return objectStatus && objectStatus
104
104
  }
105
105
 
106
- const convertDiffToHours = (time: any, order: any) => {
106
+ const convertDiffToHours = (order: any) => {
107
+ const time = order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time
107
108
  const deliveryTime = order?.delivery_datetime_utc
108
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
109
- : parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD hh:mm A' })
109
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD HH:mm' })
110
+ : parseDate(order?.delivery_datetime, { utc: false, outputFormat: 'YYYY-MM-DD HH:mm' })
110
111
  const [hour, minute] = time.split(':')
111
112
  const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
112
- const returnedDate = moment(new Date(deliveryTime)).add(result, 'minutes').format('hh:mm A')
113
+ const returnedDate = moment(deliveryTime).add(result, 'minutes').format('hh:mm A')
113
114
  return returnedDate
114
115
  }
115
116
 
@@ -117,17 +118,30 @@ const OrderProgressUI = (props: any) => {
117
118
  navigation && navigation.navigate(index)
118
119
  }
119
120
 
121
+ useEffect(() => {
122
+ if (orderList?.orders.length > 0) {
123
+ const sortedOrders = orderList.orders.sort((a: any, b:any) => a.id > b.id ? -1 : 1)
124
+ setLastOrder(sortedOrders[0])
125
+ }
126
+ }, [orderList?.orders])
127
+
120
128
  return (
121
129
  <>
122
- {orderList?.loading && <Placeholder height={150} Animation={Fade} />}
123
- {!orderList?.loading && orderList?.orders?.length > 0 && orderList?.orders.map((order: any) => (
124
- <View style={styles.main} key={order.id}>
130
+ {orderList?.loading && (
131
+ <Placeholder Animation={Fade} height={130}>
132
+ <PlaceholderLine height={50} style={{ borderRadius: 8, marginBottom: 10 }} />
133
+ <PlaceholderLine height={15} style={{ marginBottom: 10 }} />
134
+ <PlaceholderLine height={30} style={{ borderRadius: 8, marginBottom: 10 }} />
135
+ </Placeholder>
136
+ )}
137
+ {!orderList?.loading && orderList?.orders?.length > 0 && lastOrder && (
138
+ <View style={styles.main}>
125
139
  <OrderInfoWrapper style={{ flex: 1 }}>
126
140
  <View style={styles.logoWrapper}>
127
141
  <FastImage
128
142
  style={{ width: 50, height: 50 }}
129
143
  source={{
130
- uri: optimizeImage(order?.business?.logo, 'h_50,c_limit'),
144
+ uri: optimizeImage(lastOrder?.business?.logo, 'h_50,c_limit'),
131
145
  priority: FastImage.priority.normal,
132
146
  }}
133
147
  resizeMode={FastImage.resizeMode.cover}
@@ -161,24 +175,24 @@ const OrderProgressUI = (props: any) => {
161
175
  </OrderInfoWrapper>
162
176
  <View style={{ flex: 1 }}>
163
177
  <ProgressContentWrapper>
164
- <ProgressBar style={{ width: getOrderStatus(order.status)?.percentage ? `${getOrderStatus(order.status)?.percentage}%` : '0%' }} />
178
+ <ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
165
179
  </ProgressContentWrapper>
166
180
  <ProgressTextWrapper>
167
- <OText size={12}>{getOrderStatus(order.status)?.value}</OText>
181
+ <OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
168
182
  <TimeWrapper>
169
183
  <OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
170
184
  <OText size={11}>
171
- {order?.delivery_datetime_utc
172
- ? parseTime(order?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
173
- : parseTime(order?.delivery_datetime, { utc: false })}
185
+ {lastOrder?.delivery_datetime_utc
186
+ ? parseTime(lastOrder?.delivery_datetime_utc, { outputFormat: 'hh:mm A' })
187
+ : parseTime(lastOrder?.delivery_datetime, { utc: false })}
174
188
  &nbsp;-&nbsp;
175
- {convertDiffToHours(order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time, order)}
189
+ {convertDiffToHours(lastOrder)}
176
190
  </OText>
177
191
  </TimeWrapper>
178
192
  </ProgressTextWrapper>
179
193
  </View>
180
194
  </View>
181
- ))}
195
+ )}
182
196
  {!orderList?.loading && orderList?.orders?.length === 0 && (
183
197
  <NotFoundSource
184
198
  image={imageFails}