ordering-ui-react-native 0.16.47 → 0.16.50

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.47",
3
+ "version": "0.16.50",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -56,22 +56,14 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
56
56
  }
57
57
  source={{ uri: header || optimizeImage(businessState?.business?.header, 'h_400,c_limit') }}
58
58
  >
59
- <BusinessLogo>
60
- {loading ? (
61
- <View style={{ marginLeft: 20 }}>
62
- <Placeholder Animation={Fade}>
63
- <PlaceholderLine height={50} width={20} />
64
- </Placeholder>
65
- </View>
66
- ) : (
67
- !isBusinessInfoShow && (
68
- <OIcon
69
- url={logo || optimizeImage(businessState?.business?.logo, 'h_300,c_limit')}
70
- style={styles.businessLogo}
71
- />
72
- )
73
- )}
74
- </BusinessLogo>
59
+ {!isBusinessInfoShow && (
60
+ <BusinessLogo>
61
+ <OIcon
62
+ url={logo || optimizeImage(businessState?.business?.logo, 'h_300,c_limit')}
63
+ style={styles.businessLogo}
64
+ />
65
+ </BusinessLogo>
66
+ )}
75
67
  </BusinessHeader>
76
68
  <BusinessInfo
77
69
  style={styles.businessInfo}
@@ -117,7 +109,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
117
109
  <PlaceholderLine width={10} />
118
110
  </Placeholder>
119
111
  ) : (
120
- <View style={{width: '75%'}}>
112
+ <View style={{ width: '75%' }}>
121
113
  <OText color={theme.colors.textSecondary}>{getBusinessType()}</OText>
122
114
  </View>
123
115
  )}
@@ -187,7 +179,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
187
179
  titleSectionStyle={styles.modalTitleSectionStyle}
188
180
  open={openBusinessInformation}
189
181
  onClose={() => setOpenBusinessInformation(false)}
190
- styleCloseButton={{color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)'}}
182
+ styleCloseButton={{ color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)' }}
191
183
  isNotDecoration
192
184
  >
193
185
  <BusinessInformation
@@ -199,7 +191,7 @@ export const BusinessBasicInformation = (props: BusinessBasicInformationParams)
199
191
  titleSectionStyle={styles.modalTitleSectionStyle}
200
192
  open={openBusinessReviews}
201
193
  onClose={() => setOpenBusinessReviews(false)}
202
- styleCloseButton={{color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)'}}
194
+ styleCloseButton={{ color: theme.colors.white, backgroundColor: 'rgba(0,0,0,0.3)' }}
203
195
  isNotDecoration
204
196
  >
205
197
  <BusinessReviews
@@ -218,7 +218,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
218
218
  <RatingBarContainer>
219
219
  <LinearGradient
220
220
  start={{ x: 0.0, y: 0.0 }}
221
- end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0, y: 0 }}
221
+ end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0.0001, y: 0 }}
222
222
  locations={[.9999, .9999]}
223
223
  colors={[theme.colors.primary, theme.colors.lightGray]}
224
224
  style={styles.statusBar}
@@ -106,7 +106,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
106
106
  }
107
107
 
