ordering-ui-react-native 0.18.52 → 0.18.54

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.18.52",
3
+ "version": "0.18.54",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -4,6 +4,7 @@ import { ScrollView, StyleSheet, View } from 'react-native'
4
4
  import { useLanguage, useUtils } from 'ordering-components/native'
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
6
  import { OText, OButton } from '../shared'
7
+ import { formatSeconds } from '../../utils'
7
8
 
8
9
  export const OrderHistory = (props: any) => {
9
10
  const {
@@ -61,7 +62,7 @@ export const OrderHistory = (props: any) => {
61
62
  20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
62
63
  21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
63
64
  22: 'ORDER_LOOKING_FOR_DRIVER',
64
- 23: 'ORDER_DRIVER_ON_WAY'
65
+ 23: 'ORDER_DRIVER_ON_WAY'
65
66
  }
66
67
 
67
68
  const getLogisticTagStatus = (status: any) => {
@@ -128,12 +129,18 @@ export const OrderHistory = (props: any) => {
128
129
  <OText
129
130
  size={14}
130
131
  weight='bold'
131
- numberOfLines={1}
132
+ numberOfLines={message.change?.attribute === 'delivered_in' ? 2 : 1}
132
133
  ellipsizeMode='tail'
133
134
  >
134
135
  {message.change?.attribute === 'logistic_status'
135
136
  ? getLogisticTagStatus(parseInt(message.change.new, 10))
136
- : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
+ : message.change?.attribute === 'delivered_in' ? (
138
+ <>
139
+ {t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}{'\n'}
140
+ {formatSeconds(parseInt(message.change.new, 10))}
141
+ </>
142
+ )
143
+ : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
144
  }
138
145
  </OText>
139
146
  ) : (
@@ -112,7 +112,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
112
112
  defaultCode={defaultCode ?
113
113
  !isNaN(defaultCode)
114
114
  ? transformCountryCode(defaultCode)
115
- : defaultCode
115
+ : findExitingCode(defaultCode)
116
116
  : findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
117
117
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
118
  withDarkTheme
@@ -74,13 +74,22 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
74
74
  titleWrapStyle={{ paddingHorizontal: 0 }}
75
75
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
76
76
  />
77
- {order?.products?.map((product: any) => !product?.deleted && (
78
- <SingleProductReview
79
- key={product.id}
80
- product={product}
81
- formState={formState}
82
- handleChangeFormState={handleChangeFormState}
83
- />
77
+ {order?.products && order.products.length > 0 && order?.products.map(productsOrder => (
78
+ productsOrder?.length ? productsOrder?.map((product: any, i: any) => !product?.deleted ?
79
+ <SingleProductReview
80
+ key={i}
81
+ product={product}
82
+ formState={formState}
83
+ handleChangeFormState={handleChangeFormState}
84
+ /> : null
85
+ ) : (!productsOrder?.deleted ? (
86
+ <SingleProductReview
87
+ product={productsOrder}
88
+ formState={formState}
89
+ handleChangeFormState={handleChangeFormState}
90
+ />
91
+ ) : null
92
+ )
84
93
  ))}
85
94
  </ReviewProductsContainer>
86
95
 
@@ -273,7 +273,7 @@ export const transformCountryCode = (countryCode: number) => {
273
273
  }
274
274
 
275
275
  export const findExitingCode = (countryCode: string) => {
276
- const code = CODES.find((code: any) => code.countryCode === countryCode)
276
+ const code = CODES.find((code: any) => code.countryCode === (countryCode || '').toUpperCase())
277
277
  return code?.countryCode
278
278
  }
279
279