ordering-ui-react-native 0.18.2 → 0.18.3-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.
- package/package.json +9 -7
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/BusinessInformation/index.tsx +10 -9
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +0 -20
- package/src/components/PaymentOptionsWebView/index.tsx +29 -8
- package/src/components/PhoneInputNumber/index.tsx +6 -2
- package/src/components/StripeMethodForm/index.tsx +136 -102
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +3 -2
- package/src/types/index.tsx +5 -0
- package/src/utils/index.tsx +7 -2
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
- 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 +163 -123
- package/themes/business/src/components/DriverMap/index.tsx +17 -6
- 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 +58 -57
- package/themes/business/src/components/LoginForm/index.tsx +5 -2
- package/themes/business/src/components/MapView/index.tsx +14 -10
- package/themes/business/src/components/MessagesOption/index.tsx +22 -94
- package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
- package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
- package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
- package/themes/business/src/components/OrderDetails/Delivery.tsx +205 -12
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +67 -39
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +47 -23
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +9 -4
- package/themes/business/src/components/OrderMessage/index.tsx +1 -1
- package/themes/business/src/components/OrderSummary/index.tsx +114 -123
- 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 +43 -32
- 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 +21 -29
- 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 +193 -221
- package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
- package/themes/business/src/components/ReviewCustomer/index.tsx +3 -1
- package/themes/business/src/components/SearchBar/index.tsx +2 -1
- package/themes/business/src/components/StoresList/index.tsx +6 -5
- package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
- 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/OModal.tsx +16 -9
- package/themes/business/src/types/index.tsx +8 -0
- package/themes/business/src/utils/index.tsx +4 -4
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/Intro/index.tsx +16 -1
- package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/original/index.tsx +7 -3
- package/themes/original/src/components/AddressDetails/index.tsx +19 -3
- package/themes/original/src/components/AddressForm/index.tsx +33 -15
- package/themes/original/src/components/AddressForm/styles.tsx +1 -1
- package/themes/original/src/components/AddressList/index.tsx +5 -8
- package/themes/original/src/components/AddressList/styles.tsx +4 -4
- package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +74 -38
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +11 -13
- package/themes/original/src/components/BusinessController/index.tsx +35 -44
- package/themes/original/src/components/BusinessController/styles.tsx +12 -5
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
- package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +25 -26
- 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 +133 -438
- package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -19
- package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
- package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
- package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
- package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
- package/themes/original/src/components/BusinessProductsListing/index.tsx +162 -39
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +4 -5
- package/themes/original/src/components/BusinessReviews/index.tsx +4 -2
- 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 +37 -404
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
- package/themes/original/src/components/Cart/index.tsx +49 -47
- package/themes/original/src/components/CartContent/index.tsx +99 -38
- package/themes/original/src/components/CartContent/styles.tsx +6 -6
- package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
- package/themes/original/src/components/Checkout/index.tsx +324 -43
- package/themes/original/src/components/Checkout/styles.tsx +17 -0
- package/themes/original/src/components/CitiesControl/index.tsx +1 -1
- package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DatePicker/index.tsx +17 -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 +4 -9
- 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/GPSButton/index.tsx +7 -5
- package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
- package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +3 -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/styles.tsx +1 -1
- package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
- package/themes/original/src/components/GoogleMap/index.tsx +63 -7
- 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 +14 -5
- 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 +91 -25
- package/themes/original/src/components/LoginForm/index.tsx +64 -34
- package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
- package/themes/original/src/components/MessageListing/index.tsx +9 -2
- package/themes/original/src/components/Messages/index.tsx +15 -4
- package/themes/original/src/components/Messages/styles.tsx +1 -1
- package/themes/original/src/components/MomentOption/index.tsx +9 -10
- 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 +161 -49
- package/themes/original/src/components/MultiCheckout/index.tsx +348 -70
- package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
- package/themes/original/src/components/MyOrders/index.tsx +16 -5
- package/themes/original/src/components/NavBar/index.tsx +20 -13
- 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/NotFoundSource/index.tsx +14 -10
- package/themes/original/src/components/Notifications/index.tsx +4 -8
- package/themes/original/src/components/Notifications/styles.tsx +0 -1
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
- package/themes/original/src/components/OrderDetails/OrderHistory.tsx +22 -6
- package/themes/original/src/components/OrderDetails/index.tsx +721 -670
- package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
- package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
- package/themes/original/src/components/OrderProgress/index.tsx +34 -25
- package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
- package/themes/original/src/components/OrderSummary/index.tsx +62 -57
- package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
- package/themes/original/src/components/OrdersOption/index.tsx +44 -21
- package/themes/original/src/components/OrdersOption/styles.tsx +2 -2
- package/themes/original/src/components/PageBanner/index.tsx +65 -29
- package/themes/original/src/components/PageBanner/styles.tsx +0 -3
- package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
- package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
- package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
- package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
- package/themes/original/src/components/ProductForm/index.tsx +106 -170
- package/themes/original/src/components/ProductForm/styles.tsx +3 -3
- package/themes/original/src/components/ProductItemAccordion/index.tsx +13 -6
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
- 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 +6 -6
- package/themes/original/src/components/Promotions/styles.tsx +3 -3
- package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
- package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
- package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
- 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/SignupForm/index.tsx +27 -16
- package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
- package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
- package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
- package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
- package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
- package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
- package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
- package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
- package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
- package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
- package/themes/original/src/components/UpsellingProducts/index.tsx +16 -205
- package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
- package/themes/original/src/components/UserDetails/index.tsx +3 -1
- package/themes/original/src/components/UserFormDetails/index.tsx +100 -22
- package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
- package/themes/original/src/components/UserProfile/index.tsx +8 -26
- package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
- 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/index.tsx +3 -3
- package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
- package/themes/original/src/components/Wallets/index.tsx +48 -60
- package/themes/original/src/components/Wallets/styles.tsx +3 -4
- package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +3 -3
- package/themes/original/src/components/shared/OInput.tsx +4 -5
- package/themes/original/src/components/shared/OModal.tsx +15 -17
- package/themes/original/src/layouts/Container.tsx +5 -3
- package/themes/original/src/types/index.tsx +28 -6
- package/themes/original/src/utils/index.tsx +180 -13
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
- 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
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
I18nManager,
|
|
10
10
|
SafeAreaView,
|
|
11
11
|
Platform,
|
|
12
|
-
Button
|
|
13
|
-
Vibration
|
|
12
|
+
Button
|
|
14
13
|
} from 'react-native';
|
|
15
14
|
import {
|
|
16
15
|
ProductForm as ProductOptions,
|
|
@@ -20,7 +19,8 @@ import {
|
|
|
20
19
|
useUtils,
|
|
21
20
|
ToastType,
|
|
22
21
|
useToast,
|
|
23
|
-
useConfig
|
|
22
|
+
useConfig,
|
|
23
|
+
useEvent
|
|
24
24
|
} from 'ordering-components/native';
|
|
25
25
|
import uuid from 'react-native-uuid';
|
|
26
26
|
import { useTheme } from 'styled-components/native';
|
|
@@ -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,
|
|
@@ -55,8 +56,12 @@ import { NotFoundSource } from '../NotFoundSource';
|
|
|
55
56
|
import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
|
|
56
57
|
import NavBar from '../NavBar';
|
|
57
58
|
import { orderTypeList } from '../../utils';
|
|
59
|
+
import { ActionButton } from './ActionButton'
|
|
60
|
+
import { ExtraOptions } from './ExtraOptions'
|
|
58
61
|
const windowWidth = Dimensions.get('window').width;
|
|
59
62
|
|
|
63
|
+
|
|
64
|
+
|
|
60
65
|
export const ProductOptionsUI = (props: any) => {
|
|
61
66
|
const {
|
|
62
67
|
navigation,
|
|
@@ -78,10 +83,10 @@ 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()
|
|
89
|
+
const commentRef = useRef()
|
|
85
90
|
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
86
91
|
|
|
87
92
|
const styles = StyleSheet.create({
|
|
@@ -135,7 +140,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
135
140
|
},
|
|
136
141
|
slide1: {
|
|
137
142
|
flex: 1,
|
|
138
|
-
alignItems: 'center'
|
|
143
|
+
alignItems: 'center',
|
|
144
|
+
width: '100%'
|
|
139
145
|
},
|
|
140
146
|
mainSwiper: {
|
|
141
147
|
height: 258,
|
|
@@ -174,7 +180,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
174
180
|
marginTop: 10
|
|
175
181
|
},
|
|
176
182
|
wrapperNavbar: {
|
|
177
|
-
paddingHorizontal:
|
|
183
|
+
paddingHorizontal: 20,
|
|
178
184
|
paddingTop: 0,
|
|
179
185
|
}
|
|
180
186
|
});
|
|
@@ -203,9 +209,19 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
203
209
|
const [summaryRefHeight, setSummaryRefHeight] = useState(0)
|
|
204
210
|
const [isScrollAvailable, setIsScrollAvailable] = useState(null)
|
|
205
211
|
const [editionsLayoutY, setEditionsLayoutY] = useState(null)
|
|
206
|
-
|
|
212
|
+
const [viewedProduct, setViewedProduct] = useState<any>(null)
|
|
213
|
+
const [showTitle, setShowTitle] = useState(false)
|
|
214
|
+
const productOptionsMounted = useRef(false)
|
|
207
215
|
const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
|
|
208
|
-
|
|
216
|
+
const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
|
|
217
|
+
|
|
218
|
+
const vibrateApp = (impact?: string) => {
|
|
219
|
+
const options = {
|
|
220
|
+
enableVibrateFallback: true,
|
|
221
|
+
ignoreAndroidSystemSettings: false
|
|
222
|
+
};
|
|
223
|
+
ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
|
|
224
|
+
}
|
|
209
225
|
|
|
210
226
|
const isError = (id: number) => {
|
|
211
227
|
let bgColor = theme.colors.white;
|
|
@@ -222,7 +238,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
222
238
|
};
|
|
223
239
|
|
|
224
240
|
const handleSaveProduct = () => {
|
|
225
|
-
|
|
241
|
+
vibrateApp()
|
|
226
242
|
if (!productCart.quantity) {
|
|
227
243
|
showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
|
|
228
244
|
return
|
|
@@ -308,63 +324,19 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
308
324
|
if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
|
|
309
325
|
}
|
|
310
326
|
|
|
311
|
-
|
|
312
|
-
|
|
327
|
+
let _optionLayout: any = {}
|
|
328
|
+
|
|
329
|
+
const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
|
|
330
|
+
_optionLayout = { ..._optionLayout }
|
|
313
331
|
const optionKey = 'id:' + optionId
|
|
314
332
|
_optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
|
|
315
|
-
|
|
333
|
+
if (lastMounts) {
|
|
334
|
+
setOptionLayout(_optionLayout)
|
|
335
|
+
}
|
|
316
336
|
}
|
|
317
337
|
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
maxProductQuantity === 0 ||
|
|
321
|
-
Object.keys(errors)?.length > 0;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
const ExtraOptions = ({ eID, options }: any) => (
|
|
325
|
-
<>
|
|
326
|
-
{options.map(({ id, name, respect_to, suboptions }: any) => (
|
|
327
|
-
<React.Fragment key={`cont_key_${id}`}>
|
|
328
|
-
{respect_to == null && suboptions?.length > 0 && (
|
|
329
|
-
<TouchableOpacity
|
|
330
|
-
key={`eopt_key_${id}`}
|
|
331
|
-
onPress={() => {
|
|
332
|
-
setSelectedOpt(id)
|
|
333
|
-
scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
|
|
334
|
-
y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
|
|
335
|
-
animated: true
|
|
336
|
-
})
|
|
337
|
-
}}
|
|
338
|
-
style={[
|
|
339
|
-
styles.extraItem,
|
|
340
|
-
{
|
|
341
|
-
borderBottomColor:
|
|
342
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
|
|
343
|
-
},
|
|
344
|
-
]}>
|
|
345
|
-
<OText
|
|
346
|
-
color={
|
|
347
|
-
selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
|
|
348
|
-
}
|
|
349
|
-
size={12}
|
|
350
|
-
weight={selOpt == id ? '600' : 'normal'}
|
|
351
|
-
style={{ maxWidth: 150 }}
|
|
352
|
-
numberOfLines={1}>
|
|
353
|
-
{name}
|
|
354
|
-
</OText>
|
|
355
|
-
</TouchableOpacity>
|
|
356
|
-
)}
|
|
357
|
-
</React.Fragment>
|
|
358
|
-
))}
|
|
359
|
-
</>
|
|
360
|
-
);
|
|
361
|
-
|
|
362
|
-
const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
|
|
363
|
-
|
|
364
|
-
const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
|
|
365
|
-
if (_topOption) {
|
|
366
|
-
const _topOptionId = Number(_topOption.replace('id:', ''))
|
|
367
|
-
}
|
|
338
|
+
const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
|
|
339
|
+
setShowTitle(contentOffset.y > 30)
|
|
368
340
|
}
|
|
369
341
|
|
|
370
342
|
const handleGoBack = navigation?.canGoBack()
|
|
@@ -422,90 +394,6 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
422
394
|
}
|
|
423
395
|
}, [product])
|
|
424
396
|
|
|
425
|
-
const ActionButton = () => {
|
|
426
|
-
return (
|
|
427
|
-
<View
|
|
428
|
-
style={{
|
|
429
|
-
width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
|
|
430
|
-
}}>
|
|
431
|
-
{((productCart &&
|
|
432
|
-
auth &&
|
|
433
|
-
orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
|
|
434
|
-
<OButton
|
|
435
|
-
onClick={() => handleSaveProduct()}
|
|
436
|
-
imgRightSrc=""
|
|
437
|
-
text={`${orderState.loading
|
|
438
|
-
? t('LOADING', 'Loading')
|
|
439
|
-
: (isSoldOut || maxProductQuantity <= 0)
|
|
440
|
-
? t('SOLD_OUT', 'Sold out')
|
|
441
|
-
: editMode
|
|
442
|
-
? t('UPDATE', 'Update')
|
|
443
|
-
: t('ADD', 'Add')
|
|
444
|
-
}`}
|
|
445
|
-
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))}
|
|
446
|
-
textStyle={{
|
|
447
|
-
color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
|
|
448
|
-
fontSize: orderState.loading || editMode ? 10 : 14
|
|
449
|
-
}}
|
|
450
|
-
style={{
|
|
451
|
-
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,
|
|
452
|
-
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,
|
|
453
|
-
opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
|
|
454
|
-
borderRadius: 7.6,
|
|
455
|
-
height: 44,
|
|
456
|
-
shadowOpacity: 0,
|
|
457
|
-
borderWidth: 1,
|
|
458
|
-
marginTop: isHaveWeight ? 10 : 0
|
|
459
|
-
}}
|
|
460
|
-
/>
|
|
461
|
-
)}
|
|
462
|
-
{auth &&
|
|
463
|
-
!orderState.options?.address_id &&
|
|
464
|
-
(orderState.loading ? (
|
|
465
|
-
<OButton
|
|
466
|
-
isDisabled
|
|
467
|
-
text={t('LOADING', 'Loading')}
|
|
468
|
-
imgRightSrc=""
|
|
469
|
-
textStyle={{ fontSize: 10 }}
|
|
470
|
-
/>
|
|
471
|
-
) : (
|
|
472
|
-
<OButton onClick={navigation.navigate('AddressList')} />
|
|
473
|
-
))}
|
|
474
|
-
{!auth && (
|
|
475
|
-
<OButton
|
|
476
|
-
isDisabled={isSoldOut || maxProductQuantity <= 0}
|
|
477
|
-
onClick={() => handleRedirectLogin()}
|
|
478
|
-
text={
|
|
479
|
-
isSoldOut || maxProductQuantity <= 0
|
|
480
|
-
? t('SOLD_OUT', 'Sold out')
|
|
481
|
-
: t('LOGIN_SIGNUP', 'Login / Sign Up')
|
|
482
|
-
}
|
|
483
|
-
imgRightSrc=""
|
|
484
|
-
textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
|
|
485
|
-
style={{
|
|
486
|
-
height: 42,
|
|
487
|
-
borderColor: theme.colors.primary,
|
|
488
|
-
backgroundColor: theme.colors.white,
|
|
489
|
-
paddingLeft: 0,
|
|
490
|
-
paddingRight: 0
|
|
491
|
-
}}
|
|
492
|
-
/>
|
|
493
|
-
)}
|
|
494
|
-
{!auth && guestCheckoutEnabled && orderTypeEnabled && (
|
|
495
|
-
<TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
|
|
496
|
-
{actionStatus?.loading ? (
|
|
497
|
-
<Placeholder Animation={Fade}>
|
|
498
|
-
<PlaceholderLine width={60} height={20} />
|
|
499
|
-
</Placeholder>
|
|
500
|
-
) : (
|
|
501
|
-
<OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
|
|
502
|
-
)}
|
|
503
|
-
</TouchableOpacity>
|
|
504
|
-
)}
|
|
505
|
-
</View>
|
|
506
|
-
)
|
|
507
|
-
}
|
|
508
|
-
|
|
509
397
|
useEffect(() => {
|
|
510
398
|
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
|
|
511
399
|
scrollViewRef.current.scrollToEnd({ animated: true })
|
|
@@ -515,21 +403,70 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
515
403
|
}
|
|
516
404
|
}, [])
|
|
517
405
|
|
|
406
|
+
useEffect(() => {
|
|
407
|
+
if (!product?.id || product?.id === viewedProduct?.id) return
|
|
408
|
+
setViewedProduct(product)
|
|
409
|
+
events.emit('product_viewed', product)
|
|
410
|
+
}, [product?.id, viewedProduct])
|
|
411
|
+
|
|
412
|
+
const actionButtonProps = {
|
|
413
|
+
navigation,
|
|
414
|
+
isHaveWeight,
|
|
415
|
+
isSoldOut,
|
|
416
|
+
maxProductQuantity,
|
|
417
|
+
productCart,
|
|
418
|
+
handleSaveProduct,
|
|
419
|
+
editMode,
|
|
420
|
+
product,
|
|
421
|
+
errors,
|
|
422
|
+
productAddedToCartLength,
|
|
423
|
+
handleRedirectLogin,
|
|
424
|
+
guestCheckoutEnabled,
|
|
425
|
+
orderTypeEnabled,
|
|
426
|
+
handleUpdateGuest,
|
|
427
|
+
actionStatus
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
const extraOptionsProps = {
|
|
431
|
+
setSelectedOpt,
|
|
432
|
+
scrollViewRef,
|
|
433
|
+
optionLayout,
|
|
434
|
+
editionsLayoutY,
|
|
435
|
+
styles,
|
|
436
|
+
selOpt
|
|
437
|
+
}
|
|
438
|
+
|
|
518
439
|
return (
|
|
519
440
|
<SafeAreaView style={{ flex: 1 }}>
|
|
520
441
|
<View style={styles.wrapperNavbar}>
|
|
521
|
-
<
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
442
|
+
<TopHeader>
|
|
443
|
+
<>
|
|
444
|
+
<TopActions onPress={() => handleGoBack()}>
|
|
445
|
+
<IconAntDesign
|
|
446
|
+
name='arrowleft'
|
|
447
|
+
size={26}
|
|
448
|
+
/>
|
|
449
|
+
</TopActions>
|
|
450
|
+
{showTitle && (
|
|
451
|
+
<OText
|
|
452
|
+
size={16}
|
|
453
|
+
style={{ flex: 1, textAlign: 'center' }}
|
|
454
|
+
weight={Platform.OS === 'ios' ? '600' : 'bold'}
|
|
455
|
+
numberOfLines={2}
|
|
456
|
+
ellipsizeMode='tail'
|
|
457
|
+
>
|
|
458
|
+
{product?.name}
|
|
459
|
+
</OText>
|
|
460
|
+
)}
|
|
461
|
+
</>
|
|
462
|
+
</TopHeader>
|
|
527
463
|
</View>
|
|
528
464
|
{!error && (
|
|
529
465
|
<ScrollView
|
|
530
466
|
ref={scrollViewRef}
|
|
531
467
|
contentContainerStyle={{ paddingBottom: 80 }}
|
|
532
468
|
stickyHeaderIndices={[2]}
|
|
469
|
+
scrollEventThrottle={100}
|
|
533
470
|
onScroll={handleScroll}
|
|
534
471
|
>
|
|
535
472
|
<WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
|
|
@@ -604,7 +541,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
604
541
|
<ScrollView
|
|
605
542
|
horizontal
|
|
606
543
|
contentContainerStyle={{
|
|
607
|
-
paddingHorizontal:
|
|
544
|
+
paddingHorizontal: 20,
|
|
608
545
|
paddingVertical: 15
|
|
609
546
|
}}
|
|
610
547
|
>
|
|
@@ -657,7 +594,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
657
594
|
)}
|
|
658
595
|
</WrapHeader>
|
|
659
596
|
<ProductSummary
|
|
660
|
-
ph={
|
|
597
|
+
ph={20}
|
|
661
598
|
onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
|
|
662
599
|
>
|
|
663
600
|
<ProductTitle>
|
|
@@ -727,6 +664,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
727
664
|
</ProductDescription>
|
|
728
665
|
<ScrollView
|
|
729
666
|
horizontal
|
|
667
|
+
scrollEventThrottle={100}
|
|
730
668
|
showsHorizontalScrollIndicator={false}
|
|
731
669
|
contentContainerStyle={{ paddingBottom: 30 }}
|
|
732
670
|
>
|
|
@@ -754,12 +692,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
754
692
|
{(!loading && product) && (
|
|
755
693
|
<ExtraOptionWrap
|
|
756
694
|
horizontal
|
|
695
|
+
scrollEventThrottle={100}
|
|
757
696
|
showsHorizontalScrollIndicator={false}
|
|
758
697
|
style={{
|
|
759
698
|
marginBottom: 20,
|
|
760
699
|
borderBottomWidth: 1,
|
|
761
700
|
borderBottomColor: theme.colors.border,
|
|
762
|
-
marginHorizontal:
|
|
701
|
+
marginHorizontal: 20,
|
|
763
702
|
backgroundColor: theme.colors.backgroundPage,
|
|
764
703
|
}}
|
|
765
704
|
>
|
|
@@ -789,7 +728,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
789
728
|
</TouchableOpacity>
|
|
790
729
|
)}
|
|
791
730
|
{product?.extras?.map((extra: any) =>
|
|
792
|
-
<ExtraOptions key={extra.id} options={extra.options} />
|
|
731
|
+
<ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
|
|
793
732
|
)}
|
|
794
733
|
</ExtraOptionWrap>
|
|
795
734
|
)}
|
|
@@ -833,14 +772,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
833
772
|
</>
|
|
834
773
|
) : (
|
|
835
774
|
<ProductEditions
|
|
836
|
-
style={{ paddingHorizontal:
|
|
775
|
+
style={{ paddingHorizontal: 20 }}
|
|
837
776
|
onLayout={(event: any) => {
|
|
838
777
|
setEditionsLayoutY(event.nativeEvent.layout?.y)
|
|
839
778
|
}}
|
|
840
779
|
>
|
|
841
780
|
<>
|
|
842
781
|
{product?.ingredients?.length > 0 && (
|
|
843
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
|
|
782
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0, true)}>
|
|
844
783
|
<SectionTitle>
|
|
845
784
|
<OText size={16}>
|
|
846
785
|
{t('INGREDIENTS', 'Ingredients')}
|
|
@@ -862,13 +801,13 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
862
801
|
</View>
|
|
863
802
|
)}
|
|
864
803
|
{product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
865
|
-
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
804
|
+
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => {
|
|
866
805
|
const currentState =
|
|
867
806
|
productCart.options[`id:${option.id}`] || {};
|
|
868
807
|
return (
|
|
869
808
|
<React.Fragment key={`popt_${option.id}`}>
|
|
870
809
|
{showOption(option) && (
|
|
871
|
-
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
|
|
810
|
+
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id, extra.options?.length <= i + 2)}>
|
|
872
811
|
<ProductOption
|
|
873
812
|
option={option}
|
|
874
813
|
currentState={currentState}
|
|
@@ -880,12 +819,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
880
819
|
}}>
|
|
881
820
|
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
882
821
|
(suboption: any) => {
|
|
883
|
-
const currentState =
|
|
884
|
-
productCart.options[
|
|
885
|
-
`id:${option.id}`
|
|
886
|
-
]?.suboptions[
|
|
887
|
-
`id:${suboption.id}`
|
|
888
|
-
] || {};
|
|
822
|
+
const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
|
|
889
823
|
const balance =
|
|
890
824
|
productCart.options[
|
|
891
825
|
`id:${option.id}`
|
|
@@ -900,6 +834,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
900
834
|
balance={balance}
|
|
901
835
|
option={option}
|
|
902
836
|
suboption={suboption}
|
|
837
|
+
image={suboption.image}
|
|
903
838
|
state={currentState}
|
|
904
839
|
disabled={
|
|
905
840
|
isSoldOut ||
|
|
@@ -924,7 +859,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
924
859
|
<ProductComment>
|
|
925
860
|
<SectionTitle>
|
|
926
861
|
<OText size={16} weight={'600'} lineHeight={24}>
|
|
927
|
-
{t('
|
|
862
|
+
{t('COMMENTS', 'Special comment')}
|
|
928
863
|
</OText>
|
|
929
864
|
</SectionTitle>
|
|
930
865
|
<OInput
|
|
@@ -938,6 +873,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
938
873
|
!(productCart && !isSoldOut && maxProductQuantity)
|
|
939
874
|
}
|
|
940
875
|
style={styles.comment}
|
|
876
|
+
forwardRef={commentRef}
|
|
941
877
|
/>
|
|
942
878
|
</ProductComment>
|
|
943
879
|
)}
|
|
@@ -1057,9 +993,9 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
1057
993
|
)}
|
|
1058
994
|
</>
|
|
1059
995
|
)}
|
|
1060
|
-
{!isHaveWeight && <ActionButton />}
|
|
996
|
+
{!isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1061
997
|
</View>
|
|
1062
|
-
{isHaveWeight && <ActionButton />}
|
|
998
|
+
{isHaveWeight && <ActionButton {...actionButtonProps} />}
|
|
1063
999
|
</ProductActions>
|
|
1064
1000
|
)}
|
|
1065
1001
|
</SafeAreaView>
|
|
@@ -8,8 +8,8 @@ export const WrapHeader = styled.View`
|
|
|
8
8
|
export const TopActions = styled.TouchableOpacity`
|
|
9
9
|
height: 60px;
|
|
10
10
|
justify-content: center;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
min-width: 30px;
|
|
12
|
+
padding-right: 15px;
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
15
|
export const TopHeader = styled.View`
|
|
@@ -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'};
|
|
@@ -77,6 +77,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
77
77
|
const [isServiceOpen, setIsServiceOpen] = useState(false)
|
|
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())
|
|
80
81
|
|
|
81
82
|
const productInfo = () => {
|
|
82
83
|
if (isCartProduct) {
|
|
@@ -107,19 +108,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
107
108
|
/* const toggleAccordion = () => {
|
|
108
109
|
if ((!product?.valid_menu && isCartProduct)) return
|
|
109
110
|
if (isActive) {
|
|
110
|
-
|
|
111
|
+
Animated.timing(setHeight.height, {
|
|
111
112
|
toValue: 100,
|
|
112
113
|
duration: 500,
|
|
113
114
|
easing: Easing.linear,
|
|
114
115
|
useNativeDriver: false,
|
|
115
|
-
|
|
116
|
+
}).start()
|
|
116
117
|
} else {
|
|
117
|
-
|
|
118
|
+
setHeightState({height: new Animated.Value(0)})
|
|
118
119
|
}
|
|
119
120
|
}*/
|
|
120
121
|
|
|
121
122
|
const handleChangeQuantity = (value: string) => {
|
|
122
123
|
if (!orderState.loading) {
|
|
124
|
+
setProductQuantity(value)
|
|
123
125
|
if (parseInt(value) === 0) {
|
|
124
126
|
onDeleteProduct && onDeleteProduct(product)
|
|
125
127
|
} else {
|
|
@@ -134,7 +136,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
/*useEffect(() => {
|
|
137
|
-
|
|
139
|
+
toggleAccordion()
|
|
138
140
|
}, [isActive])*/
|
|
139
141
|
|
|
140
142
|
const productOptions = getProductMax && [...Array(getProductMax(product) + 1),].map((_: any, opt: number) => {
|
|
@@ -209,10 +211,15 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
209
211
|
<RNPickerSelect
|
|
210
212
|
items={productOptions}
|
|
211
213
|
onValueChange={handleChangeQuantity}
|
|
212
|
-
value={
|
|
214
|
+
value={productQuantity}
|
|
213
215
|
style={pickerStyle}
|
|
214
216
|
useNativeAndroidPickerStyle={false}
|
|
215
217
|
placeholder={{}}
|
|
218
|
+
touchableWrapperProps={{
|
|
219
|
+
style: {
|
|
220
|
+
width: 40,
|
|
221
|
+
}
|
|
222
|
+
}}
|
|
216
223
|
Icon={() => <View style={pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} /></View>}
|
|
217
224
|
disabled={orderState.loading}
|
|
218
225
|
/>
|
|
@@ -287,7 +294,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
|
|
|
287
294
|
)}
|
|
288
295
|
{productInfo().options.length > 0 && (
|
|
289
296
|
<ProductOptionsList>
|
|
290
|
-
{productInfo().options.map((option: any, i: number) => (
|
|
297
|
+
{productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => (
|
|
291
298
|
<ProductOption key={option.id + i}>
|
|
292
299
|
<OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
|
|
293
300
|
{option.suboptions.map((suboption: any) => (
|