ordering-ui-react-native 0.21.0 → 0.21.1-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 (239) hide show
  1. package/package.json +6 -5
  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/PaymentOptionsWebView/index.tsx +1 -0
  6. package/src/components/StripeMethodForm/index.tsx +3 -3
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +3 -2
  9. package/src/types/index.tsx +2 -1
  10. package/src/utils/index.tsx +2 -2
  11. package/themes/business/index.tsx +4 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  13. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  14. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  15. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  16. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  17. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  18. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  19. package/themes/business/src/components/Chat/index.tsx +41 -13
  20. package/themes/business/src/components/DriverMap/index.tsx +4 -2
  21. package/themes/business/src/components/DriverSchedule/index.tsx +5 -5
  22. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  23. package/themes/business/src/components/Home/index.tsx +5 -1
  24. package/themes/business/src/components/MapView/index.tsx +11 -7
  25. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  26. package/themes/business/src/components/NewOrderNotification/index.tsx +161 -106
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +21 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +88 -51
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -16
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  31. package/themes/business/src/components/OrderSummary/index.tsx +42 -23
  32. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  33. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  34. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  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 +27 -35
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +192 -220
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  44. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  45. package/themes/business/src/components/Sessions/index.tsx +187 -0
  46. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  47. package/themes/business/src/components/StoresList/index.tsx +5 -3
  48. package/themes/business/src/components/UserProfileForm/index.tsx +76 -41
  49. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  50. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  51. package/themes/business/src/components/shared/OInput.tsx +2 -0
  52. package/themes/business/src/hooks/useLocation.tsx +5 -4
  53. package/themes/business/src/types/index.tsx +19 -0
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +124 -96
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  63. package/themes/original/index.tsx +9 -4
  64. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  65. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  66. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  67. package/themes/original/src/components/AddressList/index.tsx +4 -7
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/BusinessBasicInformation/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  72. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  73. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  74. package/themes/original/src/components/BusinessInformation/index.tsx +35 -3
  75. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  76. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  77. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  78. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +56 -361
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -4
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  86. package/themes/original/src/components/BusinessProductsListing/index.tsx +46 -22
  87. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  88. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +29 -402
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  96. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  97. package/themes/original/src/components/Cart/index.tsx +32 -9
  98. package/themes/original/src/components/CartContent/index.tsx +98 -59
  99. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  100. package/themes/original/src/components/Checkout/index.tsx +219 -66
  101. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  102. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  103. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  104. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  105. package/themes/original/src/components/Favorite/index.tsx +4 -9
  106. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  107. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  108. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  109. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  110. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  112. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  114. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  116. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  117. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  118. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  119. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  120. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  121. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  122. package/themes/original/src/components/GoogleMap/index.tsx +50 -5
  123. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  124. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  125. package/themes/original/src/components/Home/index.tsx +1 -1
  126. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  127. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +53 -47
  129. package/themes/original/src/components/LoginForm/index.tsx +6 -1
  130. package/themes/original/src/components/Messages/index.tsx +9 -4
  131. package/themes/original/src/components/Messages/styles.tsx +1 -1
  132. package/themes/original/src/components/MomentOption/index.tsx +4 -4
  133. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  134. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  135. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +13 -4
  136. package/themes/original/src/components/MultiCheckout/index.tsx +251 -53
  137. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  138. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  139. package/themes/original/src/components/MyOrders/index.tsx +24 -29
  140. package/themes/original/src/components/NavBar/index.tsx +3 -1
  141. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  142. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  143. package/themes/original/src/components/Notifications/index.tsx +4 -8
  144. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +7 -3
  146. package/themes/original/src/components/OrderDetails/index.tsx +716 -667
  147. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  148. package/themes/original/src/components/OrderProgress/index.tsx +28 -9
  149. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  150. package/themes/original/src/components/OrderSummary/index.tsx +5 -3
  151. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  152. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  153. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  154. package/themes/original/src/components/OrdersOption/index.tsx +5 -3
  155. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  156. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  157. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  158. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  159. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  160. package/themes/original/src/components/PaymentOptions/index.tsx +81 -33
  161. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  162. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  163. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  164. package/themes/original/src/components/ProductForm/index.tsx +79 -167
  165. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  166. package/themes/original/src/components/ProductItemAccordion/index.tsx +12 -8
  167. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  168. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  169. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  170. package/themes/original/src/components/Promotions/index.tsx +4 -4
  171. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  172. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  173. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  174. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  175. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  176. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  177. package/themes/original/src/components/SingleOrderCard/index.tsx +5 -4
  178. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  179. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  180. package/themes/original/src/components/StripeCardsList/index.tsx +23 -8
  181. package/themes/original/src/components/StripeElementsForm/index.tsx +9 -4
  182. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  183. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  184. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  185. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  186. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  187. package/themes/original/src/components/UserFormDetails/index.tsx +53 -7
  188. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  189. package/themes/original/src/components/UserProfileForm/index.tsx +30 -36
  190. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  191. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  192. package/themes/original/src/components/Wallets/index.tsx +8 -9
  193. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  194. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  195. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  196. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  197. package/themes/original/src/components/shared/OButton.tsx +5 -5
  198. package/themes/original/src/components/shared/OInput.tsx +1 -4
  199. package/themes/original/src/components/shared/OModal.tsx +12 -14
  200. package/themes/original/src/layouts/Container.tsx +5 -3
  201. package/themes/original/src/types/index.tsx +10 -2
  202. package/themes/original/src/utils/index.tsx +124 -0
  203. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  204. package/src/navigators/BottomNavigator.tsx +0 -117
  205. package/src/navigators/CheckoutNavigator.tsx +0 -66
  206. package/src/navigators/HomeNavigator.tsx +0 -202
  207. package/src/navigators/NavigationRef.tsx +0 -7
  208. package/src/navigators/RootNavigator.tsx +0 -269
  209. package/src/pages/Account.tsx +0 -34
  210. package/src/pages/AddressForm.tsx +0 -62
  211. package/src/pages/AddressList.tsx +0 -24
  212. package/src/pages/BusinessProductsList.tsx +0 -81
  213. package/src/pages/BusinessesListing.tsx +0 -43
  214. package/src/pages/CartList.tsx +0 -49
  215. package/src/pages/Checkout.tsx +0 -101
  216. package/src/pages/ForgotPassword.tsx +0 -24
  217. package/src/pages/Help.tsx +0 -23
  218. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  219. package/src/pages/HelpGuide.tsx +0 -23
  220. package/src/pages/HelpOrder.tsx +0 -23
  221. package/src/pages/Home.tsx +0 -36
  222. package/src/pages/IntroductoryTutorial.tsx +0 -170
  223. package/src/pages/Login.tsx +0 -47
  224. package/src/pages/MomentOption.tsx +0 -30
  225. package/src/pages/MultiCheckout.tsx +0 -31
  226. package/src/pages/MultiOrdersDetails.tsx +0 -27
  227. package/src/pages/MyOrders.tsx +0 -40
  228. package/src/pages/NetworkError.tsx +0 -24
  229. package/src/pages/NotFound.tsx +0 -22
  230. package/src/pages/OrderDetails.tsx +0 -25
  231. package/src/pages/ProductDetails.tsx +0 -55
  232. package/src/pages/Profile.tsx +0 -36
  233. package/src/pages/ReviewDriver.tsx +0 -30
  234. package/src/pages/ReviewOrder.tsx +0 -32
  235. package/src/pages/ReviewProducts.tsx +0 -30
  236. package/src/pages/Sessions.tsx +0 -22
  237. package/src/pages/Signup.tsx +0 -53
  238. package/src/pages/SpinnerLoader.tsx +0 -10
  239. package/src/pages/Splash.tsx +0 -21
