ordering-ui-react-native 0.17.75 → 0.17.76-release

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.
Files changed (225) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +28 -25
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +149 -118
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +128 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +102 -40
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +61 -60
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +20 -22
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +88 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +139 -174
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  43. package/themes/business/src/components/StoresList/index.tsx +3 -4
  44. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  45. package/themes/business/src/components/shared/OLink.tsx +9 -2
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/components/shared/OText.tsx +6 -1
  48. package/themes/business/src/types/index.tsx +25 -10
  49. package/themes/business/src/utils/index.tsx +29 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  55. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  56. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  57. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  58. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  59. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/original/index.tsx +1 -1
  62. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  63. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  64. package/themes/original/src/components/AddressList/index.tsx +11 -6
  65. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  66. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  67. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  68. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  69. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  70. package/themes/original/src/components/BusinessController/index.tsx +81 -68
  71. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  72. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  73. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  74. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  75. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  76. package/themes/original/src/components/BusinessListingSearch/index.tsx +348 -340
  77. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  78. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  79. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  80. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  81. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  82. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  83. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -559
  84. package/themes/original/src/components/BusinessProductsListing/styles.tsx +1 -1
  85. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +69 -38
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  88. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  89. package/themes/original/src/components/Cart/index.tsx +76 -79
  90. package/themes/original/src/components/CartContent/index.tsx +112 -19
  91. package/themes/original/src/components/CartContent/styles.tsx +16 -6
  92. package/themes/original/src/components/Checkout/index.tsx +281 -55
  93. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  94. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  95. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  96. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  97. package/themes/original/src/components/Favorite/index.tsx +2 -6
  98. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  99. package/themes/original/src/components/FloatingButton/index.tsx +10 -13
  100. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +7 -3
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +19 -6
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  106. package/themes/original/src/components/Help/index.tsx +2 -2
  107. package/themes/original/src/components/HelpGuide/index.tsx +2 -2
  108. package/themes/original/src/components/HelpGuide/styles.tsx +1 -0
  109. package/themes/original/src/components/Home/index.tsx +13 -4
  110. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  111. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  112. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  113. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  114. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  115. package/themes/original/src/components/Messages/index.tsx +14 -7
  116. package/themes/original/src/components/MomentOption/index.tsx +193 -90
  117. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  118. package/themes/original/src/components/MultiCart/index.tsx +41 -54
  119. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  120. package/themes/original/src/components/MultiCheckout/index.tsx +329 -100
  121. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  122. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  123. package/themes/original/src/components/MultiOrdersDetails/index.tsx +54 -21
  124. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  125. package/themes/original/src/components/MyOrders/index.tsx +37 -24
  126. package/themes/original/src/components/NavBar/index.tsx +20 -12
  127. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  128. package/themes/original/src/components/Notifications/styles.tsx +1 -5
  129. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  130. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  131. package/themes/original/src/components/OrderDetails/index.tsx +28 -233
  132. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  133. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  134. package/themes/original/src/components/OrderProgress/index.tsx +30 -56
  135. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  136. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  137. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  138. package/themes/original/src/components/OrdersOption/index.tsx +67 -85
  139. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  140. package/themes/original/src/components/PageBanner/index.tsx +98 -38
  141. package/themes/original/src/components/PageBanner/styles.tsx +0 -10
  142. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  143. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  144. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  145. package/themes/original/src/components/PaymentOptions/index.tsx +77 -34
  146. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  147. package/themes/original/src/components/ProductForm/index.tsx +101 -34
  148. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  149. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  150. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  151. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  152. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  153. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  154. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  155. package/themes/original/src/components/Promotions/index.tsx +2 -2
  156. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  157. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  158. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  159. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  160. package/themes/original/src/components/Sessions/index.tsx +11 -8
  161. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  162. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +102 -63
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  165. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  167. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  168. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  172. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  173. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  174. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  175. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  176. package/themes/original/src/components/UserProfile/index.tsx +87 -76
  177. package/themes/original/src/components/UserProfileForm/index.tsx +10 -3
  178. package/themes/original/src/components/UserProfileForm/styles.tsx +1 -1
  179. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  180. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  181. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  182. package/themes/original/src/components/Wallets/index.tsx +56 -33
  183. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  184. package/themes/original/src/components/shared/OButton.tsx +6 -2
  185. package/themes/original/src/components/shared/OInput.tsx +6 -1
  186. package/themes/original/src/components/shared/OModal.tsx +3 -3
  187. package/themes/original/src/types/index.tsx +39 -10
  188. package/themes/original/src/utils/index.tsx +273 -1
  189. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  190. package/src/navigators/BottomNavigator.tsx +0 -117
  191. package/src/navigators/CheckoutNavigator.tsx +0 -66
  192. package/src/navigators/HomeNavigator.tsx +0 -202
  193. package/src/navigators/NavigationRef.tsx +0 -7
  194. package/src/navigators/RootNavigator.tsx +0 -269
  195. package/src/pages/Account.tsx +0 -34
  196. package/src/pages/AddressForm.tsx +0 -62
  197. package/src/pages/AddressList.tsx +0 -24
  198. package/src/pages/BusinessProductsList.tsx +0 -81
  199. package/src/pages/BusinessesListing.tsx +0 -43
  200. package/src/pages/CartList.tsx +0 -49
  201. package/src/pages/Checkout.tsx +0 -101
  202. package/src/pages/ForgotPassword.tsx +0 -24
  203. package/src/pages/Help.tsx +0 -23
  204. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  205. package/src/pages/HelpGuide.tsx +0 -23
  206. package/src/pages/HelpOrder.tsx +0 -23
  207. package/src/pages/Home.tsx +0 -36
  208. package/src/pages/IntroductoryTutorial.tsx +0 -170
  209. package/src/pages/Login.tsx +0 -47
  210. package/src/pages/MomentOption.tsx +0 -30
  211. package/src/pages/MultiCheckout.tsx +0 -31
  212. package/src/pages/MultiOrdersDetails.tsx +0 -27
  213. package/src/pages/MyOrders.tsx +0 -40
  214. package/src/pages/NetworkError.tsx +0 -24
  215. package/src/pages/NotFound.tsx +0 -22
  216. package/src/pages/OrderDetails.tsx +0 -25
  217. package/src/pages/ProductDetails.tsx +0 -55
  218. package/src/pages/Profile.tsx +0 -36
  219. package/src/pages/ReviewDriver.tsx +0 -30
  220. package/src/pages/ReviewOrder.tsx +0 -32
  221. package/src/pages/ReviewProducts.tsx +0 -30
  222. package/src/pages/Sessions.tsx +0 -22
  223. package/src/pages/Signup.tsx +0 -53
  224. package/src/pages/SpinnerLoader.tsx +0 -10
  225. package/src/pages/Splash.tsx +0 -21
