ordering-ui-react-native 0.16.70 → 0.16.73

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.70",
3
+ "version": "0.16.73",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
3
- import { useUtils, useOrder, useLanguage, useOrderingTheme } from 'ordering-components/native';
3
+ import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText, OModal } from '../shared';
6
6
  import { BusinessBasicInformationParams } from '../../types';
@@ -38,7 +38,6 @@ export const BusinessBasicInformation = (
38
38
  const { business, loading } = businessState;
39
39
 
40
40
  const theme = useTheme();
41
- const [orderingTheme] = useOrderingTheme()
42
41
  const [orderState] = useOrder();
43
42
  const [, t] = useLanguage();
44
43
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
@@ -46,8 +45,8 @@ export const BusinessBasicInformation = (
46
45
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
47
46
  const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
48
47
  const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
49
- const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
50
- const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
48
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'original'
49
+ const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
51
50
 
52
51
  const styles = StyleSheet.create({
53
52
  businesInfoheaderStyle: {
@@ -327,16 +327,17 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
327
327
  </OText>
328
328
  </WrapHeader>
329
329
  <SearchWrapper>
330
- <SearchBar
331
- autoFocus
332
- lazyLoad
333
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
334
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
335
- onSearch={(val: string) => handleChangeTermValue(val)}
336
- value={termValue}
337
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
338
- />
339
-
330
+ {isFocused && (
331
+ <SearchBar
332
+ autoFocus
333
+ lazyLoad
334
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
335
+ placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
336
+ onSearch={(val: string) => handleChangeTermValue(val)}
337
+ value={termValue}
338
+ iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
339
+ />
340
+ )}
340
341
  </SearchWrapper>
341
342
  {
342
343
  noResults && (
@@ -10,9 +10,9 @@ import {
10
10
  useUtils,
11
11
  ToastType,
12
12
  useToast,
13
- useConfig,
14
- useOrderingTheme
13
+ useConfig
15
14
  } from 'ordering-components/native'
15
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
16
16
  import { OButton, OIcon, OModal, OText } from '../shared'
17
17
  import Alert from '../../providers/AlertProvider'
18
18
  import { BusinessBasicInformation } from '../BusinessBasicInformation'
@@ -66,7 +66,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
66
66
  } = props
67
67
 
68
68
  const theme = useTheme();
69
- const [orderingTheme] = useOrderingTheme()
70
69
  const [, t] = useLanguage()
71
70
  const [{ auth }] = useSession()
72
71
  const [orderState, { clearCart }] = useOrder()
@@ -75,9 +74,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
75
74
  const [{ configs }] = useConfig()
76
75
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
77
76
 
78
- const isChewLayout = orderingTheme?.theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
79
- const showLogo = !orderingTheme?.theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
80
- const hideBusinessNearCity = orderingTheme?.theme?.business_view?.components?.near_business?.hidden
77
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
78
+ const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
79
+ const hideBusinessNearCity = theme?.business_view?.components?.near_business?.hidden ?? true
81
80
 
82
81
  const styles = StyleSheet.create({
83
82
  mainContainer: {
@@ -103,7 +102,13 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
103
102
  padding: 15,
104
103
  justifyContent: 'center',
105
104
  shadowColor: theme.colors.clear,
106
- }
105
+ },
106
+ businessSkeleton: {
107
+ borderRadius: 8,
108
+ marginRight: 20,
109
+ width: 56,
110
+ height: 56
111
+ },
107
112
  })
108
113
 
109
114
  const { business, loading, error } = businessState
@@ -277,6 +282,19 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
277
282
  </WrapSearchBar>
278
283
  )}
279
284
  </TopHeader>
285
+ {!hideBusinessNearCity && loading && (
286
+ <NearBusiness style={{ paddingBottom: 10 }}>
287
+ <Placeholder Animation={Fade}>
288
+ <View style={{ flexDirection: 'row' }}>
289
+ {[...Array(10).keys()].map(i => (
290
+ <View style={styles.businessSkeleton} key={i}>
291
+ <PlaceholderLine style={{ width: '100%', height: '100%' }} />
292
+ </View>
293
+ ))}
294
+ </View>
295
+ </Placeholder>
296
+ </NearBusiness>
297
+ )}
280
298
  {!hideBusinessNearCity && businessState?.business?.city_id && (
281
299
  <NearBusiness>
282
300
  <BusinessesListing
@@ -18,8 +18,7 @@ import {
18
18
  useSession,
19
19
  useOrder,
20
20
  useConfig,
21
- useUtils,
22
- useOrderingTheme
21
+ useUtils
23
22
  } from 'ordering-components/native';
24
23
  import { useTheme } from 'styled-components/native';
25
24
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -75,13 +74,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
75
74
  logosLayout
76
75
  } = props;
77
76
  const theme = useTheme();
78
- const [orderingTheme] = useOrderingTheme()
79
77
  const isFocused = useIsFocused();
80
78
  const appState = useRef(AppState.currentState)
81
79
  const searchBarRef = useRef<any>()
82
80
  const [appStateVisible, setAppStateVisible] = useState(appState.current);
83
- const isChewLayout = orderingTheme?.theme?.header?.components?.layout?.type === 'chew'
84
- const hideCities = orderingTheme?.theme?.business_listing_view?.components?.cities?.hidden
81
+ const isChewLayout = theme?.header?.components?.layout?.type === 'original'
82
+ const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
85
83
  const [refreshing] = useState(false);
86
84
  const styles = StyleSheet.create({
87
85
  container: {
@@ -132,7 +130,10 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
132
130
  borderColor: theme.colors.backgroundGray,
133
131
  borderRadius: 8,
134
132
  marginHorizontal: 40,
135
- height: 45
133
+ minHeight: 45,
134
+ paddingVertical: 5,
135
+ paddingHorizontal: 20,
136
+ borderWidth: 1
136
137
  },
137
138
  businessSkeleton: {
138
139
  borderRadius: 8,
@@ -426,7 +427,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
426
427
  </OrderControlContainer>
427
428
  ) : (
428
429
  <>
429
- {!isPreOrderSetting && (// cambiar
430
+ {isPreOrderSetting && (
430
431
  <View style={{ paddingHorizontal: 30 }}>
431
432
  <PreorderInput
432
433
  isChewLayout={isChewLayout}
@@ -464,36 +465,26 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
464
465
  </OrderTypesContainer>
465
466
  )}
466
467
  {!businessId && (
467
- <SearchBar
468
- forwardRef={searchBarRef}
469
- onSearch={handleChangeSearch}
470
- searchValue={searchValue}
471
- lazyLoad
472
- hideIcon
473
- isCancelXButtonShow={!!searchValue}
474
- onCancel={() => handleChangeSearch('')}
475
- placeholder={t('SEARCH', 'Search')}
476
- height={50}
477
- isDisabled={true}
478
- inputContainerStyles={styles.inputContainerStyles}
479
- containerStyles={{
480
- marginHorizontal: 40,
481
- marginTop: 20
482
- }}
483
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? { paddingBottom: 6 } : { paddingBottom: 4 } }}
484
- onPress={() => { navigation.navigate('BusinessSearch', { businessTypes }) }}
485
- onSubmitEditing={() => { navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
486
- />
468
+ <View style={{ marginTop: 20 }}>
469
+ <OButton
470
+ onClick={() => navigation.navigate('BusinessSearch', { businessTypes })}
471
+ text={t('SEARCH', 'Search')}
472
+ style={styles?.buttonCityStyle}
473
+ textStyle={{ color: theme.colors.textSecondary, fontSize: 16 }}
474
+ />
475
+ </View>
487
476
  )}
488
477
 
489
478
  {!hideCities && (
490
479
  <View style={{ marginTop: 10 }}>
491
- <OButton
492
- onClick={() => setIsOpenCities(true)}
493
- text={citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
494
- style={styles?.buttonCityStyle}
495
- textStyle={{ color: theme.colors.backgroundGray, fontWeight: 'bold', fontSize: 18 }}
496
- />
480
+ <TouchableOpacity
481
+ style={styles.buttonCityStyle}
482
+ onPress={() => setIsOpenCities(true)}
483
+ >
484
+ <OText size={18} color={theme.colors.backgroundGray} weight='bold' style={{ textAlign: 'center' }}>
485
+ {citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
486
+ </OText>
487
+ </TouchableOpacity>
497
488
  </View>
498
489
  )}
499
490
  <OrderProgressWrapper>
@@ -1,6 +1,6 @@
1
1
 
2
2
  import React, { useState, useEffect } from 'react'
3
- import { useOrder, useSession, useLanguage, useOrderingTheme } from 'ordering-components/native';
3
+ import { useOrder, useSession, useLanguage } from 'ordering-components/native';
4
4
 
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
@@ -12,8 +12,7 @@ import { NotificationSetting } from '../../../../../src/components/NotificationS
12
12
  export const BusinessesListing = (props: any) => {
13
13
  const { logosLayout } = props
14
14
  const theme = useTheme()
15
- const [orderingTheme] = useOrderingTheme()
16
- const layout = orderingTheme?.theme?.business_listing_view?.components?.layout?.type || 'original'
15
+ const layout = theme?.business_listing_view?.components?.layout?.type || 'original'
17
16
  const [, t] = useLanguage();
18
17
  const [{ auth }] = useSession()
19
18
  const [, { getLastOrderHasNoReview }] = useOrder();
@@ -145,6 +145,10 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
145
145
  };
146
146
 
147
147
  const handleClickViewOrder = (uuid: string) => {
148
+ if (isMessageView) {
149
+ handleClickOrder(order?.uuid)
150
+ return
151
+ }
148
152
  onNavigationRedirect &&
149
153
  onNavigationRedirect('OrderDetails', { orderId: uuid });
150
154
  };
@@ -274,16 +278,18 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
274
278
  {getOrderStatus(order.status)?.value}
275
279
  </OText>
276
280
  </View>
277
- <TouchableOpacity
278
- onPress={handleChangeFavorite}
279
- style={{ marginTop: 5 }}
280
- >
281
- <IconAntDesign
282
- name={order?.favorite ? 'heart' : 'hearto'}
283
- color={theme.colors.danger5}
284
- size={16}
285
- />
286
- </TouchableOpacity>
281
+ {!isMessageView && (
282
+ <TouchableOpacity
283
+ onPress={handleChangeFavorite}
284
+ style={{ marginTop: 5 }}
285
+ >
286
+ <IconAntDesign
287
+ name={order?.favorite ? 'heart' : 'hearto'}
288
+ color={theme.colors.danger5}
289
+ size={16}
290
+ />
291
+ </TouchableOpacity>
292
+ )}
287
293
  </ContentFooter>
288
294
  </CardInfoWrapper>
289
295
  </InnerContainer>
@@ -5,7 +5,6 @@ import {
5
5
  useOrder,
6
6
  useUtils,
7
7
  useSession,
8
- useOrderingTheme,
9
8
  SingleProductCard as SingleProductCardController
10
9
  } from 'ordering-components/native';
11
10
  import { useTheme } from 'styled-components/native';
@@ -41,8 +40,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
41
40
  } = props;
42
41
 
43
42
  const theme = useTheme();
44
- const [orderingTheme] = useOrderingTheme()
45
- const hideAddButton = orderingTheme?.theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden
43
+ const hideAddButton = theme?.business_view?.components?.products?.components?.add_to_cart_button?.hidden ?? true
46
44
 
47
45
  const fadeAnim = useRef(new Animated.Value(0)).current;
48
46
 
@@ -52,6 +50,7 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
52
50
  borderRadius: 7.6,
53
51
  borderColor: theme.colors.border,
54
52
  marginBottom: 28,
53
+ minHeight: 165
55
54
  },
56
55
  titleWrapper: {
57
56
  flexDirection: 'row',