@@ -56,6 +56,10 @@ import { NotFoundSource } from '../NotFoundSource';
56
56
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
57
57
  import NavBar from '../NavBar';
58
58
  import { orderTypeList } from '../../utils';
59
+ import { ActionButton } from './ActionButton'
60
+ import { ExtraOptions } from './ExtraOptions'
61
+ import { IOScrollView } from 'react-native-intersection-observer';
62
+
59
63
  const windowWidth = Dimensions.get('window').width;
60
64
 
61
65
  export const ProductOptionsUI = (props: any) => {
@@ -79,11 +83,10 @@ export const ProductOptionsUI = (props: any) => {
79
83
  actionStatus,
80
84
  handleCreateGuestUser
81
85
  } = props;
82
-
83
86
  const theme = useTheme();
84
87
  const [, { showToast }] = useToast()
85
88
  const [events] = useEvent()
86
-
89
+ const commentRef = useRef()
87
90
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
88
91
 
89
92
  const styles = StyleSheet.create({
@@ -137,7 +140,8 @@ export const ProductOptionsUI = (props: any) => {
137
140
  },
138
141
  slide1: {
139
142
  flex: 1,
140
- alignItems: 'center'
143
+ alignItems: 'center',
144
+ width: '100%'
141
145
  },
142
146
  mainSwiper: {
143
147
  height: 258,
@@ -176,7 +180,7 @@ export const ProductOptionsUI = (props: any) => {
176
180
  marginTop: 10
177
181
  },
178
182
  wrapperNavbar: {
179
- paddingHorizontal: 40,
183
+ paddingHorizontal: 20,
180
184
  paddingTop: 0,
181
185
  }
182
186
  });
@@ -207,7 +211,7 @@ export const ProductOptionsUI = (props: any) => {
207
211
  const [editionsLayoutY, setEditionsLayoutY] = useState(null)
208
212
  const [viewedProduct, setViewedProduct] = useState<any>(null)
209
213
  const [showTitle, setShowTitle] = useState(false)
210
-
214
+ const productOptionsMounted = useRef(false)
211
215
  const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
212
216
  const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
213
217
 
@@ -282,14 +286,14 @@ export const ProductOptionsUI = (props: any) => {
282
286
  setQtyBy({ [val]: true, [!val]: false })
283
287
  }
284
288
 
285
- const onStateChange = useCallback((state) => {
289
+ const onStateChange = useCallback((state : string) => {
286
290
  if (state === "ended") {
287
291
  setPlaying(false);
288
292
  }
289
293
  }, []);
290
294
 
291
295
  const togglePlaying = useCallback(() => {
292
- setPlaying((prev) => !prev);
296
+ setPlaying((prev : any) => !prev);
293
297
  }, []);
294
298
 
295
299
  const onChangeProductCartQuantity = (quantity: number) => {
@@ -320,63 +324,22 @@ export const ProductOptionsUI = (props: any) => {
320
324
  if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
321
325
  }
322
326
 
323
- const handleOnLayout = (event: any, optionId: any) => {
324
- const _optionLayout = { ...optionLayout }
327
+ let _optionLayout: any = {}
328
+
329
+ const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
330
+ if (suboptionsLength >= 200) {
331
+ return
332
+ }
333
+ _optionLayout = { ..._optionLayout }
325
334
  const optionKey = 'id:' + optionId
326
335
  _optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
327
- setOptionLayout(_optionLayout)
336
+ if (lastMounts) {
337
+ setOptionLayout(_optionLayout)
338
+ }
328
339
  }
329
340
 
330
- const saveErrors =
331
- orderState.loading ||
332
- maxProductQuantity === 0 ||
333
- Object.keys(errors)?.length > 0;
334
-
335
-
336
- const ExtraOptions = ({ eID, options }: any) => (
337
- <>
338
- {options.map(({ id, name, respect_to, suboptions }: any) => (
339
- <React.Fragment key={`cont_key_${id}`}>
340
- {respect_to == null && suboptions?.length > 0 && (
341
- <TouchableOpacity
342
- key={`eopt_key_${id}`}
343
- onPress={() => {
344
- setSelectedOpt(id)
345
- scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
346
- y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
347
- animated: true
348
- })
349
- }}
350
- style={[
351
- styles.extraItem,
352
- {
353
- borderBottomColor:
354
- selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
355
- },
356
- ]}>
357
- <OText
358
- color={
359
- selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
360
- }
361
- size={12}
362
- weight={selOpt == id ? '600' : 'normal'}
363
- style={{ maxWidth: 150 }}
364
- numberOfLines={1}>
365
- {name}
366
- </OText>
367
- </TouchableOpacity>
368
- )}
369
- </React.Fragment>
370
- ))}
371
- </>
372
- );
373
-
374
- const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
341
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
375
342
  setShowTitle(contentOffset.y > 30)
376
- const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
377
- if (_topOption) {
378
- const _topOptionId = Number(_topOption.replace('id:', ''))
379
- }
380
343
  }
381
344
 
382
345
  const handleGoBack = navigation?.canGoBack()
@@ -434,90 +397,6 @@ export const ProductOptionsUI = (props: any) => {
434
397
  }
435
398
  }, [product])
436
399
 
437
- const ActionButton = () => {
438
- return (
439
- <View
440
- style={{
441
- width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
442
- }}>
443
- {((productCart &&
444
- auth &&
445
- orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
446
- <OButton
447
- onClick={() => handleSaveProduct()}
448
- imgRightSrc=""
449
- text={`${orderState.loading
450
- ? t('LOADING', 'Loading')
451
- : (isSoldOut || maxProductQuantity <= 0)
452
- ? t('SOLD_OUT', 'Sold out')
453
- : editMode
454
- ? t('UPDATE', 'Update')
455
- : t('ADD', 'Add')
456
- }`}
457
- isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
458
- textStyle={{
459
- color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
460
- fontSize: orderState.loading || editMode ? 10 : 14
461
- }}
462
- style={{
463
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
464
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
465
- opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
466
- borderRadius: 7.6,
467
- height: 44,
468
- shadowOpacity: 0,
469
- borderWidth: 1,
470
- marginTop: isHaveWeight ? 10 : 0
471
- }}
472
- />
473
- )}
474
- {auth &&
475
- !orderState.options?.address_id &&
476
- (orderState.loading ? (
477
- <OButton
478
- isDisabled
479
- text={t('LOADING', 'Loading')}
480
- imgRightSrc=""
481
- textStyle={{ fontSize: 10 }}
482
- />
483
- ) : (
484
- <OButton onClick={navigation.navigate('AddressList')} />
485
- ))}
486
- {!auth && (
487
- <OButton
488
- isDisabled={isSoldOut || maxProductQuantity <= 0}
489
- onClick={() => handleRedirectLogin()}
490
- text={
491
- isSoldOut || maxProductQuantity <= 0
492
- ? t('SOLD_OUT', 'Sold out')
493
- : t('LOGIN_SIGNUP', 'Login / Sign Up')
494
- }
495
- imgRightSrc=""
496
- textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
497
- style={{
498
- height: 42,
499
- borderColor: theme.colors.primary,
500
- backgroundColor: theme.colors.white,
501
- paddingLeft: 0,
502
- paddingRight: 0
503
- }}
504
- />
505
- )}
506
- {!auth && guestCheckoutEnabled && orderTypeEnabled && (
507
- <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
508
- {actionStatus?.loading ? (
509
- <Placeholder Animation={Fade}>
510
- <PlaceholderLine width={60} height={20} />
511
- </Placeholder>
512
- ) : (
513
- <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
514
- )}
515
- </TouchableOpacity>
516
- )}
517
- </View>
518
- )
519
- }
520
-
521
400
  useEffect(() => {
522
401
  const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
523
402
  scrollViewRef.current.scrollToEnd({ animated: true })
@@ -533,13 +412,45 @@ export const ProductOptionsUI = (props: any) => {
533
412
  events.emit('product_viewed', product)
534
413
  }, [product?.id, viewedProduct])
535
414
 
415
+ const actionButtonProps = {
416
+ navigation,
417
+ isHaveWeight,
418
+ isSoldOut,
419
+ maxProductQuantity,
420
+ productCart,
421
+ handleSaveProduct,
422
+ editMode,
423
+ product,
424
+ errors,
425
+ productAddedToCartLength,
426
+ handleRedirectLogin,
427
+ guestCheckoutEnabled,
428
+ orderTypeEnabled,
429
+ handleUpdateGuest,
430
+ actionStatus
431
+ }
432
+
433
+ const extraOptionsProps = {
434
+ setSelectedOpt,
435
+ scrollViewRef,
436
+ optionLayout,
437
+ editionsLayoutY,
438
+ styles,
439
+ selOpt
440
+ }
441
+
442
+ const suboptionsLength = product?.extras?.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
443
+
536
444
  return (
537
445
  <SafeAreaView style={{ flex: 1 }}>
538
446
  <View style={styles.wrapperNavbar}>
539
447
  <TopHeader>
540
448
  <>
541
449
  <TopActions onPress={() => handleGoBack()}>
542
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
450
+ <IconAntDesign
451
+ name='arrowleft'
452
+ size={26}
453
+ />
543
454
  </TopActions>
544
455
  {showTitle && (
545
456
  <OText
@@ -556,10 +467,11 @@ export const ProductOptionsUI = (props: any) => {
556
467
  </TopHeader>
557
468
  </View>
558
469
  {!error && (
559
- <ScrollView
470
+ <IOScrollView
560
471
  ref={scrollViewRef}
561
472
  contentContainerStyle={{ paddingBottom: 80 }}
562
473
  stickyHeaderIndices={[2]}
474
+ scrollEventThrottle={100}
563
475
  onScroll={handleScroll}
564
476
  >
565
477
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
@@ -581,7 +493,7 @@ export const ProductOptionsUI = (props: any) => {
581
493
  showsButtons={true}
582
494
  style={styles.mainSwiper}
583
495
  showsPagination={false}
584
- onIndexChanged={(index) => handleChangeMainIndex(index)}
496
+ onIndexChanged={(index : any) => handleChangeMainIndex(index)}
585
497
  prevButton={
586
498
  <View style={styles.swiperButton}>
587
499
  <IconAntDesign
@@ -603,7 +515,7 @@ export const ProductOptionsUI = (props: any) => {
603
515
  </View>
604
516
  }
605
517
  >
606
- {gallery && gallery?.length > 0 && gallery.map((img, i) => (
518
+ {gallery && gallery?.length > 0 && gallery.map((img : any, i: number) => (
607
519
  <View
608
520
  style={styles.slide1}
609
521
  key={i}
@@ -634,11 +546,11 @@ export const ProductOptionsUI = (props: any) => {
634
546
  <ScrollView
635
547
  horizontal
636
548
  contentContainerStyle={{
637
- paddingHorizontal: 30,
549
+ paddingHorizontal: 20,
638
550
  paddingVertical: 15
639
551
  }}
640
552
  >
641
- {gallery?.length > 1 && gallery.map((img, index) => (
553
+ {gallery?.length > 1 && gallery.map((img: any, index: number) => (
642
554
  <TouchableOpacity
643
555
  key={index}
644
556
  onPress={() => handleClickThumb(index)}
@@ -687,7 +599,7 @@ export const ProductOptionsUI = (props: any) => {
687
599
  )}
688
600
  </WrapHeader>
689
601
  <ProductSummary
690
- ph={isChewLayout ? 20 : 40}
602
+ ph={20}
691
603
  onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
692
604
  >
693
605
  <ProductTitle>
@@ -757,6 +669,7 @@ export const ProductOptionsUI = (props: any) => {
757
669
  </ProductDescription>
758
670
  <ScrollView
759
671
  horizontal
672
+ scrollEventThrottle={100}
760
673
  showsHorizontalScrollIndicator={false}
761
674
  contentContainerStyle={{ paddingBottom: 30 }}
762
675
  >
@@ -784,12 +697,13 @@ export const ProductOptionsUI = (props: any) => {
784
697
  {(!loading && product) && (
785
698
  <ExtraOptionWrap
786
699
  horizontal
700
+ scrollEventThrottle={100}
787
701
  showsHorizontalScrollIndicator={false}
788
702
  style={{
789
703
  marginBottom: 20,
790
704
  borderBottomWidth: 1,
791
705
  borderBottomColor: theme.colors.border,
792
- marginHorizontal: isChewLayout ? 20 : 30,
706
+ marginHorizontal: 20,
793
707
  backgroundColor: theme.colors.backgroundPage,
794
708
  }}
795
709
  >
@@ -818,8 +732,8 @@ export const ProductOptionsUI = (props: any) => {
818
732
  </OText>
819
733
  </TouchableOpacity>
820
734
  )}
821
- {product?.extras?.map((extra: any) =>
822
- <ExtraOptions key={extra.id} options={extra.options} />
735
+ {suboptionsLength < 200 && product?.extras?.map((extra: any) =>
736
+ <ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
823
737
  )}
824
738
  </ExtraOptionWrap>
825
739
  )}
@@ -863,14 +777,14 @@ export const ProductOptionsUI = (props: any) => {
863
777
  </>
864
778
  ) : (
865
779
  <ProductEditions
866
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
780
+ style={{ paddingHorizontal: 20 }}
867
781
  onLayout={(event: any) => {
868
782
  setEditionsLayoutY(event.nativeEvent.layout?.y)
869
783
  }}
870
784
  >
871
785
  <>
872
786
  {product?.ingredients?.length > 0 && (
873
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
787
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0, true)}>
874
788
  <SectionTitle>
875
789
  <OText size={16}>
876
790
  {t('INGREDIENTS', 'Ingredients')}
@@ -892,13 +806,13 @@ export const ProductOptionsUI = (props: any) => {
892
806
  </View>
893
807
  )}
894
808
  {product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
895
- extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
809
+ extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => {
896
810
  const currentState =
897
811
  productCart.options[`id:${option.id}`] || {};
898
812
  return (
899
813
  <React.Fragment key={`popt_${option.id}`}>
900
814
  {showOption(option) && (
901
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
815
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id, extra.options?.length <= i + 2)}>
902
816
  <ProductOption
903
817
  option={option}
904
818
  currentState={currentState}
@@ -910,12 +824,7 @@ export const ProductOptionsUI = (props: any) => {
910
824
  }}>
911
825
  {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
912
826
  (suboption: any) => {
913
- const currentState =
914
- productCart.options[
915
- `id:${option.id}`
916
- ]?.suboptions[
917
- `id:${suboption.id}`
918
- ] || {};
827
+ const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
919
828
  const balance =
920
829
  productCart.options[
921
830
  `id:${option.id}`
@@ -930,6 +839,7 @@ export const ProductOptionsUI = (props: any) => {
930
839
  balance={balance}
931
840
  option={option}
932
841
  suboption={suboption}
842
+ image={suboption.image}
933
843
  state={currentState}
934
844
  disabled={
935
845
  isSoldOut ||
@@ -937,6 +847,7 @@ export const ProductOptionsUI = (props: any) => {
937
847
  }
938
848
  setIsScrollAvailable={setIsScrollAvailable}
939
849
  error={errors[`id:${option.id}`]}
850
+ enableIntersection={suboptionsLength >= 200}
940
851
  />
941
852
  );
942
853
  },
@@ -954,7 +865,7 @@ export const ProductOptionsUI = (props: any) => {
954
865
  <ProductComment>
955
866
  <SectionTitle>
956
867
  <OText size={16} weight={'600'} lineHeight={24}>
957
- {t('SPECIAL_COMMENT', 'Special comment')}
868
+ {t('COMMENTS', 'Special comment')}
958
869
  </OText>
959
870
  </SectionTitle>
960
871
  <OInput
@@ -968,6 +879,7 @@ export const ProductOptionsUI = (props: any) => {
968
879
  !(productCart && !isSoldOut && maxProductQuantity)
969
880
  }
970
881
  style={styles.comment}
882
+ forwardRef={commentRef}
971
883
  />
972
884
  </ProductComment>
973
885
  )}
@@ -976,7 +888,7 @@ export const ProductOptionsUI = (props: any) => {
976
888
  {!!error && error?.length > 0 && (
977
889
  <NotFoundSource content={error[0]?.message || error[0]} />
978
890
  )}
979
- </ScrollView>
891
+ </IOScrollView>
980
892
  )}
981
893
  {!loading && !error && product && (
982
894
  <ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
@@ -1087,9 +999,9 @@ export const ProductOptionsUI = (props: any) => {
1087
999
  )}
1088
1000
  </>
1089
1001
  )}
1090
- {!isHaveWeight && <ActionButton />}
1002
+ {!isHaveWeight && <ActionButton {...actionButtonProps} />}
1091
1003
  </View>
1092
- {isHaveWeight && <ActionButton />}
1004
+ {isHaveWeight && <ActionButton {...actionButtonProps} />}
1093
1005
  </ProductActions>
1094
1006
  )}
1095
1007
  </SafeAreaView>
@@ -70,7 +70,7 @@ export const ProductActions = styled.View`
70
70
  position: absolute;
71
71
  bottom: 0px;
72
72
  padding-top: ${(props: any) => props.ios ? '20px' : '0'};
73
- padding-horizontal: 40px;
73
+ padding-horizontal: 30px;
74
74
  padding-vertical: 20px;
75
75
  width: 100%;
76
76
  flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
@@ -40,7 +40,6 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
40
40
 
41
41
  const theme = useTheme();
42
42
 
43
-
44
43
  const pickerStyle = StyleSheet.create({
45
44
  inputAndroid: {
46
45
  width: 34,
@@ -75,9 +74,9 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
75
74
 
76
75
  const [isActive, setActiveState] = useState(false)
77
76
  const [isServiceOpen, setIsServiceOpen] = useState(false)
77
+ const [productQuantityState, setProductQuantityState] = useState(product.quantity.toString())
78
78
  // const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
79
79
  // const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
80
- const [productQuantity, setProductQuantity] = useState(product.quantity.toString())
81
80
 
82
81
  const productInfo = () => {
83
82
  if (isCartProduct) {
@@ -121,7 +120,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
121
120
 
122
121
  const handleChangeQuantity = (value: string) => {
123
122
  if (!orderState.loading) {
124
- setProductQuantity(value)
123
+ setProductQuantityState(value)
125
124
  if (parseInt(value) === 0) {
126
125
  onDeleteProduct && onDeleteProduct(product)
127
126
  } else {
@@ -211,10 +210,15 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
211
210
  <RNPickerSelect
212
211
  items={productOptions}
213
212
  onValueChange={handleChangeQuantity}
214
- value={productQuantity}
213
+ value={productQuantityState}
215
214
  style={pickerStyle}
216
215
  useNativeAndroidPickerStyle={false}
217
216
  placeholder={{}}
217
+ touchableWrapperProps={{
218
+ style: {
219
+ width: 40,
220
+ }
221
+ }}
218
222
  Icon={() => <View style={pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} /></View>}
219
223
  disabled={orderState.loading}
220
224
  />
@@ -282,15 +286,15 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
282
286
  {productInfo().ingredients.length > 0 && productInfo().ingredients.some((ingredient: any) => !ingredient.selected) && (
283
287
  <ProductOptionsList>
284
288
  <OText size={10} color={theme.colors.textSecondary}>{t('INGREDIENTS', 'Ingredients')}</OText>
285
- {productInfo().ingredients.map((ingredient: any) => !ingredient.selected && (
286
- <OText size={10} color={theme.colors.textThird} key={ingredient.id} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
289
+ {productInfo().ingredients.map((ingredient: any, i) => !ingredient.selected && (
290
+ <OText size={10} color={theme.colors.textThird} key={ingredient.id + i} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
287
291
  ))}
288
292
  </ProductOptionsList>
289
293
  )}
290
294
  {productInfo().options.length > 0 && (
291
295
  <ProductOptionsList>
292
- {productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => (
293
- <ProductOption key={option.id + i}>
296
+ {productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => (
297
+ <ProductOption key={option.id}>
294
298
  <OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
295
299
  {option.suboptions.map((suboption: any) => (
296
300
  <ProductSubOption key={suboption.id}>