@@ -1,30 +1,26 @@
1
1
  import React, { useEffect, useState } from 'react'
2
- import { useLanguage, BusinessSearchList, useOrder, useUtils, showToast, ToastType } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, Platform, View, Dimensions } from 'react-native'
2
+ import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
- import { OButton, OModal, OText } from '../shared'
6
+ import { HeaderTitle, OButton, OModal, OText } from '../shared'
7
7
  import { SearchBar } from '../SearchBar';
8
- import { BusinessController } from '../BusinessController'
9
8
  import { NotFoundSource } from '../NotFoundSource'
10
9
  import { SingleProductCard } from '../SingleProductCard'
11
10
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
12
11
  import {
13
12
  SearchWrapper,
14
- WrapHeader,
15
13
  ProductsList,
16
14
  SingleBusinessSearch,
17
15
  BusinessInfo,
18
16
  BusinessInfoItem,
19
17
  Metadata,
20
18
  SingleBusinessContainer,
21
- LoadMoreBusinessContainer,
22
19
  TagsContainer,
23
20
  SortContainer,
24
21
  BrandContainer,
25
22
  BrandItem,
26
23
  PriceFilterWrapper,
27
- OptionTitle,
28
24
  BContainer,
29
25
  WrapperButtons
30
26
  } from './styles'
@@ -32,10 +28,12 @@ import FastImage from 'react-native-fast-image'
32
28
  import { convertHoursToMinutes } from '../../utils'
33
29
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
34
30
  import { BusinessSearchParams } from '../../types'
35
- import { MyOrders } from '../MyOrders'
36
31
  import { useIsFocused } from '@react-navigation/native';
37
32
  import { MaxSectionItem } from './MaxSectionItem'
38
- import { BusinessControllerSkeletons } from './BusinessControllerSkeletons'
33
+ import { IOScrollView } from 'react-native-intersection-observer'
34
+
35
+ const PIXELS_TO_SCROLL = 1000
36
+
39
37
  export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
40
38
  const {
41
39
  navigation,
@@ -43,23 +41,21 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
43
41
  onBusinessClick,
44
42
  handleChangeTermValue,
45
43
  termValue,
46
- paginationProps,
47
44
  handleSearchbusinessAndProducts,
48
45
  handleChangeFilters,
49
46
  filters,
50
47
  businessTypes,
51
48
  setFilters,
52
49
  brandList,
53
- onNavigationRedirect,
54
- handleUpdateBusinessList,
55
- handleUpdateProducts,
56
- brandId
50
+ paginationProps,
51
+ handleUpdateProducts
57
52
  } = props
