ordering-ui-react-native 0.12.15 → 0.12.19

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.
@@ -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;
@@ -106,11 +106,11 @@ const OrderProgressUI = (props: any) => {
106
106
  const convertDiffToHours = (order: any) => {
107
107
  const time = order.delivery_type === 1 ? order?.business?.delivery_time : order?.business?.pickup_time
108
108
  const deliveryTime = order?.delivery_datetime_utc
109
- ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
110
- : 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' })
111
111
  const [hour, minute] = time.split(':')
112
112
  const result = time ? (parseInt(hour, 10) * 60) + parseInt(minute, 10) : 0
113
- 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')
114
114
  return returnedDate
115
115
  }
116
116