ordering-ui-react-native 0.18.55 → 0.18.56-crash-driver-1
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 +6 -4
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/PaymentOptionsWebView/index.tsx +30 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +60 -55
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +3 -1
- package/src/utils/index.tsx +2 -2
- package/themes/business/index.tsx +6 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
- package/themes/business/src/components/BusinessController/index.tsx +19 -17
- package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
- package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
- package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
- package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
- package/themes/business/src/components/Chat/index.tsx +48 -19
- package/themes/business/src/components/DriverMap/index.tsx +36 -23
- package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
- package/themes/business/src/components/FloatingButton/index.tsx +34 -31
- package/themes/business/src/components/GoogleMap/index.tsx +15 -8
- package/themes/business/src/components/Home/index.tsx +5 -1
- package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
- package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
- package/themes/business/src/components/LoginForm/index.tsx +2 -2
- package/themes/business/src/components/LogoutButton/index.tsx +1 -1
- package/themes/business/src/components/MapView/index.tsx +28 -17
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
- package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
- package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +245 -82
- package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
- package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
- package/themes/business/src/components/OrdersOption/index.tsx +125 -48
- package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
- package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
- package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
- package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
- package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
- package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
- package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
- package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
- package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
- package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/Sessions/index.tsx +187 -0
- package/themes/business/src/components/Sessions/styles.tsx +20 -0
- package/themes/business/src/components/StoresList/index.tsx +4 -3
- package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
- package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
- package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
- package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/business/src/components/shared/OInput.tsx +2 -0
- package/themes/business/src/hooks/useLocation.tsx +5 -4
- package/themes/business/src/types/index.tsx +21 -1
- package/themes/business/src/utils/index.tsx +5 -0
- package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
- package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
- package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
- package/themes/original/index.tsx +11 -3
- package/themes/original/src/components/AddressDetails/index.tsx +20 -10
- package/themes/original/src/components/AddressForm/index.tsx +41 -20
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +22 -11
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
- package/themes/original/src/components/BusinessController/index.tsx +40 -43
- package/themes/original/src/components/BusinessController/styles.tsx +12 -12
- package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
- package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
- package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
- package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
- package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
- package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
- package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
- package/themes/original/src/components/Cart/index.tsx +51 -40
- package/themes/original/src/components/CartContent/index.tsx +98 -54
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +308 -75
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/DatePicker/index.tsx +33 -0
- package/themes/original/src/components/DatePicker/styles.tsx +20 -0
- package/themes/original/src/components/DriverTips/index.tsx +6 -3
- package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
- package/themes/original/src/components/Favorite/index.tsx +8 -4
- package/themes/original/src/components/Favorite/styles.tsx +0 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
- package/themes/original/src/components/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
- package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
- package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
- package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
- package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
- package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
- package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +52 -5
- package/themes/original/src/components/Help/index.tsx +7 -0
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
- package/themes/original/src/components/HelpGuide/index.tsx +5 -0
- package/themes/original/src/components/HelpOrder/index.tsx +5 -0
- package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
- package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
- package/themes/original/src/components/Home/index.tsx +3 -2
- package/themes/original/src/components/LastOrder/index.tsx +2 -1
- package/themes/original/src/components/LastOrders/index.tsx +2 -1
- package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
- package/themes/original/src/components/LoginForm/index.tsx +38 -14
- package/themes/original/src/components/MessageListing/index.tsx +6 -0
- package/themes/original/src/components/Messages/index.tsx +9 -3
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +20 -5
- package/themes/original/src/components/MomentSelector/index.tsx +1 -1
- package/themes/original/src/components/MultiCart/index.tsx +1 -1
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
- package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
- package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
- package/themes/original/src/components/MyOrders/index.tsx +37 -39
- package/themes/original/src/components/NavBar/index.tsx +15 -14
- package/themes/original/src/components/NetworkError/index.tsx +2 -3
- package/themes/original/src/components/NetworkError/styles.tsx +2 -2
- package/themes/original/src/components/Notifications/index.tsx +9 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
- package/themes/original/src/components/OrderDetails/index.tsx +718 -667
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
- package/themes/original/src/components/OrderProgress/index.tsx +50 -14
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +26 -34
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +14 -6
- package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
- package/themes/original/src/components/PageBanner/index.tsx +3 -0
- package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
- package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
- package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
- package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +193 -267
- package/themes/original/src/components/ProductForm/styles.tsx +1 -1
- package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
- package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
- package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
- package/themes/original/src/components/Promotions/index.tsx +13 -11
- package/themes/original/src/components/Promotions/styles.tsx +0 -2
- package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
- package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
- package/themes/original/src/components/ServiceForm/index.tsx +2 -2
- package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
- package/themes/original/src/components/Sessions/index.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +76 -60
- package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
- package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
- package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
- package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
- package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
- package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
- package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
- package/themes/original/src/components/UserProfile/index.tsx +5 -4
- package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
- package/themes/original/src/components/UserVerification/index.tsx +55 -50
- package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +35 -49
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
- package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +5 -5
- package/themes/original/src/components/shared/OInput.tsx +7 -4
- package/themes/original/src/components/shared/OModal.tsx +12 -14
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +13 -2
- package/themes/original/src/utils/index.tsx +124 -22
- package/src/navigators/BottomNavigator.tsx +0 -117
- package/src/navigators/CheckoutNavigator.tsx +0 -66
- package/src/navigators/HomeNavigator.tsx +0 -202
- package/src/navigators/NavigationRef.tsx +0 -7
- package/src/navigators/RootNavigator.tsx +0 -269
- package/src/pages/Account.tsx +0 -34
- package/src/pages/AddressForm.tsx +0 -62
- package/src/pages/AddressList.tsx +0 -24
- package/src/pages/BusinessProductsList.tsx +0 -81
- package/src/pages/BusinessesListing.tsx +0 -43
- package/src/pages/CartList.tsx +0 -49
- package/src/pages/Checkout.tsx +0 -101
- package/src/pages/ForgotPassword.tsx +0 -24
- package/src/pages/Help.tsx +0 -23
- package/src/pages/HelpAccountAndPayment.tsx +0 -23
- package/src/pages/HelpGuide.tsx +0 -23
- package/src/pages/HelpOrder.tsx +0 -23
- package/src/pages/Home.tsx +0 -36
- package/src/pages/IntroductoryTutorial.tsx +0 -170
- package/src/pages/Login.tsx +0 -47
- package/src/pages/MomentOption.tsx +0 -30
- package/src/pages/MultiCheckout.tsx +0 -31
- package/src/pages/MultiOrdersDetails.tsx +0 -27
- package/src/pages/MyOrders.tsx +0 -40
- package/src/pages/NetworkError.tsx +0 -24
- package/src/pages/NotFound.tsx +0 -22
- package/src/pages/OrderDetails.tsx +0 -25
- package/src/pages/ProductDetails.tsx +0 -55
- package/src/pages/Profile.tsx +0 -36
- package/src/pages/ReviewDriver.tsx +0 -30
- package/src/pages/ReviewOrder.tsx +0 -32
- package/src/pages/ReviewProducts.tsx +0 -30
- package/src/pages/Sessions.tsx +0 -22
- package/src/pages/Signup.tsx +0 -53
- package/src/pages/SpinnerLoader.tsx +0 -10
- package/src/pages/Splash.tsx +0 -21
|
@@ -30,6 +30,7 @@ import Swiper from 'react-native-swiper'
|
|
|
30
30
|
import FastImage from 'react-native-fast-image';
|
|
31
31
|
import IconAntDesign from 'react-native-vector-icons/AntDesign';
|
|
32
32
|
import YoutubePlayer from "react-native-youtube-iframe"
|
|
33
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
33
34
|
|
|
34
35
|
import {
|
|
35
36
|
WrapHeader,
|
|
@@ -54,7 +55,11 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
|
|
|
54
55
|
import { NotFoundSource } from '../NotFoundSource';
|
|
55
56
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
56
57
|
import NavBar from '../NavBar';
|
|
57
|
-
import { orderTypeList
|
|
58
|
+
import { orderTypeList } from '../../utils';
|
|
59
|
+
import { ActionButton } from './ActionButton'
|
|
60
|
+
import { ExtraOptions } from './ExtraOptions'
|
|
61
|
+
import { IOScrollView } from 'react-native-intersection-observer';
|
|
62
|
+
|
|
58
63
|
const windowWidth = Dimensions.get('window').width;
|
|
59
64
|
|
|
60
65
|
export const ProductOptionsUI = (props: any) => {
|
|
@@ -78,12 +83,12 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
78
83
|
actionStatus,
|
|
79
84
|
handleCreateGuestUser
|
|
80
85
|
} = props;
|
|
81
|
-
|
|
82
86
|
const theme = useTheme();
|
|
83
87
|
const [, { showToast }] = useToast()
|
|
84
88
|
const [events] = useEvent()
|
|
85
|
-
|
|
89
|
+
const commentRef = useRef()
|
|
86
90
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
91
|
+
const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
|
|
87
92
|
|
|
88
93
|
const styles = StyleSheet.create({
|
|
89
94
|
mainContainer: {
|
|
@@ -136,7 +141,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
136
141
|
},
|
|
137
142
|
slide1: {
|
|
138
143
|
flex: 1,
|
|
139
|
-
alignItems: 'center'
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
width: '100%'
|
|
140
146
|
},
|
|
141
147
|
mainSwiper: {
|
|
142
148
|
height: 258,
|
|
@@ -175,7 +181,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
175
181
|
marginTop: 10
|
|
176
182
|
},
|
|
177
183
|
wrapperNavbar: {
|
|
178
|
-
paddingHorizontal:
|
|
184
|
+
paddingHorizontal: 20,
|
|
179
185
|
paddingTop: 0,
|
|
180
186
|
}
|
|
181
187
|
});
|
|
@@ -206,9 +212,17 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
206
212
|
const [editionsLayoutY, setEditionsLayoutY] = useState(null)
|
|
207
213
|
const [viewedProduct, setViewedProduct] = useState<any>(null)
|
|
208
214
|
const [showTitle, setShowTitle] = useState(false)
|
|
209
|
-
|
|
215
|
+
const productOptionsMounted = useRef(false)
|
|
210
216
|
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
211
|
-
|
|
217
|
+
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
218
|
+
|
|
219
|
+
const vibrateApp = (impact?: string) => {
|
|
220
|
+
const options = {
|
|
221
|
+
enableVibrateFallback: true,
|
|
222
|
+
ignoreAndroidSystemSettings: false
|
|
223
|
+
};
|
|
224
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
225
|
+
}
|
|
212
226
|
|
|
213
227
|
const isError = (id: number) => {
|
|
214
228
|
let bgColor = theme.colors.white;
|
|
@@ -273,14 +287,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
273
287
|
setQtyBy({ [val]: true, [!val]: false })
|
|
274
288
|
}
|
|
275
289
|
|
|
276
|
-
const onStateChange = useCallback((state) => {
|
|
290
|
+
const onStateChange = useCallback((state : string) => {
|
|
277
291
|
if (state === "ended") {
|
|
278
292
|
setPlaying(false);
|
|
279
293
|
}
|
|
280
294
|
}, []);
|
|
281
295
|
|
|
282
296
|
const togglePlaying = useCallback(() => {
|
|
283
|
-
setPlaying((prev) => !prev);
|
|
297
|
+
setPlaying((prev : any) => !prev);
|
|
284
298
|
}, []);
|
|
285
299
|
|
|
286
300
|
const onChangeProductCartQuantity = (quantity: number) => {
|
|
@@ -311,63 +325,22 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
311
325
|
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
312
326
|
}
|
|
313
327
|
|
|
314
|
-
|
|
315
|
-
|
|
328
|
+
let _optionLayout: any = {}
|
|
329
|
+
|
|
330
|
+
const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
|
|
331
|
+
if (suboptionsLength >= 200) {
|
|
332
|
+
return
|
|
333
|
+
}
|
|
334
|
+
_optionLayout = { ..._optionLayout }
|
|
316
335
|
const optionKey = 'id:' + optionId
|
|
317
336
|
_optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
|
|
318
|
-
|
|
337
|
+
if (lastMounts) {
|
|
338
|
+
setOptionLayout(_optionLayout)
|
|
339
|
+
}
|
|
319
340
|
}
|
|
320
341
|
|
|
321
|
-
const
|
|
322
|
-
orderState.loading ||
|
|
323
|
-
maxProductQuantity === 0 ||
|
|
324
|
-
Object.keys(errors)?.length > 0;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const ExtraOptions = ({ eID, options }: any) => (
|
|
328
|
-
<>
|
|
329
|
-
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
330
|
-
<React.Fragment key={`cont_key_${id}`}>
|
|
331
|
-
{respect_to == null && suboptions?.length > 0 && (
|
|
332
|
-
<TouchableOpacity
|
|
333
|
-
key={`eopt_key_${id}`}
|
|
334
|
-
onPress={() => {
|
|
335
|
-
setSelectedOpt(id)
|
|
336
|
-
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
337
|
-
y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
|
|
338
|
-
animated: true
|
|
339
|
-
})
|
|
340
|
-
}}
|
|
341
|
-
style={[
|
|
342
|
-
styles.extraItem,
|
|
343
|
-
{
|
|
344
|
-
borderBottomColor:
|
|
345
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
346
|
-
},
|
|
347
|
-
]}>
|
|
348
|
-
<OText
|
|
349
|
-
color={
|
|
350
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
351
|
-
}
|
|
352
|
-
size={12}
|
|
353
|
-
weight={selOpt == id ? '600' : 'normal'}
|
|
354
|
-
style={{ maxWidth: 150 }}
|
|
355
|
-
numberOfLines={1}>
|
|
356
|
-
{name}
|
|
357
|
-
</OText>
|
|
358
|
-
</TouchableOpacity>
|
|
359
|
-
)}
|
|
360
|
-
</React.Fragment>
|
|
361
|
-
))}
|
|
362
|
-
</>
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
|
|
342
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
366
343
|
setShowTitle(contentOffset.y > 30)
|
|
367
|
-
const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
|
|
368
|
-
if (_topOption) {
|
|
369
|
-
const _topOptionId = Number(_topOption.replace('id:', ''))
|
|
370
|
-
}
|
|
371
344
|
}
|
|
372
345
|
|
|
373
346
|
const handleGoBack = navigation?.canGoBack()
|
|
@@ -425,90 +398,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
425
398
|
}
|
|
426
399
|
}, [product])
|
|
427
400
|
|
|
428
|
-
const ActionButton = () => {
|
|
429
|
-
return (
|
|
430
|
-
<View
|
|
431
|
-
style={{
|
|
432
|
-
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
433
|
-
}}>
|
|
434
|
-
{((productCart &&
|
|
435
|
-
auth &&
|
|
436
|
-
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
437
|
-
<OButton
|
|
438
|
-
onClick={() => handleSaveProduct()}
|
|
439
|
-
imgRightSrc=""
|
|
440
|
-
text={`${orderState.loading
|
|
441
|
-
? t('LOADING', 'Loading')
|
|
442
|
-
: (isSoldOut || maxProductQuantity <= 0)
|
|
443
|
-
? t('SOLD_OUT', 'Sold out')
|
|
444
|
-
: editMode
|
|
445
|
-
? t('UPDATE', 'Update')
|
|
446
|
-
: t('ADD', 'Add')
|
|
447
|
-
}`}
|
|
448
|
-
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))}
|
|
449
|
-
textStyle={{
|
|
450
|
-
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
451
|
-
fontSize: orderState.loading || editMode ? 10 : 14
|
|
452
|
-
}}
|
|
453
|
-
style={{
|
|
454
|
-
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,
|
|
455
|
-
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,
|
|
456
|
-
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
457
|
-
borderRadius: 7.6,
|
|
458
|
-
height: 44,
|
|
459
|
-
shadowOpacity: 0,
|
|
460
|
-
borderWidth: 1,
|
|
461
|
-
marginTop: isHaveWeight ? 10 : 0
|
|
462
|
-
}}
|
|
463
|
-
/>
|
|
464
|
-
)}
|
|
465
|
-
{auth &&
|
|
466
|
-
!orderState.options?.address_id &&
|
|
467
|
-
(orderState.loading ? (
|
|
468
|
-
<OButton
|
|
469
|
-
isDisabled
|
|
470
|
-
text={t('LOADING', 'Loading')}
|
|
471
|
-
imgRightSrc=""
|
|
472
|
-
textStyle={{ fontSize: 10 }}
|
|
473
|
-
/>
|
|
474
|
-
) : (
|
|
475
|
-
<OButton onClick={navigation.navigate('AddressList')} />
|
|
476
|
-
))}
|
|
477
|
-
{!auth && (
|
|
478
|
-
<OButton
|
|
479
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
480
|
-
onClick={() => handleRedirectLogin()}
|
|
481
|
-
text={
|
|
482
|
-
isSoldOut || maxProductQuantity <= 0
|
|
483
|
-
? t('SOLD_OUT', 'Sold out')
|
|
484
|
-
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
485
|
-
}
|
|
486
|
-
imgRightSrc=""
|
|
487
|
-
textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
|
|
488
|
-
style={{
|
|
489
|
-
height: 42,
|
|
490
|
-
borderColor: theme.colors.primary,
|
|
491
|
-
backgroundColor: theme.colors.white,
|
|
492
|
-
paddingLeft: 0,
|
|
493
|
-
paddingRight: 0
|
|
494
|
-
}}
|
|
495
|
-
/>
|
|
496
|
-
)}
|
|
497
|
-
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
498
|
-
<TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
|
|
499
|
-
{actionStatus?.loading ? (
|
|
500
|
-
<Placeholder Animation={Fade}>
|
|
501
|
-
<PlaceholderLine width={60} height={20} />
|
|
502
|
-
</Placeholder>
|
|
503
|
-
) : (
|
|
504
|
-
<OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
|
|
505
|
-
)}
|
|
506
|
-
</TouchableOpacity>
|
|
507
|
-
)}
|
|
508
|
-
</View>
|
|
509
|
-
)
|
|
510
|
-
}
|
|
511
|
-
|
|
512
401
|
useEffect(() => {
|
|
513
402
|
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
514
403
|
scrollViewRef.current.scrollToEnd({ animated: true })
|
|
@@ -524,13 +413,45 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
524
413
|
events.emit('product_viewed', product)
|
|
525
414
|
}, [product?.id, viewedProduct])
|
|
526
415
|
|
|
416
|
+
const actionButtonProps = {
|
|
417
|
+
navigation,
|
|
418
|
+
isHaveWeight,
|
|
419
|
+
isSoldOut,
|
|
420
|
+
maxProductQuantity,
|
|
421
|
+
productCart,
|
|
422
|
+
handleSaveProduct,
|
|
423
|
+
editMode,
|
|
424
|
+
product,
|
|
425
|
+
errors,
|
|
426
|
+
productAddedToCartLength,
|
|
427
|
+
handleRedirectLogin,
|
|
428
|
+
guestCheckoutEnabled,
|
|
429
|
+
orderTypeEnabled,
|
|
430
|
+
handleUpdateGuest,
|
|
431
|
+
actionStatus
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const extraOptionsProps = {
|
|
435
|
+
setSelectedOpt,
|
|
436
|
+
scrollViewRef,
|
|
437
|
+
optionLayout,
|
|
438
|
+
editionsLayoutY,
|
|
439
|
+
styles,
|
|
440
|
+
selOpt
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const suboptionsLength = product?.extras?.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
|
|
444
|
+
|
|
527
445
|
return (
|
|
528
446
|
<SafeAreaView style={{ flex: 1 }}>
|
|
529
447
|
<View style={styles.wrapperNavbar}>
|
|
530
448
|
<TopHeader>
|
|
531
449
|
<>
|
|
532
450
|
<TopActions onPress={() => handleGoBack()}>
|
|
533
|
-
<
|
|
451
|
+
<IconAntDesign
|
|
452
|
+
name='arrowleft'
|
|
453
|
+
size={26}
|
|
454
|
+
/>
|
|
534
455
|
</TopActions>
|
|
535
456
|
{showTitle && (
|
|
536
457
|
<OText
|
|
@@ -547,10 +468,11 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
547
468
|
</TopHeader>
|
|
548
469
|
</View>
|
|
549
470
|
{!error && (
|
|
550
|
-
<
|
|
471
|
+
<IOScrollView
|
|
551
472
|
ref={scrollViewRef}
|
|
552
473
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
553
474
|
stickyHeaderIndices={[2]}
|
|
475
|
+
scrollEventThrottle={100}
|
|
554
476
|
onScroll={handleScroll}
|
|
555
477
|
>
|
|
556
478
|
<WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
|
|
@@ -566,119 +488,123 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
566
488
|
</View>
|
|
567
489
|
) : (
|
|
568
490
|
<>
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
nextButton={
|
|
587
|
-
<View style={styles.swiperButton}>
|
|
588
|
-
<IconAntDesign
|
|
589
|
-
name="caretright"
|
|
590
|
-
color={theme.colors.white}
|
|
591
|
-
size={13}
|
|
592
|
-
// style={styles.starIcon}
|
|
593
|
-
/>
|
|
594
|
-
</View>
|
|
595
|
-
}
|
|
596
|
-
>
|
|
597
|
-
{gallery && gallery?.length > 0 && gallery.map((img, i) => (
|
|
598
|
-
<View
|
|
599
|
-
style={styles.slide1}
|
|
600
|
-
key={i}
|
|
601
|
-
>
|
|
602
|
-
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
603
|
-
<FastImage
|
|
604
|
-
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
605
|
-
source={typeof img !== 'number' ? {
|
|
606
|
-
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
607
|
-
priority: FastImage.priority.normal,
|
|
608
|
-
} : img}
|
|
609
|
-
/>
|
|
610
|
-
) : (
|
|
611
|
-
<>
|
|
612
|
-
<YoutubePlayer
|
|
613
|
-
height={'100%'}
|
|
614
|
-
width={'100%'}
|
|
615
|
-
play={playing}
|
|
616
|
-
videoId={img}
|
|
617
|
-
onChangeState={onStateChange}
|
|
491
|
+
{(product?.images || !hideProductDummyLogo) && (
|
|
492
|
+
<>
|
|
493
|
+
<Swiper
|
|
494
|
+
loop={false}
|
|
495
|
+
ref={swiperRef}
|
|
496
|
+
showsButtons={true}
|
|
497
|
+
style={styles.mainSwiper}
|
|
498
|
+
showsPagination={false}
|
|
499
|
+
onIndexChanged={(index : any) => handleChangeMainIndex(index)}
|
|
500
|
+
prevButton={
|
|
501
|
+
<View style={styles.swiperButton}>
|
|
502
|
+
<IconAntDesign
|
|
503
|
+
name="caretleft"
|
|
504
|
+
color={theme.colors.white}
|
|
505
|
+
size={13}
|
|
506
|
+
// style={styles.starIcon}
|
|
618
507
|
/>
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
paddingHorizontal: 30,
|
|
629
|
-
paddingVertical: 15
|
|
630
|
-
}}
|
|
631
|
-
>
|
|
632
|
-
{gallery?.length > 1 && gallery.map((img, index) => (
|
|
633
|
-
<TouchableOpacity
|
|
634
|
-
key={index}
|
|
635
|
-
onPress={() => handleClickThumb(index)}
|
|
636
|
-
>
|
|
637
|
-
<View
|
|
638
|
-
style={{
|
|
639
|
-
height: 56,
|
|
640
|
-
borderRadius: 8,
|
|
641
|
-
margin: 8,
|
|
642
|
-
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
643
|
-
}}
|
|
644
|
-
>
|
|
645
|
-
{String(img).includes('http') ? (
|
|
646
|
-
<OIcon
|
|
647
|
-
url={img}
|
|
648
|
-
style={{
|
|
649
|
-
borderColor: theme.colors.lightGray,
|
|
650
|
-
borderRadius: 8,
|
|
651
|
-
minHeight: '100%',
|
|
652
|
-
opacity: isSoldOut ? 0.5 : 1
|
|
653
|
-
}}
|
|
654
|
-
width={56}
|
|
655
|
-
height={56}
|
|
656
|
-
cover
|
|
508
|
+
</View>
|
|
509
|
+
}
|
|
510
|
+
nextButton={
|
|
511
|
+
<View style={styles.swiperButton}>
|
|
512
|
+
<IconAntDesign
|
|
513
|
+
name="caretright"
|
|
514
|
+
color={theme.colors.white}
|
|
515
|
+
size={13}
|
|
516
|
+
// style={styles.starIcon}
|
|
657
517
|
/>
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
518
|
+
</View>
|
|
519
|
+
}
|
|
520
|
+
>
|
|
521
|
+
{gallery && gallery?.length > 0 && gallery.map((img : any, i: number) => (
|
|
522
|
+
<View
|
|
523
|
+
style={styles.slide1}
|
|
524
|
+
key={i}
|
|
525
|
+
>
|
|
526
|
+
{(String(img).includes('http') || typeof img === 'number') ? (
|
|
527
|
+
<FastImage
|
|
528
|
+
style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
|
|
529
|
+
source={typeof img !== 'number' ? {
|
|
530
|
+
uri: optimizeImage(img, 'h_1024,c_limit'),
|
|
531
|
+
priority: FastImage.priority.normal,
|
|
532
|
+
} : img}
|
|
533
|
+
/>
|
|
534
|
+
) : (
|
|
535
|
+
<>
|
|
536
|
+
<YoutubePlayer
|
|
537
|
+
height={'100%'}
|
|
538
|
+
width={'100%'}
|
|
539
|
+
play={playing}
|
|
540
|
+
videoId={img}
|
|
541
|
+
onChangeState={onStateChange}
|
|
542
|
+
/>
|
|
543
|
+
<Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
|
|
544
|
+
</>
|
|
545
|
+
)}
|
|
546
|
+
</View>
|
|
547
|
+
))}
|
|
548
|
+
</Swiper>
|
|
549
|
+
<ScrollView
|
|
550
|
+
horizontal
|
|
551
|
+
contentContainerStyle={{
|
|
552
|
+
paddingHorizontal: 20,
|
|
553
|
+
paddingVertical: 15
|
|
554
|
+
}}
|
|
555
|
+
>
|
|
556
|
+
{gallery?.length > 1 && gallery.map((img: any, index: number) => (
|
|
557
|
+
<TouchableOpacity
|
|
558
|
+
key={index}
|
|
559
|
+
onPress={() => handleClickThumb(index)}
|
|
560
|
+
>
|
|
561
|
+
<View
|
|
661
562
|
style={{
|
|
662
|
-
|
|
563
|
+
height: 56,
|
|
663
564
|
borderRadius: 8,
|
|
664
|
-
|
|
665
|
-
opacity:
|
|
565
|
+
margin: 8,
|
|
566
|
+
opacity: index === thumbsSwiper ? 1 : 0.8
|
|
666
567
|
}}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
568
|
+
>
|
|
569
|
+
{String(img).includes('http') ? (
|
|
570
|
+
<OIcon
|
|
571
|
+
url={img}
|
|
572
|
+
style={{
|
|
573
|
+
borderColor: theme.colors.lightGray,
|
|
574
|
+
borderRadius: 8,
|
|
575
|
+
minHeight: '100%',
|
|
576
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
577
|
+
}}
|
|
578
|
+
width={56}
|
|
579
|
+
height={56}
|
|
580
|
+
cover
|
|
581
|
+
/>
|
|
582
|
+
) : (
|
|
583
|
+
<OIcon
|
|
584
|
+
url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
|
|
585
|
+
style={{
|
|
586
|
+
borderColor: theme.colors.lightGray,
|
|
587
|
+
borderRadius: 8,
|
|
588
|
+
minHeight: '100%',
|
|
589
|
+
opacity: isSoldOut ? 0.5 : 1
|
|
590
|
+
}}
|
|
591
|
+
width={56}
|
|
592
|
+
height={56}
|
|
593
|
+
cover
|
|
594
|
+
/>
|
|
595
|
+
)}
|
|
596
|
+
</View>
|
|
597
|
+
</TouchableOpacity>
|
|
674
598
|
|
|
675
|
-
|
|
676
|
-
|
|
599
|
+
))}
|
|
600
|
+
</ScrollView>
|
|
601
|
+
</>
|
|
602
|
+
)}
|
|
677
603
|
</>
|
|
678
604
|
)}
|
|
679
605
|
</WrapHeader>
|
|
680
606
|
<ProductSummary
|
|
681
|
-
ph={
|
|
607
|
+
ph={20}
|
|
682
608
|
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
683
609
|
>
|
|
684
610
|
<ProductTitle>
|
|
@@ -748,6 +674,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
748
674
|
</ProductDescription>
|
|
749
675
|
<ScrollView
|
|
750
676
|
horizontal
|
|
677
|
+
scrollEventThrottle={100}
|
|
751
678
|
showsHorizontalScrollIndicator={false}
|
|
752
679
|
contentContainerStyle={{ paddingBottom: 30 }}
|
|
753
680
|
>
|
|
@@ -775,12 +702,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
775
702
|
{(!loading && product) && (
|
|
776
703
|
<ExtraOptionWrap
|
|
777
704
|
horizontal
|
|
705
|
+
scrollEventThrottle={100}
|
|
778
706
|
showsHorizontalScrollIndicator={false}
|
|
779
707
|
style={{
|
|
780
708
|
marginBottom: 20,
|
|
781
709
|
borderBottomWidth: 1,
|
|
782
710
|
borderBottomColor: theme.colors.border,
|
|
783
|
-
marginHorizontal:
|
|
711
|
+
marginHorizontal: 20,
|
|
784
712
|
backgroundColor: theme.colors.backgroundPage,
|
|
785
713
|
}}
|
|
786
714
|
>
|
|
@@ -809,8 +737,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
809
737
|
</OText>
|
|
810
738
|
</TouchableOpacity>
|
|
811
739
|
)}
|
|
812
|
-
{product?.extras?.map((extra: any) =>
|
|
813
|
-
<ExtraOptions key={extra.id} options={extra.options} />
|
|
740
|
+
{suboptionsLength < 200 && product?.extras?.map((extra: any) =>
|
|
741
|
+
<ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
|
|
814
742
|
)}
|
|
815
743
|
</ExtraOptionWrap>
|
|
816
744
|
)}
|
|
@@ -854,14 +782,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
854
782
|
</>
|
|
855
783
|
) : (
|
|
856
784
|
<ProductEditions
|
|
857
|
-
style={{ paddingHorizontal:
|
|
785
|
+
style={{ paddingHorizontal: 20 }}
|
|
858
786
|
onLayout={(event: any) => {
|
|
859
787
|
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
860
788
|
}}
|
|
861
789
|
>
|
|
862
790
|
<>
|
|
863
791
|
{product?.ingredients?.length > 0 && (
|
|
864
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
|
|
792
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0, true)}>
|
|
865
793
|
<SectionTitle>
|
|
866
794
|
<OText size={16}>
|
|
867
795
|
{t('INGREDIENTS', 'Ingredients')}
|
|
@@ -883,13 +811,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
883
811
|
</View>
|
|
884
812
|
)}
|
|
885
813
|
{product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
886
|
-
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
814
|
+
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => {
|
|
887
815
|
const currentState =
|
|
888
816
|
productCart.options[`id:${option.id}`] || {};
|
|
889
817
|
return (
|
|
890
818
|
<React.Fragment key={`popt_${option.id}`}>
|
|
891
819
|
{showOption(option) && (
|
|
892
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
820
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id, extra.options?.length <= i + 2)}>
|
|
893
821
|
<ProductOption
|
|
894
822
|
option={option}
|
|
895
823
|
currentState={currentState}
|
|
@@ -901,12 +829,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
901
829
|
}}>
|
|
902
830
|
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
903
831
|
(suboption: any) => {
|
|
904
|
-
const currentState =
|
|
905
|
-
productCart.options[
|
|
906
|
-
`id:${option.id}`
|
|
907
|
-
]?.suboptions[
|
|
908
|
-
`id:${suboption.id}`
|
|
909
|
-
] || {};
|
|
832
|
+
const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
|
|
910
833
|
const balance =
|
|
911
834
|
productCart.options[
|
|
912
835
|
`id:${option.id}`
|
|
@@ -921,6 +844,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
921
844
|
balance={balance}
|
|
922
845
|
option={option}
|
|
923
846
|
suboption={suboption}
|
|
847
|
+
image={suboption.image}
|
|
924
848
|
state={currentState}
|
|
925
849
|
disabled={
|
|
926
850
|
isSoldOut ||
|
|
@@ -928,6 +852,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
928
852
|
}
|
|
929
853
|
setIsScrollAvailable={setIsScrollAvailable}
|
|
930
854
|
error={errors[`id:${option.id}`]}
|
|
855
|
+
enableIntersection={suboptionsLength >= 200}
|
|
931
856
|
/>
|
|
932
857
|
);
|
|
933
858
|
},
|
|
@@ -945,7 +870,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
945
870
|
<ProductComment>
|
|
946
871
|
<SectionTitle>
|
|
947
872
|
<OText size={16} weight={'600'} lineHeight={24}>
|
|
948
|
-
{t('
|
|
873
|
+
{t('COMMENTS', 'Special comment')}
|
|
949
874
|
</OText>
|
|
950
875
|
</SectionTitle>
|
|
951
876
|
<OInput
|
|
@@ -959,6 +884,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
959
884
|
!(productCart && !isSoldOut && maxProductQuantity)
|
|
960
885
|
}
|
|
961
886
|
style={styles.comment}
|
|
887
|
+
forwardRef={commentRef}
|
|
962
888
|
/>
|
|
963
889
|
</ProductComment>
|
|
964
890
|
)}
|
|
@@ -967,7 +893,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
967
893
|
{!!error && error?.length > 0 && (
|
|
968
894
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
969
895
|
)}
|
|
970
|
-
</
|
|
896
|
+
</IOScrollView>
|
|
971
897
|
)}
|
|
972
898
|
{!loading && !error && product && (
|
|
973
899
|
<ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
|
|
@@ -1078,9 +1004,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1078
1004
|
)}
|
|
1079
1005
|
</>
|
|
1080
1006
|
)}
|
|
1081
|
-
{!isHaveWeight && <ActionButton />}
|
|
1007
|
+
{!isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1082
1008
|
</View>
|
|
1083
|
-
{isHaveWeight && <ActionButton />}
|
|
1009
|
+
{isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1084
1010
|
</ProductActions>
|
|
1085
1011
|
)}
|
|
1086
1012
|
</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:
|
|
73
|
+
padding-horizontal: 30px;
|
|
74
74
|
padding-vertical: 20px;
|
|
75
75
|
width: 100%;
|
|
76
76
|
flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};
|