58
53
 
59
54
  const screenHeight = Dimensions.get('window').height;
60
55
  const screenWidth = Dimensions.get('window').width;
61
56
  const theme = useTheme()
62
57
  const [orderState] = useOrder()
58
+ const [events] = useEvent()
63
59
  const { top } = useSafeAreaInsets();
64
60
  const [, t] = useLanguage()
65
61
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
@@ -76,7 +72,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
76
72
  { text: t('PICKUP_TIME', 'Pickup time'), value: 'pickup_time' }
77
73
  ]
78
74
 
79
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
75
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
76
+ const hideBrowse = theme?.bar_menu?.components?.browse?.hidden
80
77
 
81
78
  const priceList = [
82
79
  { level: '1', content: '$' },
@@ -100,6 +97,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
100
97
  },
101
98
  searchInput: {
102
99
  fontSize: 12,
100
+ height: 44
103
101
  },
104
102
  productsContainer: {
105
103
  marginTop: 20
@@ -191,7 +189,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
191
189
 
192
190
  const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
193
191
 
194
- const onProductClick = (business: any, categoryId: any, productId: any) => {
192
+
193
+ const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
195
194
  if (!isInteger(business?.id) ||
196
195
  !isInteger(categoryId) ||
197
196
  !isInteger(productId) ||
@@ -199,20 +198,42 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
199
198
  showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
200
199
  return
201
200
  }
202
-
201
+ const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
202
+ const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
203
203
  navigation.navigate('ProductDetails', {
204
204
  isRedirect: 'business',
205
205
  businessId: business?.id,
206
206
  categoryId: categoryId,
207
207
  productId: productId,
208
+ product: product,
208
209
  business: {
209
210
  store: business.slug,
210
211
  header: business.header,
211
212
  logo: business.logo,
212
- }
213
+ },
214
+ productAddedToCartLength
213
215
  })
214
216
  }
215
217
 
