ordering-ui-react-native 0.14.45 → 0.14.46

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.14.45",
3
+ "version": "0.14.46",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -138,7 +138,7 @@ export const ProductOptionsUI = (props: any) => {
138
138
  </View>
139
139
  <View style={{ flexDirection: 'row', marginBottom: 10 }}>
140
140
  <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
141
- {!!product?.offer_price && (
141
+ {product?.offer_price !== null && product?.in_offer && (
142
142
  <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
143
143
  )}
144
144
  </View>
@@ -86,7 +86,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
86
86
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
87
87
  <PricesContainer>
88
88
  <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
89
- {!!product?.offer_price && (
89
+ {product?.offer_price !== null && product?.in_offer && (
90
90
  <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
91
91
  )}
92
92
  </PricesContainer>
@@ -289,16 +289,16 @@ export const ProductOptionsUI = (props: any) => {
289
289
  </>
290
290
  );
291
291
 
292
- const handleGoBack = navigation?.canGoBack()
293
- ? () => navigation.goBack()
294
- : () => navigation.navigate('Business', { store: props.businessSlug })
292
+ const handleGoBack = navigation?.canGoBack()
293
+ ? () => navigation.goBack()
294
+ : () => navigation.navigate('Business', { store: props.businessSlug })
295
295
 
296
296
  return (
297
- <SafeAreaView style={{ flex: 1 }}>
298
- <TopHeader>
299
- <TopActions onPress={() => handleGoBack()}>
300
- <OIcon src={theme.images.general.arrow_left} width={15} />
301
- </TopActions>
297
+ <SafeAreaView style={{ flex: 1 }}>
298
+ <TopHeader>
299
+ <TopActions onPress={() => handleGoBack()}>
300
+ <OIcon src={theme.images.general.arrow_left} width={15} />
301
+ </TopActions>
302
302
  </TopHeader>
303
303
  <ScrollView>
304
304
  {!error && (
@@ -349,13 +349,13 @@ export const ProductOptionsUI = (props: any) => {
349
349
  style={styles.slide1}
350
350
  key={i}
351
351
  >
352
- <FastImage
353
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
354
- source={{
355
- uri: optimizeImage(img, 'h_258,c_limit'),
356
- priority: FastImage.priority.normal,
357
- }}
358
- />
352
+ <FastImage
353
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1 }}
354
+ source={{
355
+ uri: optimizeImage(img, 'h_258,c_limit'),
356
+ priority: FastImage.priority.normal,
357
+ }}
358
+ />
359
359
  </View>
360
360
  ))}
361
361
  </Swiper>
@@ -379,18 +379,18 @@ export const ProductOptionsUI = (props: any) => {
379
379
  opacity: index === thumbsSwiper ? 1 : 0.8
380
380
  }}
381
381
  >
382
- <OIcon
383
- url={img}
384
- style={{
385
- borderColor: theme.colors.lightGray,
386
- borderRadius: 8,
387
- minHeight: '100%',
388
- opacity: isSoldOut ? 0.5 : 1
389
- }}
390
- width={56}
391
- height={56}
392
- cover
393
- />
382
+ <OIcon
383
+ url={img}
384
+ style={{
385
+ borderColor: theme.colors.lightGray,
386
+ borderRadius: 8,
387
+ minHeight: '100%',
388
+ opacity: isSoldOut ? 0.5 : 1
389
+ }}
390
+ width={56}
391
+ height={56}
392
+ cover
393
+ />
394
394
  </View>
395
395
  </TouchableOpacity>
396
396
 
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
446
446
  ) : (
447
447
  <View style={{ flexDirection: 'row', marginBottom: 10 }}>
448
448
  <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
449
- {!!product?.offer_price && (
449
+ {product?.offer_price !== null && product?.in_offer && (
450
450
  <OText style={{
451
451
  fontSize: 14,
452
452
  color: '#808080',
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
460
460
  </>
461
461
  )}
462
462
  </ProductTitle>
463
- <ProductDescription>
463
+ <ProductDescription>
464
464
  <OText color={theme.colors.textSecondary} size={12} lineHeight={18}>
465
465
  {product?.description || productCart?.description}
466
466
  </OText>
@@ -785,7 +785,7 @@ export const ProductOptionsUI = (props: any) => {
785
785
  <OText
786
786
  size={12}
787
787
  lineHeight={18}
788
- style={{ minWidth: 29, textAlign: 'center' }}
788
+ style={{ minWidth: 40, textAlign: 'center' }}
789
789
  >
790
790
  {qtyBy?.pieces && productCart.quantity}
791
791
  {qtyBy?.weight_unit && productCart.quantity * product?.weight}
@@ -809,36 +809,38 @@ export const ProductOptionsUI = (props: any) => {
809
809
  }
810
810
  />
811
811
  </TouchableOpacity>
812
- <WeightUnitSwitch>
813
- <TouchableOpacity
814
- onPress={() => handleSwitchQtyUnit('pieces')}
815
- >
816
- <WeightUnitItem active={qtyBy?.pieces}>
817
- <OText
818
- size={12}
819
- lineHeight={18}
820
- color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
821
- >
822
- {t('PIECES', 'pieces')}
823
- </OText>
824
- </WeightUnitItem>
825
- </TouchableOpacity>
826
- <View style={{ alignItems: 'flex-start' }}>
812
+ {isHaveWeight && (
813
+ <WeightUnitSwitch>
827
814
  <TouchableOpacity
828
- onPress={() => handleSwitchQtyUnit('weight_unit')}
815
+ onPress={() => handleSwitchQtyUnit('pieces')}
829
816
  >
830
- <WeightUnitItem active={qtyBy?.weight_unit}>
817
+ <WeightUnitItem active={qtyBy?.pieces}>
831
818
  <OText
832
819
  size={12}
833
820
  lineHeight={18}
834
- color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
821
+ color={qtyBy?.pieces ? theme.colors.primary : theme.colors.textNormal}
835
822
  >
836
- {product?.weight_unit}
823
+ {t('PIECES', 'pcs')}
837
824
  </OText>
838
825
  </WeightUnitItem>
839
826
  </TouchableOpacity>
840
- </View>
841
- </WeightUnitSwitch>
827
+ <View style={{ alignItems: 'flex-start' }}>
828
+ <TouchableOpacity
829
+ onPress={() => handleSwitchQtyUnit('weight_unit')}
830
+ >
831
+ <WeightUnitItem active={qtyBy?.weight_unit}>
832
+ <OText
833
+ size={12}
834
+ lineHeight={18}
835
+ color={qtyBy?.weight_unit ? theme.colors.primary : theme.colors.textNormal}
836
+ >
837
+ {product?.weight_unit}
838
+ </OText>
839
+ </WeightUnitItem>
840
+ </TouchableOpacity>
841
+ </View>
842
+ </WeightUnitSwitch>
843
+ )}
842
844
  </View>
843
845
  )}
844
846
  <View
@@ -907,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
907
909
  </View>
908
910
  </ProductActions>
909
911
  )}
910
- </SafeAreaView>
912
+ </SafeAreaView>
911
913
  );
912
914
  };
913
915
 
@@ -7,7 +7,7 @@ import {
7
7
  } from 'ordering-components/native';
8
8
  import { useTheme } from 'styled-components/native';
9
9
  import { SingleProductCardParams } from '../../types';
10
- import { CardContainer, CardInfo, SoldOut, QuantityContainer } from './styles';
10
+ import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer } from './styles';
11
11
  import { StyleSheet } from 'react-native';
12
12
  import { OText, OIcon } from '../shared';
13
13
  import FastImage from 'react-native-fast-image'
@@ -51,6 +51,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
51
51
  textAlign: 'center',
52
52
  borderRadius: 25,
53
53
  alignItems: 'center'
54
+ },
55
+ regularPriceStyle: {
56
+ fontSize: 12,
57
+ color: '#808080',
58
+ textDecorationLine: 'line-through',
59
+ marginLeft: 7,
60
+ marginRight: 7
54
61
  }
