ordering-ui-react-native 0.14.7 → 0.14.8

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.7",
3
+ "version": "0.14.8",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -34,7 +34,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
34
34
  return (
35
35
  <ProductsContainer>
36
36
  {category.id && (
37
- categoryState.products?.map((product: any) => (
37
+ categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
38
38
  <SingleProductCard
39
39
  key={product.id}
40
40
  isSoldOut={(product.inventoried && !product.quantity)}
@@ -51,7 +51,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
51
51
  <>
52
52
  <OText size={18} weight='bold' mBottom={10}>{t('FEATURED', 'Featured')}</OText>
53
53
  <>
54
- {categoryState.products?.map((product: any) => product.featured && (
54
+ {categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => product.featured && (
55
55
  <SingleProductCard
56
56
  key={product.id}
57
57
  isSoldOut={(product.inventoried && !product.quantity)}
@@ -77,7 +77,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
77
77
  <OText size={18} weight='bold' mBottom={10}>{category.name}</OText>
78
78
  <>
79
79
  {
80
- products.map((product: any) => (
80
+ products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
81
81
  <SingleProductCard
82
82
  key={product.id}
83
83
  isSoldOut={product.inventoried && !product.quantity}
@@ -133,9 +133,8 @@ export const ProductOptionsUI = (props: any) => {
133
133
  <>
134
134
  <View style={{ flexDirection: 'column', width: '100%' }}>
135
135
  <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}</OText>
136
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 10 }}>
137
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
138
- <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'}>
136
+ {(product?.estimated_person || (product?.sku && product?.sku !== '-1' && product?.sku !== '1')) && (
137
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0, marginBottom: 10 }} color={'#909BA9'}>
139
138
  {
140
139
  ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
141
140
  && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
@@ -147,6 +146,12 @@ export const ProductOptionsUI = (props: any) => {
147
146
  && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
148
147
  }
149
148
  </OText>
149
+ )}
150
+ <View style={{ flexDirection: 'row', marginBottom: 10}}>
151
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
152
+ {product?.offer_price && (
153
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
154
+ )}
150
155
  </View>
151
156
  </View>
152
157
  </>
@@ -369,6 +374,13 @@ const styles = StyleSheet.create({
369
374
  resizeMode: 'cover',
370
375
  minHeight: 200,
371
376
  zIndex: 0
377
+ },
378
+ regularPriceStyle: {
379
+ fontSize: 14,
380
+ color: '#808080',
381
+ textDecorationLine: 'line-through',
382
+ marginLeft: 7,
383
+ marginRight: 7
372
384
  }
373
385
  })
374
386
 
@@ -4,7 +4,8 @@ import { SingleProductCardParams } from '../../types'
4
4
  import {
5
5
  CardContainer,
6
6
  CardInfo,
7
- SoldOut
7
+ SoldOut,
8
+ PricesContainer
8
9
  } from './styles'
9
10
  import { StyleSheet } from 'react-native'
10
11
  import { OText, OIcon } from '../shared'
@@ -40,6 +41,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
40
41
  width: 75,
41
42
  height: 75,
42
43
  borderRadius: 10,
44
+ },
45
+ regularPriceStyle: {
46
+ fontSize: 12,
47
+ color: '#808080',
48
+ textDecorationLine: 'line-through',
49
+ marginLeft: 7,
50
+ marginRight: 7
43
51
  }
44
52
  })
45
53
 
@@ -76,7 +84,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
76
84
  <CardInfo>
77
85
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
78
86
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
79
- <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
87
+ <PricesContainer>
88
+ <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
89
+ {product?.offer_price && (
90
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
91
+ )}
92
+ </PricesContainer>
80
93
  </CardInfo>
81
94
 
82
95
  {(isSoldOut || maxProductQuantity <= 0) && (
@@ -22,3 +22,7 @@ export const SoldOut = styled.View`
22
22
  bottom: 5px;
23
23
  right: 5px;
24
24
  `
25
+ export const PricesContainer = styled.View`
26
+ flex-direction: row;
27
+ align-items: center;
28
+ `
@@ -90,8 +90,9 @@ const MessagesUI = (props: MessagesParams) => {
90
90
  console.log('ImagePicker Error: ', response.errorMessage);
91
91
  showToast(ToastType.Error, response.errorMessage);
92
92
  } else {
93
- if (response.uri) {
94
- const url = `data:${response.type};base64,${response.base64}`
93
+ if (response?.assets?.length > 0) {
94
+ const image = response?.assets[0]
95
+ const url = `data:${image.type};base64,${image.base64}`
95
96
  setImage && setImage(url);
96
97
  } else {
97
98
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -109,7 +110,7 @@ const MessagesUI = (props: MessagesParams) => {
109
110
  const messageConsole = (message: any) => {
110
111
  return message.change?.attribute !== 'driver_id'
111
112
  ?
112
- `${t('ORDER', 'Order')} ${message.change.attribute} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
113
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
113
114
  : message.change.new
114
115
  ?
115
116
  `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
@@ -233,11 +234,11 @@ const MessagesUI = (props: MessagesParams) => {
233
234
  <InputToolbar
234
235
  {...props}
235
236
  containerStyle={{
236
- padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
237
- flexDirection: 'column-reverse'
237
+ marginBottom: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
238
+ flexDirection: Platform.OS === 'ios' && isKeyboardShow ? 'column' : 'column-reverse'
238
239
  }}
239
240
  primaryStyle={{ alignItems: 'center', justifyContent: 'flex-start' }}
240
- renderAccessory={() => renderAccessory()}
241
+ renderAccessory={() => !isKeyboardShow && renderAccessory()}
241
242
  />
242
243
  )
243
244
 
@@ -76,18 +76,18 @@ const OBottomPopup = (props: Props) => {
76
76
  visible={open}
77
77
  onRequestClose={() => onClose()}
78
78
  >
79
- <View style={styles.container}>
80
- <TouchableWithoutFeedback
81
- style={styles.touchableOutsideStyle}
82
- onPress={() => onClose()}
83
- >
84
- <View style={styles.touchableOutsideStyle} />
85
- </TouchableWithoutFeedback>
86
- <View style={styles.bottomContainer}>
87
- <KeyboardView
88
- enabled
89
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
79
+ <KeyboardView
80
+ enabled
81
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
82
+ >
83
+ <View style={styles.container}>
84
+ <TouchableWithoutFeedback
85
+ style={styles.touchableOutsideStyle}
86
+ onPress={() => onClose()}
90
87
  >
88
+ <View style={styles.touchableOutsideStyle} />
89
+ </TouchableWithoutFeedback>
90
+ <View style={styles.bottomContainer}>
91
91
  <ScrollView showsVerticalScrollIndicator={false} >
92
92
  {customHeaderShow ? (
93
93
  <View style={styles.customHeaderStyle}>
@@ -108,9 +108,9 @@ const OBottomPopup = (props: Props) => {
108
108
  )}
109
109
  {children}
110
110
  </ScrollView>
111
- </KeyboardView>
111
+ </View>
112
112
  </View>
113
- </View>
113
+ </KeyboardView>
114
114
  </Modal>
115
115
  )
116
116
  }