ordering-ui-react-native 0.16.15 → 0.16.16

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.16.15",
3
+ "version": "0.16.16",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -276,7 +276,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
276
276
  };
277
277
  }, [])
278
278
 
279
-
280
279
  return (
281
280
  <OrderDetailsContainer keyboardShouldPersistTaps='handled'>
282
281
  {order && order?.id && !error && !loading && (
@@ -400,6 +399,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
400
399
  <InfoBlock>
401
400
  <OText size={18} style={{ textAlign: 'left' }} >{order?.customer?.name} {order?.customer?.lastname}</OText>
402
401
  <OText style={{ textAlign: 'left' }}>{order?.customer?.address}</OText>
402
+ {(!!order?.customer?.cellphone) && (
403
+ <OText size={18} style={{ textAlign: 'left' }}>
404
+ {(order?.customer?.country_phone_code) && `+${(order?.customer?.country_phone_code)} `}{(order?.customer?.cellphone)}
405
+ </OText>
406
+ )}
403
407
  </InfoBlock>
404
408
  </Customer>
405
409
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
@@ -274,8 +274,8 @@ export const OrderContentComponent = (props: OrderContent) => {
274
274
  <View style={styles.linkWithIcons}>
275
275
  <OLink
276
276
  PressStyle={styles.linkWithIcons}
277
- url={`tel:${order?.customer?.cellphone}`}
278
- shorcut={order?.customer?.cellphone}
277
+ url={`tel:${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
278
+ shorcut={`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
279
279
  TextStyle={styles.textLink}
280
280
  />
281
281
  </View>
@@ -124,6 +124,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
124
124
  isSoldOut={product.inventoried && !product.quantity}
125
125
  product={product}
126
126
  businessId={businessId}
127
+ categoryState={categoryState}
127
128
  onProductClick={() => onProductClick(product)}
128
129
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
129
130
  handleUpdateProducts={handleUpdateProducts}
@@ -148,6 +149,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
148
149
  isSoldOut={product.inventoried && !product.quantity}
149
150
  product={product}
150
151
  businessId={businessId}
152
+ categoryState={categoryState}
151
153
  onProductClick={onProductClick}
152
154
  handleUpdateProducts={handleUpdateProducts}
153
155
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
@@ -236,10 +238,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
236
238
  <>
237
239
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
238
240
  <SingleProductCard
239
- key={i}
241
+ key={`${product?.id}_${i}`}
240
242
  isSoldOut={product.inventoried && !product.quantity}
241
243
  businessId={businessId}
242
244
  product={product}
245
+ categoryState={categoryState}
243
246
  onProductClick={onProductClick}
244
247
  handleUpdateProducts={handleUpdateProducts}
245
248
  productAddedToCartLength={currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)}
@@ -256,6 +256,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
256
256
 
257
257
  {business?.categories?.length > 0 && isOpenFiltProducts && (
258
258
  <FiltProductsContainer
259
+ isIos={Platform.OS === 'ios'}
259
260
  style={{
260
261
  height: Dimensions.get('window').height - filtProductsHeight
261
262
  }}
@@ -285,6 +286,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
285
286
  currentCart={currentCart}
286
287
  setSubcategoriesSelected={setSubcategoriesSelected}
287
288
  onClickCategory={handleChangeCategory}
289
+ handleUpdateProducts={handleUpdateProducts}
288
290
  isFiltMode
289
291
  />
290
292
  </View>
@@ -252,7 +252,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
252
252
  }
253
253
  >
254
254
  <HeaderWrapper
255
- source={theme.images.general.homeHero}
255
+ source={theme.images.backgrounds.business_list_header}
256
256
  style={{ paddingTop: top + 20 }}>
257
257
  {!auth && (
258
258
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
@@ -194,9 +194,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
194
194
  ))
195
195
  )}
196
196
  {!favoriteList?.loading && favoriteList?.favorites?.length > 0 && (
197
- favoriteList.favorites.map((order: any) => (
197
+ favoriteList.favorites.map((order: any, i: number) => (
198
198
  <SingleOrderCard
199
- key={order?.id}
199
+ key={`${order?.id}_${i}`}
200
200
  order={order}
201
201
  getOrderStatus={getOrderStatus}
202
202
  onNavigationRedirect={onNavigationRedirect}
@@ -231,9 +231,9 @@ const FavoriteListUI = (props: FavoriteParams) => {
231
231
  ))
232
232
  )}
233
233
  {!favoriteList?.loading && favoriteList?.favorites?.length > 0 && (
234
- favoriteList.favorites.map((product: any) => (
234
+ favoriteList.favorites.map((product: any, i: number) => (
235
235
  <SingleProductCard
236
- key={product?.id}
236
+ key={`${product?.id}_${i}`}
237
237
  isSoldOut={product.inventoried && !product.quantity}
238
238
  product={product}
239
239
  onProductClick={() => {}}
@@ -663,13 +663,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
663
663
  mBottom={2}>
664
664
  {order?.customer?.address}
665
665
  </OText>
666
- <OText
667
- size={12}
668
- lineHeight={18}
669
- color={theme.colors.textNormal}
670
- mBottom={2}>
671
- {order?.customer?.cellphone}
672
- </OText>
666
+ {(!!order?.customer?.cellphone) && (
667
+ <OText
668
+ size={12}
669
+ lineHeight={18}
670
+ color={theme.colors.textNormal}
671
+ mBottom={2}>
672
+ {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
673
+ </OText>
674
+ )}
673
675
  </InfoBlock>
674
676
  </Customer>
675
677
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
@@ -156,9 +156,11 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
156
156
  )}
157
157
  <CardInfoWrapper>
158
158
  <ContentHeader>
159
- <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
160
- {order.business?.name}
161
- </OText>
159
+ <View style={{ flex: 1 }}>
160
+ <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
161
+ {order.business?.name}
162
+ </OText>
163
+ </View>
162
164
  {!!!pastOrders && (
163
165
  <>
164
166
  {isMessageView ? (
@@ -18,17 +18,19 @@ import { shape } from '../../utils';
18
18
  function SingleProductCardPropsAreEqual(prevProps : any, nextProps : any) {
19
19
  return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
20
20
  prevProps.isSoldOut === nextProps.isSoldOut &&
21
- prevProps.productAddedToCartLength === nextProps.productAddedToCartLength
21
+ prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
22
+ prevProps.categoryState === nextProps.categoryState
22
23
  }
23
24
 
24
- const SinguleProductCardUI = (props: SingleProductCardParams) => {
25
+ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
25
26
  const {
26
27
  product,
27
28
  isSoldOut,
28
29
  onProductClick,
29
30
  productAddedToCartLength,
30
31
  style,
31
- handleFavoriteProduct
32
+ handleFavoriteProduct,
33
+ handleUpdateProducts
32
34
  } = props;
33
35
 
34
36
  const theme = useTheme();
@@ -210,12 +212,12 @@ const SinguleProductCardUI = (props: SingleProductCardParams) => {
210
212
  )}
211
213
  </CardContainer>
212
214
  );
213
- }
215
+ }, SingleProductCardPropsAreEqual);
214
216
 
215
- export const SingleProductCard = React.memo((props: SingleProductCardParams) => {
217
+ export const SingleProductCard = (props: SingleProductCardParams) => {
216
218
  const singleProductCardProps = {
217
219
  ...props,
218
220
  UIComponent: SinguleProductCardUI
219
221
  }
220
222
  return <SingleProductCardController {...singleProductCardProps} />
221
- }, SingleProductCardPropsAreEqual);
223
+ }
@@ -278,6 +278,7 @@ export interface SingleProductCardParams {
278
278
  onProductClick: any;
279
279
  productAddedToCartLength: number;
280
280
  style?: ViewStyle,
281
+ categoryState?: any,
281
282
  handleFavoriteProduct?: any,
282
283
  handleUpdateProducts?: any
283
284
  }