218
+ const handleScroll = ({ nativeEvent }: any) => {
219
+ const y = nativeEvent.contentOffset.y;
220
+ const height = nativeEvent.contentSize.height;
221
+ const hasMore = !(
222
+ paginationProps.totalPages === paginationProps.currentPage
223
+ );
224
+
225
+ if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
226
+ handleSearchbusinessAndProducts();
227
+ }
228
+ };
229
+
230
+ const onChangeTermValue = (query: any) => {
231
+ handleChangeTermValue(query)
232
+ if (query) {
233
+ events.emit('products_searched', query)
234
+ }
235
+ }
236
+
216
237
  useEffect(() => {
217
238
  if (filters.business_types?.length === 0 && filters.orderBy === 'default' && Object.keys(filters)?.length === 2 && !openFilters) {
218
239
  handleSearchbusinessAndProducts(true)
@@ -229,347 +250,334 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
229
250
  }, [isFocused])
230
251
 
231
252
  return (
232
- <BContainer
233
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
253
+ <IOScrollView
254
+ onScroll={(e: any) => handleScroll(e)}
255
+ showsVerticalScrollIndicator={false}
234
256
  >
235
- <SearchWrapper>
236
- <SearchBar
237
- lazyLoad
238
- {...(isChewLayout && { height: 55 })}
239
- inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
240
- placeholder={`${t('SEARCH_BUSINESSES', 'Search Businesses')} / ${t('TYPE_AT_LEAST_3_CHARACTERS', 'type at least 3 characters')}`}
241
- onSearch={(val: string) => handleChangeTermValue(val)}
242
- value={termValue}
243
- iconCustomRight={<AntDesignIcon name='filter' size={16} style={{ bottom: 2 }} onPress={() => handleOpenfilters()} />}
244
- />
245
- </SearchWrapper>
246
- {
247
- noResults && (
248
- <View>
249
- <NotFoundSource
250
- content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
251
- />
252
- </View>
253
- )
254
- }
255
- {businessesSearchList.businesses?.length > 0 && termValue?.length === 0 && (
256
- <MyOrders
257
- hideOrders
258
- businessesSearchList={businessesSearchList}
259
- onNavigationRedirect={onNavigationRedirect}
260
- BusinessControllerSkeletons={BusinessControllerSkeletons}
261
- businessPaginationProps={paginationProps}
262
- franchiseId={brandId}
263
- hideBackBtn
264
- titleStyle={{
265
- paddingHorizontal: 0,
266
- marginTop: 0,
267
- marginLeft: 0
268
- }}
269
- />
270
- )}
271
-
272
- <OptionTitle isBusinessesSearchList={!!businessesSearchList}>
273
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10}>
274
- {t('BUSINESSES', 'Businesses')}
275
- </OText>
276
- </OptionTitle>
277
- <ScrollView horizontal showsHorizontalScrollIndicator={false}>
278
- {businessesSearchList.businesses?.length > 0 && businessesSearchList.businesses.map((business: any, i: number) => (
279
- <View
280
- key={business.id}
257
+ <View style={{
258
+ width: '100%',
259
+ display: 'flex',
260
+ flexDirection: 'row',
261
+ alignItems: 'center',
262
+ paddingHorizontal: hideBrowse && !isChewLayout ? 40 : 20,
263
+ }}>
264
+ {hideBrowse && !isChewLayout && (
265
+ <OButton
266
+ imgLeftStyle={{ width: 18 }}
267
+ imgRightSrc={null}
281
268
  style={{
282
- width: screenWidth - 120,
283
- marginRight: (businessesSearchList.loading || i !== businessesSearchList.businesses?.length - 1) ? 20 : 0
269
+ borderWidth: 0,
270
+ width: 26,
271
+ height: 26,
272
+ backgroundColor: '#FFF',
273
+ borderColor: '#FFF',
274
+ shadowColor: '#FFF',
275
+ paddingLeft: 0,
276
+ paddingRight: 0,
277
+ marginTop: 50,
284
278
  }}
285
- >
286
- <BusinessController
287
- business={business}
288
- isBusinessOpen={business.open}
289
- enableIntersection={false}
290
- handleCustomClick={() => onBusinessClick(business)}
291
- handleUpdateBusinessList={handleUpdateBusinessList}
292
- orderType={orderState?.options?.type}
293
- />
294
- </View>
295
- ))}
296
- {console.log(screenWidth)}
297
- {!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
298
- <LoadMoreBusinessContainer>
299
- <OButton
300
- bgColor='transparent'
301
- borderColor={theme.colors.primary}
302
- onClick={() => handleSearchbusinessAndProducts()}
303
- text={t('LOAD_MORE_BUSINESS', 'Load more business')}
304
- textStyle={{ color: theme.colors.primary }}
305
- />
306
- </LoadMoreBusinessContainer>
307
- )}
308
- {businessesSearchList.loading && (
309
- <BusinessControllerSkeletons paginationProps={paginationProps} />
279
+ onClick={() => props.navigation.goBack()}
280
+ icon={AntDesignIcon}
281
+ iconProps={{
282
+ name: 'arrowleft',
283
+ size: 26
284
+ }}
285
+ />
310
286
  )}
311
- </ScrollView>
312
- <ProductsList>
313
- {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
314
- <SingleBusinessSearch key={`card-${business?.id}`}>
315
- <SingleBusinessContainer>
316
- <BusinessInfo>
317
- {(business?.logo || theme.images?.dummies?.businessLogo) && (
318
- <FastImage
319
- style={{ height: 48, width: 48 }}
320
- source={{
321
- uri: optimizeImage(business?.logo, 'h_120,c_limit'),
322
- priority: FastImage.priority.normal,
323
- }}
324
- resizeMode={FastImage.resizeMode.cover}
325
- />
326
- )}
327
- </BusinessInfo>
328
- <BusinessInfoItem>
329
- <OText size={12}>{business?.name}</OText>
330
- <Metadata>
331
- {orderState?.options?.type === 1 && (
332
- <>
333
- <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
334
- <OText size={10} mRight={3}>
335
- {business && parsePrice(business?.delivery_price)}
336
- </OText>
337
- </>
338
- )}
339
- <OText size={10} mRight={3}>
340
- {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
341
- </OText>
342
- <OText size={10}>
343
- {parseDistance(business?.distance)}
344
- </OText>
345
- </Metadata>
346
- </BusinessInfoItem>
347
- <OButton
348
- onClick={() => onBusinessClick(business)}
349
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
350
- text={t('GO_TO_STORE', 'Go to store')}
351
- bgColor='#F5F9FF'
352
- borderColor='#fff'
353
- style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
287
+ <HeaderTitle ph={20} text={t('SEARCH', 'Search')} />
288
+ <AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
289
+ </View>
290
+ <BContainer
291
+ style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
292
+ >
293
+ <SearchWrapper>
294
+ <SearchBar
295
+ lazyLoad
296
+ {...(isChewLayout && { height: 55 })}
297
+ inputStyle={{ ...styles.searchInput }}
298
+ placeholder={t('SEARCH_BUSINESSES', 'Search Businesses')}
299
+ onSearch={(val: string) => onChangeTermValue(val)}
300
+ value={termValue}
301
+ />
302
+ </SearchWrapper>
303
+ <OText size={12} lineHeight={20} color={theme.colors.textThird} mLeft={5}>
304
+ {t('TYPE_AT_LEAST_2_CHARACTERS', 'Type at least 2 characters')}
305
+ </OText>
306
+ {
307
+ noResults && (
308
+ <View>
309
+ <NotFoundSource
310
+ content={t('NOT_FOUND_BUSINESSES', 'No businesses to delivery / pick up at this address, please change filters or change address.')}
354
311
  />
355
- </SingleBusinessContainer>
356
- <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
357
- {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
358
- <SingleProductCard
359
- key={product?.id}
360
- isSoldOut={(product.inventoried && !product.quantity)}
361
- product={product}
362
- enableIntersection={false}
363
- businessId={business?.id}
364
- onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
365
- productAddedToCartLength={0}
366
- handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
367
- style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
312
+ </View>
313
+ )
314
+ }
315
+ <ProductsList>
316
+ {businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0).map((business: any) => (
317
+ <SingleBusinessSearch key={`card-${business?.id}`}>
318
+ <SingleBusinessContainer>
319
+ <BusinessInfo>
320
+ {(business?.logo || theme.images?.dummies?.businessLogo) && (
321
+ <FastImage
322
+ style={{ height: 48, width: 48 }}
323
+ source={{
324
+ uri: optimizeImage(business?.logo, 'h_120,c_limit'),
325
+ priority: FastImage.priority.normal,
326
+ }}
327
+ resizeMode={FastImage.resizeMode.cover}
328
+ />
329
+ )}
330
+ </BusinessInfo>
331
+ <BusinessInfoItem>
332
+ <OText size={12}>{business?.name}</OText>
333
+ <Metadata>
334
+ {orderState?.options?.type === 1 && (
335
+ <>
336
+ <OText size={10}>{t('DELIVERY_FEE', 'Delivery fee')}{' '}</OText>
337
+ <OText size={10} mRight={3}>
338
+ {business && parsePrice(business?.delivery_price)}
339
+ </OText>
340
+ </>
341
+ )}
342
+ <OText size={10} mRight={3}>
343
+ {convertHoursToMinutes(orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time)}
344
+ </OText>
345
+ <OText size={10}>
346
+ {parseDistance(business?.distance)}
347
+ </OText>
348
+ </Metadata>
349
+ </BusinessInfoItem>
350
+ <OButton
351
+ onClick={() => onBusinessClick(business)}
352
+ textStyle={{ color: theme.colors.primary, fontSize: 10 }}
353
+ text={t('GO_TO_STORE', 'Go to store')}
354
+ bgColor='#F5F9FF'
355
+ borderColor='#fff'
356
+ style={{ borderRadius: 50, paddingLeft: 5, paddingRight: 5, height: 20 }}
368
357
  />
369
- )))}
358
+ </SingleBusinessContainer>
359
+ <ScrollView horizontal style={styles.productsContainer} contentContainerStyle={{ flexGrow: 1 }}>
360
+ {business?.categories?.map((category: any) => category?.products?.map((product: any, i: number) => (
361
+ <SingleProductCard
362
+ key={product?.id}
363
+ isSoldOut={(product.inventoried && !product.quantity)}
364
+ product={product}
365
+ enableIntersection={false}
366
+ businessId={business?.id}
367
+ onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
368
+ productAddedToCartLength={0}
369
+ handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
370
+ style={{
371
+ width: screenWidth - (category?.products?.length > 1 ? 120 : 80),
372
+ maxWidth: screenWidth - (category?.products?.length > 1 ? 120 : 80),
373
+ marginRight: 20
374
+ }}
375
+ />
376
+ )))}
370
377
 
371
- </ScrollView>
372
- </SingleBusinessSearch>
373
- ))}
374
- {businessesSearchList?.loading && (
375
- <>
376
- {[...Array(3).keys()].map(
377
- (item, i) => (
378
- <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
379
- <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
380
- <View style={{ flexDirection: 'row' }}>
381
- <PlaceholderLine
382
- width={24}
383
- height={70}
384
- style={{ marginRight: 10, marginBottom: 10 }}
385
- />
386
- <Placeholder style={{ paddingVertical: 10 }}>
387
- <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
388
- <PlaceholderLine width={60} />
389
- </Placeholder>
390
- </View>
391
- </Placeholder>
392
- <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
393
- <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
394
- <PlaceholderLine
395
- width={24}
396
- height={70}
397
- style={{ marginRight: 10, marginBottom: 5 }}
398
- />
399
- <Placeholder style={{ paddingVertical: 10 }}>
400
- <PlaceholderLine width={60} height={10} />
401
- <PlaceholderLine width={50} height={10} />
402
- <PlaceholderLine width={70} height={10} />
403
- </Placeholder>
404
- </View>
405
- </Placeholder>
406
- </View>
407
- ),
408
- )}
409
- </>
410
- )}
411
- </ProductsList>
412
- <OModal
413
- open={openFilters}
414
- onCancel={() => handleCloseFilters()}
415
- onClose={() => handleCloseFilters()}
416
- >
417
- <ScrollView style={styles.filterContainer}>
418
- <OText
419
- size={20}
420
- mBottom={15}
421
- style={{ marginTop: 10 }}
422
- >
423
- {t('FILTER', 'Filter')}
424
- </OText>
425
- <SortContainer>
426
- <OText weight='bold' mBottom={7} size={16}>
427
- {t('SORT', 'Sort')}
428
- </OText>
429
- {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
430
- <TouchableOpacity
431
- key={item?.value}
432
- onPress={() => handleChangeFilters('orderBy', item?.value)}
433
- style={{ marginBottom: 7 }}
434
- >
435
- <OText
436
- weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
437
- mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
438
- >
439
- {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
440
- </OText>
441
- </TouchableOpacity>
442
- ))}
443
- </SortContainer>
444
- <BrandContainer>
378
+ </ScrollView>
379
+ </SingleBusinessSearch>
380
+ ))}
381
+ {businessesSearchList?.loading && (
382
+ <>
383
+ {[...Array(3).keys()].map(
384
+ (item, i) => (
385
+ <View key={`skeleton:${i}`} style={{ width: '100%', marginTop: 20 }}>
386
+ <Placeholder key={i} style={{ paddingHorizontal: 5 }} Animation={Fade}>
387
+ <View style={{ flexDirection: 'row' }}>
388
+ <PlaceholderLine
389
+ width={24}
390
+ height={70}
391
+ style={{ marginRight: 10, marginBottom: 10 }}
392
+ />
393
+ <Placeholder style={{ paddingVertical: 10 }}>
394
+ <PlaceholderLine width={20} style={{ marginBottom: 25 }} />
395
+ <PlaceholderLine width={60} />
396
+ </Placeholder>
397
+ </View>
398
+ </Placeholder>
399
+ <Placeholder style={{ paddingHorizontal: 5, bottom: 10 }} Animation={Fade}>
400
+ <View style={{ flexDirection: 'row-reverse', overflow: 'hidden' }}>
401
+ <PlaceholderLine
402
+ width={24}
403
+ height={70}
404
+ style={{ marginRight: 10, marginBottom: 5 }}
405
+ />
406
+ <Placeholder style={{ paddingVertical: 10 }}>
407
+ <PlaceholderLine width={60} height={10} />
408
+ <PlaceholderLine width={50} height={10} />
409
+ <PlaceholderLine width={70} height={10} />
410
+ </Placeholder>
411
+ </View>
412
+ </Placeholder>
413
+ </View>
414
+ ),
415
+ )}
416
+ </>
417
+ )}
418
+ </ProductsList>
419
+ <OModal
420
+ open={openFilters}
421
+ onCancel={() => handleCloseFilters()}
422
+ onClose={() => handleCloseFilters()}
423
+ >
424
+ <ScrollView style={styles.filterContainer}>
445
425
  <OText