55
62
  });
56
63
 
@@ -97,13 +104,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
97
104
  (isSoldOut || maxProductQuantity <= 0) && styles.soldOutBackgroundStyle,
98
105
  ]}
99
106
  onPress={() => onProductClick?.(product)}>
100
- {productAddedToCartLength > 0 && (
101
- <QuantityContainer style={[styles.quantityContainer, {
102
- transform: [{ translateX: 10 }, { translateY: -10 }],
103
- }]}>
104
- <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
105
- </QuantityContainer>
106
- )}
107
+ {productAddedToCartLength > 0 && (
108
+ <QuantityContainer style={[styles.quantityContainer, {
109
+ transform: [{ translateX: 10 }, { translateY: -10 }],
110
+ }]}>
111
+ <OText size={12} color={theme.colors.white}>{productAddedToCartLength.toString()}</OText>
112
+ </QuantityContainer>
113
+ )}
107
114
  <CardInfo>
108
115
  <OText
109
116
  size={12}
@@ -113,9 +120,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
113
120
  style={styles.line18}>
114
121
  {product?.name}
115
122
  </OText>
116
- <OText size={12} weight={'400'} style={styles.line18} color={theme.colors.textNormal}>
117
- {parsePrice(product?.price)}
118
- </OText>
123
+ <PricesContainer>
124
+ <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
125
+ {product?.offer_price !== null && product?.in_offer && (
126
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
127
+ )}
128
+ </PricesContainer>
119
129
  <OText
120
130
  size={10}
121
131
  numberOfLines={2}
@@ -27,3 +27,7 @@ export const QuantityContainer = styled.View`
27
27
  align-items: center;
28
28
  justify-content: center;
29
29
  `
30
+ export const PricesContainer = styled.View`
31
+ flex-direction: row;
32
+ align-items: center;
33
+ `