108
108
  const qualificationList = [
109
- { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0.0001, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
109
+ { key: 1, text: t('TERRIBLE', 'Terrible'), percent: 0, parentStyle: { left: '0%' }, isInnerStyle: false, pointerColor: false },
110
110
  { key: 2, text: t('BAD', 'Bad'), percent: 0.25, parentStyle: { left: '25%' }, isInnerStyle: true, pointerColor: true },
111
111
  { key: 3, text: t('OKAY', 'Okay'), percent: 0.5, parentStyle: { left: '50%' }, isInnerStyle: true, pointerColor: true },
112
112
  { key: 4, text: t('GOOD', 'Good'), percent: 0.75, parentStyle: { left: '75%' }, isInnerStyle: true, pointerColor: true },
@@ -238,7 +238,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
238
238
  <RatingBarContainer>
239
239
  <LinearGradient
240
240
  start={{ x: 0.0, y: 0.0 }}
241
- end={{ x: qualificationList[stars.quality - 1]?.percent || 0.0, y: 0.0 }}
241
+ end={{ x: qualificationList[stars.quality - 1]?.percent || 0.0001, y: 0.0 }}
242
242
  locations={[.9999, .9999]}
243
243
  colors={[theme.colors.primary, theme.colors.lightGray]}
244
244
  style={styles.statusBar}
@@ -104,8 +104,8 @@ export const PreviousOrders = (props: any) => {
104
104
  const offset = 300
105
105
  const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
106
106
  const _delivery = order?.delivery_datetime_utc
107
- ? parseDate(order?.delivery_datetime_utc)
108
- : parseDate(cdtToutc)
107
+ ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
108
+ : parseDate(cdtToutc, { outputFormat: 'YYYY-MM-DD hh:mm A' })
109
109
  const _eta = order?.eta_time
110
110
  const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
111
111
  return Math.ceil(diffTimeAsSeconds / 60)
@@ -178,9 +178,9 @@ export const PreviousOrders = (props: any) => {
178
178
  activeOpacity={1}
179
179
  >
180
180
  <Card key={order.id}>
181
- {allowColumns?.slaBar && (
182
- <Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
183
- )}
181
+ {allowColumns?.slaBar && (
182
+ <Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
183
+ )}
184
184
  {
185
185
  !!order.business?.logo && (
186
186
  <Logo style={styles.logo}>
@@ -1,13 +1,16 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import {
3
3
  BusinessController as BusinessSingleCard,
4
4
  useUtils,
5
5
  useOrder,
6
6
  useLanguage,
7
- useConfig
7
+ useConfig,
8
+ useToast,
9
+ ToastType
8
10
  } from 'ordering-components/native';
9
11
  import { OIcon, OText } from '../shared';
10
12
  import { StyleSheet, TouchableOpacity, View } from 'react-native';
13
+ import { InView } from 'react-native-intersection-observer'
11
14
  import { BusinessControllerParams } from '../../types';
12
15
  import { convertHoursToMinutes, shape } from '../../utils';
13
16
  import {
@@ -43,13 +46,16 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
43
46
  businessDeliveryTime,
44
47
  businessPickupTime,
45
48
  businessDistance,
46
- handleFavoriteBusiness
49
+ handleFavoriteBusiness,
50
+ enableIntersection
47
51
  } = props;
48
52
  const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
53
+ const [, { showToast }] = useToast()
49
54
  const [orderState] = useOrder();
50
55
  const [configState] = useConfig();
51
56
  const [, t] = useLanguage();
52
57
  const theme = useTheme()
58
+ const [isIntersectionObserver, setIsIntersectionObserver] = useState(!enableIntersection)
53
59
  const styles = StyleSheet.create({
54
60
  headerStyle: {
55
61
  borderTopLeftRadius: 7.6,
@@ -119,130 +125,140 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
119
125
  const handleBusinessClick = (selectedBusiness: any) => {
120
126
  if (business?.open) handleClick && handleClick(selectedBusiness)
121
127
  else {
122
- navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
128
+ if (configState?.configs?.preorder_status_enabled?.value === '1') {
129
+ navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
130
+ return
131
+ }
132
+ showToast(ToastType.Info, t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment'));
123
133
  }
124
134
  }
125
135
 
126
- const handleChangeFavorite = () => {
127
- handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
128
- }
136
+ const handleChangeFavorite = () => {
137
+ handleFavoriteBusiness && handleFavoriteBusiness(!business?.favorite)
138
+ }
129
139
 
130
140
  return (
131
- <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
132
- {business?.ribbon?.enabled && (
133
- <RibbonBox
134
- bgColor={business?.ribbon?.color}
135
- isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
136
- isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
137
- >
138
- <OText
139
- size={10}
140
- weight={'400'}
141
- color={theme.colors.white}
142
- numberOfLines={2}
143
- ellipsizeMode='tail'
144
- lineHeight={13}
141
+ <InView triggerOnce={true} onChange={(inView: boolean) => setIsIntersectionObserver(inView)}>
142
+ <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
143
+ {business?.ribbon?.enabled && (
144
+ <RibbonBox
145
+ bgColor={business?.ribbon?.color}
146
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
147
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
145
148
  >
146
- {business?.ribbon?.text}
147
- </OText>
148
- </RibbonBox>
149
- )}
150
- <BusinessHero>
151
- <FastImage
152
- style={{ height: 120 }}
153
- source={{
154
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
155
- priority: FastImage.priority.normal,
156
- }}
157
- resizeMode={FastImage.resizeMode.cover}
158
- />
159
- {(businessFeatured ?? business?.featured) && (
160
- <View style={styles.featured}>
161
- <FontAwesomeIcon name="crown" size={26} color="gold" />
162
- </View>
149
+ <OText
150
+ size={10}
151
+ weight={'400'}
152
+ color={theme.colors.white}
153
+ numberOfLines={2}
154
+ ellipsizeMode='tail'
155
+ lineHeight={13}
156
+ >
157
+ {business?.ribbon?.text}
158
+ </OText>
159
+ </RibbonBox>
163
160
  )}
164
- <BusinessState>
165
- {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
166
- <View style={styles.businessStateView}>
167
- <OText
168
- color={theme.colors.textThird}
169
- size={10}
170
- style={styles.businessStateText}>
171
- {t('PREORDER', 'PREORDER')}
172
- </OText>
173
- </View>
174
- )}
175
- </BusinessState>
176
- </BusinessHero>
177
- <BusinessContent>
178
- <BusinessInfo>
179
- <BusinessLogo style={styles.businessLogo}>
161
+ {isIntersectionObserver && (
162
+ <BusinessHero>
180
163
  <FastImage
181
- style={{ width: 56, height: 56 }}
164
+ style={{ height: 120 }}
182
165
  source={{
183
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
166
+ uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
184
167
  priority: FastImage.priority.normal,
185
168
  }}
186
169
  resizeMode={FastImage.resizeMode.cover}
187
170
  />
188
- </BusinessLogo>
189
- <ReviewAndFavorite>
190
- {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
191
- <Reviews>
192
- <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
193
- <OText size={10} style={{ lineHeight: 15 }}>
194
- {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
195
- </OText>
196
- </Reviews>
171
+ {(businessFeatured ?? business?.featured) && (
172
+ <View style={styles.featured}>
173
+ <FontAwesomeIcon name="crown" size={26} color="gold" />
174
+ </View>
197
175
  )}
198
- <TouchableOpacity
199
- onPress={handleChangeFavorite}
200
- >
201
- <IconAntDesign
202
- name={business?.favorite ? 'heart' : 'hearto'}
203
- color={theme.colors.danger5}
204
- size={18}
205
- />
206
- </TouchableOpacity>
207
- </ReviewAndFavorite>
208
- </BusinessInfo>
209
- <OText
210
- size={12}
211
- style={{ lineHeight: 18, marginBottom: 6 }}
212
- weight={'500'}>
213
- {business?.name}
214
- </OText>
215
- <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
216
- {business?.address}
217
- </OText>
218
- {/* <BusinessCategory>
176
+ <BusinessState>
177
+ {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
178
+ <View style={styles.businessStateView}>
179
+ <OText
180
+ color={theme.colors.textThird}
181
+ size={10}
182
+ style={styles.businessStateText}>
183
+ {t('PREORDER', 'PREORDER')}
184
+ </OText>
185
+ </View>
186
+ )}
187
+ </BusinessState>
188
+ </BusinessHero>
189
+ )}
190
+ <BusinessContent>
191
+ <BusinessInfo>
192
+ {isIntersectionObserver && (
193
+ <BusinessLogo style={styles.businessLogo}>
194
+ <FastImage
195
+ style={{ width: 56, height: 56 }}
196
+ source={{
197
+ uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
198
+ priority: FastImage.priority.normal,
199
+ }}
200
+ resizeMode={FastImage.resizeMode.cover}
201
+ />
202
+ </BusinessLogo>
203
+ )}
204
+ <ReviewAndFavorite>
205
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
206
+ <Reviews>
207
+ <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
208
+ <OText size={10} style={{ lineHeight: 15 }}>
209
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
210
+ </OText>
211
+ </Reviews>
212
+ )}
213
+ <TouchableOpacity
214
+ onPress={handleChangeFavorite}
215
+ >
216
+ <IconAntDesign
217
+ name={business?.favorite ? 'heart' : 'hearto'}
218
+ color={theme.colors.danger5}
219
+ size={18}
220
+ />
221
+ </TouchableOpacity>
222
+ </ReviewAndFavorite>
223
+ </BusinessInfo>
224
+ <OText
225
+ size={12}
226
+ style={{ lineHeight: 18, marginBottom: 6 }}
227
+ weight={'500'}>
228
+ {business?.name}
229
+ </OText>
230
+ <OText size={10} style={{ lineHeight: 15, marginBottom: 3 }}>
231
+ {business?.address}
232
+ </OText>
233
+ {/* <BusinessCategory>
219
234
  <OText>{getBusinessType()}</OText>
220
235
  </BusinessCategory> */}
221
- <Metadata>
222
- {!isBusinessOpen ? (
223
- <View style={styles.closed}>
224
- <OText size={10} color={theme.colors.red}>
225
- {t('CLOSED', 'Closed')}
226
- </OText>
227
- </View>
228
- ) : (
229
- <View style={styles.bullet}>
230
- {orderState?.options?.type === 1 && (
231
- <OText size={10} color={theme.colors.textSecondary}>
232
- {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
236
+ <Metadata>
237
+ {!isBusinessOpen ? (
238
+ <View style={styles.closed}>
239
+ <OText size={10} color={theme.colors.red}>
240
+ {t('CLOSED', 'Closed')}
233
241
  </OText>
234
- )}
235
- <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
236
- orderState?.options?.type === 1
237
- ? (businessDeliveryTime ?? business?.delivery_time)
238
- : (businessPickupTime ?? business?.pickup_time),
239
- )} \u2022 `}</OText>
240
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
241
- </View>
242
- )}
243
- </Metadata>
244
- </BusinessContent>
245
- </Card>
242
+ </View>
243
+ ) : (
244
+ <View style={styles.bullet}>
245
+ {orderState?.options?.type === 1 && (
246
+ <OText size={10} color={theme.colors.textSecondary}>
247
+ {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
248
+ </OText>
249
+ )}
250
+ <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
251
+ orderState?.options?.type === 1
252
+ ? (businessDeliveryTime ?? business?.delivery_time)
253
+ : (businessPickupTime ?? business?.pickup_time),
254
+ )} \u2022 `}</OText>
255
+ <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
256
+ </View>
257
+ )}
258
+ </Metadata>
259
+ </BusinessContent>
260
+ </Card>
261
+ </InView>
246
262
  );
247
263
  };
248
264
 
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils } from 'ordering-components/native'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
3
  import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
@@ -183,6 +183,30 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
183
183
  setOpenFilters(false)
184
184
  }
185
185
 
186
+ const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
187
+
188
+ const onProductClick = (business: any, categoryId: any, productId: any) => {
189
+ if (!isInteger(business?.id) ||
190
+ !isInteger(categoryId) ||
191
+ !isInteger(productId) ||
192
+ !business.slug || !business.header || !business.logo) {
193
+ showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
194
+ return
195
+ }
196
+
197
+ navigation.navigate('ProductDetails', {
198
+ isRedirect: 'business',
199
+ businessId: business?.id,
200
+ categoryId: categoryId,
201
+ productId: productId,
202
+ business: {
203
+ store: business.slug,
204
+ header: business.header,
205
+ logo: business.logo,
206
+ }
207
+ })
208
+ }
209
+
186
210
  useEffect(() => {
187
211
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
188
212
  handleSearchbusinessAndProducts(true)
@@ -409,7 +433,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
409
433
  isSoldOut={(product.inventoried && !product.quantity)}
410
434
  product={product}
411
435
  businessId={business?.id}
412
- onProductClick={() => { }}
436
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
413
437
  productAddedToCartLength={0}
414
438
  handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
415
439
  style={{ width: screenWidth - 80, marginRight: i === category?.products?.length - 1 ? 0 : 20 }}
@@ -239,6 +239,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
239
239
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
240
240
  <SingleProductCard
241
241
  key={`${product?.id}_${i}`}
242
+ enableIntersection
242
243
  isSoldOut={product.inventoried && !product.quantity}
243
244
  businessId={businessId}
244
245
  product={product}
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react'
2
2
  import { View, TouchableOpacity, StyleSheet, SafeAreaView, Dimensions, Platform, KeyboardAvoidingViewBase, KeyboardAvoidingView } from 'react-native'
3
+ import { IOScrollView } from 'react-native-intersection-observer'
3
4
  import { useTheme } from 'styled-components/native';
4
5
  import {
5
6
  BusinessAndProductList,
@@ -365,7 +366,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
365
366
  </>
366
367
  )}
367
368
  {!loading && business?.id && (
368
- <>
369
+ <IOScrollView rootMargin={{ top: 0, bottom: 0 }}>
369
370
  <WrapContent
370
371
  onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
371
372
  >
@@ -396,7 +397,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
396
397
  handleUpdateProducts={handleUpdateProducts}
397
398
  />
398
399
  </WrapContent>
399
- </>
400
+ </IOScrollView>
400
401
  )}
401
402
  {loading && !error && (
402
403
  <>
@@ -421,6 +422,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
421
422
  </>
422
423
  )}
423
424
  </BusinessProductsListingContainer>
425
+
424
426
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
425
427
  <FloatingButton
426
428
  btnText={
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
3
+ import { IOScrollView } from 'react-native-intersection-observer'
3
4
  import Geolocation from '@react-native-community/geolocation'
4
5
  import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
5
6
  import {
@@ -32,7 +33,7 @@ import {
32
33
  FeaturedWrapper,
33
34
  OrderProgressWrapper,
34
35
  FarAwayMessage,
35
- SearchBarWrapper,
36
+ SearchBarWrapper,
36
37
  MomentWrapper,
37
38
  FilterWrapper,
38
39
  ServiceWrapper,
@@ -70,8 +71,8 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
70
71
  isGuestUser,
71
72
  handleUpdateBusinessList,
72
73
  priceLevelSelected,
73
- handleChangePriceLevel,
74
- businessTypeSelected
74
+ handleChangePriceLevel,
75
+ businessTypeSelected
75
76
  } = props;
76
77
  const theme = useTheme();
77
78
  const isFocused = useIsFocused();
@@ -327,22 +328,23 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
327
328
  />
328
329
  </WrapMomentOption>
329
330
  {!businessId && (
330
- <SearchBarWrapper>
331
- <SearchBar
332
- onSearch={handleChangeSearch}
333
- searchValue={searchValue}
334
- lazyLoad
335
- isCancelXButtonShow={!!searchValue}
336
- borderStyle={styles.borderStyle}
337
- onCancel={() => handleChangeSearch('')}
338
- placeholder={t('SEARCH', 'Search')}
339
- height={80}
340
- isAppointment
341
- isDisabled={!businessTypes}
342
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
343
- onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
344
- />
345
- </SearchBarWrapper>
331
+ <SearchBarWrapper>
332
+ <SearchBar
333
+ onSearch={handleChangeSearch}
334
+ searchValue={searchValue}
335
+ lazyLoad
336
+ isCancelXButtonShow={!!searchValue}
337
+ borderStyle={styles.borderStyle}
338
+ onCancel={() => handleChangeSearch('')}
339
+ placeholder={t('SEARCH', 'Search')}
340
+ height={80}
341
+ isAppointment
342
+ isDisabled={!businessTypes || configs?.advanced_business_search_enabled?.value === '1'}
343
+ inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
344
+ onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
345
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
346
+ />
347
+ </SearchBarWrapper>
346
348
  )}
347
349
  </View>
348
350
  </OrderControlContainer>
@@ -459,29 +461,32 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
459
461
  )}
460
462
  />
461
463
  )}
462
- {businessesList.businesses?.map(
463
- (business: any, i: number) => (
464
- <BusinessController
465
- key={`${business.id}_` + i}
466
- business={business}
467
- isBusinessOpen={business.open}
468
- handleCustomClick={handleBusinessClick}
469
- orderType={orderState?.options?.type}
470
- navigation={navigation}
471
- businessHeader={business?.header}
472
- businessFeatured={business?.featured}
473
- businessLogo={business?.logo}
474
- businessReviews={business?.reviews}
475
- businessDeliveryPrice={business?.delivery_price}
476
- businessDeliveryTime={business?.delivery_time}
477
- businessPickupTime={business?.pickup_time}
478
- businessDistance={business?.distance}
479
- handleUpdateBusinessList={handleUpdateBusinessList}
480
- favoriteIds={favoriteIds}
481
- setFavoriteIds={setFavoriteIds}
482
- />
483
- )
484
- )}
464
+ <IOScrollView>
465
+ {businessesList.businesses?.map(
466
+ (business: any, i: number) => (
467
+ <BusinessController
468
+ key={`${business.id}_` + i}
469
+ enableIntersection
470
+ business={business}
471
+ isBusinessOpen={business.open}
472
+ handleCustomClick={handleBusinessClick}
473
+ orderType={orderState?.options?.type}
474
+ navigation={navigation}
475
+ businessHeader={business?.header}
476
+ businessFeatured={business?.featured}
477
+ businessLogo={business?.logo}
478
+ businessReviews={business?.reviews}
479
+ businessDeliveryPrice={business?.delivery_price}
480
+ businessDeliveryTime={business?.delivery_time}
481
+ businessPickupTime={business?.pickup_time}
482
+ businessDistance={business?.distance}
483
+ handleUpdateBusinessList={handleUpdateBusinessList}
484
+ favoriteIds={favoriteIds}
485
+ setFavoriteIds={setFavoriteIds}
486
+ />
487
+ )
488
+ )}
489
+ </IOScrollView>
485
490
  {businessesList.loading && (
486
491
  <>
487
492
  {[