446
- size={16}
447
- weight='bold'
448
- lineHeight={24}
449
- style={{ marginBottom: 10 }}
426
+ size={20}
427
+ mBottom={15}
428
+ style={{ marginTop: 10 }}
450
429
  >
451
- {t('BRANDS', 'Brands')}
430
+ {t('FILTER', 'Filter')}
452
431
  </OText>
453
- {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
454
- <ScrollView
455
- style={{ maxHeight: 300, marginBottom: 10 }}
456
- showsVerticalScrollIndicator={true}
457
- nestedScrollEnabled={true}
458
- >
459
- {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
460
- <BrandItem
461
- key={i}
462
- onPress={() => handleChangeBrandFilter(brand?.id)}
432
+ <SortContainer>
433
+ <OText weight='bold' mBottom={7} size={16}>
434
+ {t('SORT', 'Sort')}
435
+ </OText>
436
+ {sortItems?.filter(item => !(orderState?.options?.type === 1 && item?.value === 'pickup_time') && !(orderState?.options?.type === 2 && item?.value === 'delivery_time'))?.map(item => (
437
+ <TouchableOpacity
438
+ key={item?.value}
439
+ onPress={() => handleChangeFilters('orderBy', item?.value)}
440
+ style={{ marginBottom: 7 }}
441
+ >
442
+ <OText
443
+ weight={filters?.orderBy?.includes(item?.value) ? 'bold' : '500'}
444
+ mBottom={filters?.orderBy?.includes(item?.value) ? 5 : 0}
463
445
  >
464
- <OText
465
- size={14}
466
- weight={'400'}
467
- lineHeight={24}
446
+ {item?.text} {(filters?.orderBy?.includes(item?.value)) && <>{filters?.orderBy?.includes('-') ? <AntDesignIcon name='caretup' /> : <AntDesignIcon name='caretdown' />}</>}
447
+ </OText>
448
+ </TouchableOpacity>
449
+ ))}
450
+ </SortContainer>
451
+ <BrandContainer>
452
+ <OText
453
+ size={16}
454
+ weight='bold'
455
+ lineHeight={24}
456
+ style={{ marginBottom: 10 }}
457
+ >
458
+ {t('BRANDS', 'Brands')}
459
+ </OText>
460
+ {!brandList?.loading && !brandList?.error && brandList?.brands?.length > 0 && (
461
+ <ScrollView
462
+ style={{ maxHeight: 300, marginBottom: 10 }}
463
+ showsVerticalScrollIndicator={true}
464
+ nestedScrollEnabled={true}
465
+ >
466
+ {brandList?.brands.map((brand: any, i: number) => brand?.enabled && (
467
+ <BrandItem
468
+ key={i}
469
+ onPress={() => handleChangeBrandFilter(brand?.id)}
468
470
  >
469
- {brand?.name}
470
- </OText>
471
- {filters?.franchise_ids?.includes(brand?.id) && (
472
- <AntDesignIcon
473
- name='check'
474
- color={theme.colors.success500}
475
- size={16}
476
- />
477
- )}
478
- </BrandItem>
471
+ <OText
472
+ size={14}
473
+ weight={'400'}
474
+ lineHeight={24}
475
+ >
476
+ {brand?.name}
477
+ </OText>
478
+ {filters?.franchise_ids?.includes(brand?.id) && (
479
+ <AntDesignIcon
480
+ name='check'
481
+ color={theme.colors.success500}
482
+ size={16}
483
+ />
484
+ )}
485
+ </BrandItem>
486
+ ))}
487
+ </ScrollView>
488
+ )}
489
+ {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
490
+ <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
491
+ )}
492
+ </BrandContainer>
493
+ <PriceFilterWrapper>
494
+ <OText
495
+ size={16}
496
+ weight='bold'
497
+ lineHeight={24}
498
+ style={{ marginBottom: 5 }}
499
+ >
500
+ {t('PRICE_RANGE', 'Price range')}
501
+ </OText>
502
+ <View style={styles.priceContainer}>
503
+ {priceList.map((price: any, i: number) => (
504
+ <OButton
505
+ key={i}
506
+ bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
507
+ onClick={() => handleChangePriceRange(price?.level)}
508
+ text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
509
+ style={styles.priceItem}
510
+ textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
511
+ />
479
512
  ))}
480
- </ScrollView>
513
+ </View>
514
+ </PriceFilterWrapper>
515
+ {orderState?.options?.type === 1 && (
516
+ <MaxSectionItem
517
+ filters={filters}
518
+ title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
519
+ options={maxDeliveryFeeOptions}
520
+ filter='max_delivery_price'
521
+ handleChangeFilters={handleChangeFilters}
522
+ />
481
523
  )}
482
- {!brandList?.loading && ((brandList?.brands?.filter((brand: any) => brand?.enabled))?.length === 0) && (
483
- <OText size={14} weight='400'>{t('NO_RESULTS_FOUND', 'Sorry, no results found')}</OText>
524
+ {[1, 2].includes(orderState?.options?.type) && (
525
+ <MaxSectionItem
526
+ filters={filters}
527
+ title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
528
+ options={maxTimeOptions}
529
+ filter='max_eta'
530
+ handleChangeFilters={handleChangeFilters}
531
+ />
484
532
  )}
485
- </BrandContainer>
486
- <PriceFilterWrapper>
487
- <OText
488
- size={16}
489
- weight='bold'
490
- lineHeight={24}
491
- style={{ marginBottom: 5 }}
492
- >
493
- {t('PRICE_RANGE', 'Price range')}
494
- </OText>
495
- <View style={styles.priceContainer}>
496
- {priceList.map((price: any, i: number) => (
497
- <OButton
498
- key={i}
499
- bgColor={(filters?.price_level === price?.level) ? theme.colors.primary : theme.colors.backgroundGray200}
500
- onClick={() => handleChangePriceRange(price?.level)}
501
- text={`${price.content} ${(filters?.price_level === price?.level) ? ' X' : ''}`}
502
- style={styles.priceItem}
503
- textStyle={{ fontSize: 10, color: (filters?.price_level === price?.level) ? theme.colors.backgroundLight : theme.colors.textNormal }}
504
- />
505
- ))}
506
- </View>
507
- </PriceFilterWrapper>
508
- {orderState?.options?.type === 1 && (
509
- <MaxSectionItem
510
- filters={filters}
511
- title={t('MAX_DELIVERY_FEE', 'Max delivery fee')}
512
- options={maxDeliveryFeeOptions}
513
- filter='max_delivery_price'
514
- handleChangeFilters={handleChangeFilters}
515
- />
516
- )}
517
- {[1, 2].includes(orderState?.options?.type) && (
518
533
  <MaxSectionItem
519
534
  filters={filters}
520
- title={orderState?.options?.type === 1 ? t('MAX_DELIVERY_TIME', 'Max delivery time') : t('MAX_PICKUP_TIME', 'Max pickup time')}
521
- options={maxTimeOptions}
522
- filter='max_eta'
535
+ title={t('MAX_DISTANCE', 'Max distance')}
536
+ options={maxDistanceOptions}
537
+ filter='max_distance'
523
538
  handleChangeFilters={handleChangeFilters}
524
539
  />
525
- )}
526
- <MaxSectionItem
527
- filters={filters}
528
- title={t('MAX_DISTANCE', 'Max distance')}
529
- options={maxDistanceOptions}
530
- filter='max_distance'
531
- handleChangeFilters={handleChangeFilters}
532
- />
533
- {businessTypes?.length > 0 && (
534
- <TagsContainer>
535
- <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
536
- <View style={styles.businessTypesContainer}>
537
- {businessTypes.map((type: any, i: number) => type.enabled && (
538
- <OButton
539
- key={type?.id}
540
- bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
541
- onClick={() => handleChangeActiveBusinessType(type)}
542
- text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
543
- style={styles.categoryStyle}
544
- textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
545
- />
546
- ))}
547
- </View>
548
- </TagsContainer>
549
- )}
550
- </ScrollView>
551
- <WrapperButtons>
552
- <View style={{ width: '50%' }}>
553
- <OButton
554
- text={t('APPLY', 'Apply')}
555
- parentStyle={styles.applyButton}
556
- textStyle={{ color: '#fff' }}
557
- onClick={() => handleApplyFilters()}
558
- />
559
- </View>
560
- <View style={{ width: '50%' }}>
561
- <OButton
562
- text={t('CLEAR_FILTERS', 'Clear')}
563
- bgColor={theme.colors.white}
564
- borderColor={theme.colors.primary}
565
- parentStyle={styles.applyButton}
566
- textStyle={{ color: theme.colors.primary }}
567
- onClick={() => clearFilters()}
568
- />
569
- </View>
570
- </WrapperButtons>
571
- </OModal>
572
- </BContainer>
540
+ {businessTypes?.length > 0 && (
541
+ <TagsContainer>
542
+ <OText weight='bold' mBottom={7} size={16}>{t('BUSINESS_CATEGORIES', 'Business categories')}</OText>
543
+ <View style={styles.businessTypesContainer}>
544
+ {businessTypes.map((type: any, i: number) => type.enabled && (
545
+ <OButton
546
+ key={type?.id}
547
+ bgColor={(filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? theme.colors.primary : theme.colors.backgroundGray200}
548
+ onClick={() => handleChangeActiveBusinessType(type)}
549
+ text={`${t(`BUSINESS_TYPE_${type.name.replace(/\s/g, '_').toUpperCase()}`, type.name)} ${filters?.business_types?.includes(type?.id) ? 'X' : ''}`}
550
+ style={styles.categoryStyle}
551
+ textStyle={{ fontSize: 10, color: (filters?.business_types?.includes(type?.id) || (type?.id === null && filters?.business_types?.length === 0)) ? '#fff' : theme.colors.textNormal }}
552
+ />
553
+ ))}
554
+ </View>
555
+ </TagsContainer>
556
+ )}
557
+ </ScrollView>
558
+ <WrapperButtons>
559
+ <View style={{ width: '50%' }}>
560
+ <OButton
561
+ text={t('APPLY', 'Apply')}
562
+ parentStyle={styles.applyButton}
563
+ textStyle={{ color: '#fff' }}
564
+ onClick={() => handleApplyFilters()}
565
+ />
566
+ </View>
567
+ <View style={{ width: '50%' }}>
568
+ <OButton
569
+ text={t('CLEAR_FILTERS', 'Clear')}
570
+ bgColor={theme.colors.white}
571
+ borderColor={theme.colors.primary}
572
+ parentStyle={styles.applyButton}
573
+ textStyle={{ color: theme.colors.primary }}
574
+ onClick={() => clearFilters()}
575
+ />
576
+ </View>
577
+ </WrapperButtons>
578
+ </OModal>
579
+ </BContainer>
580
+ </IOScrollView>
573
581
  )
574
582
  }
575
583