ordering-ui-react-native 0.17.0 → 0.17.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.
- package/package.json +5 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +11 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/StripeMethodForm/index.tsx +1 -1
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +7 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +0 -1
- package/themes/business/src/components/Chat/index.tsx +118 -107
- package/themes/business/src/components/DriverMap/index.tsx +22 -9
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +238 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +18 -7
- package/themes/business/src/components/NewOrderNotification/index.tsx +33 -43
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +18 -17
- package/themes/business/src/components/OrderSummary/index.tsx +113 -121
- package/themes/business/src/components/OrdersOption/index.tsx +33 -75
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +33 -2
- package/themes/business/src/utils/index.tsx +51 -0
- 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/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- 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 +3 -2
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +29 -11
- package/themes/original/src/components/AddressForm/index.tsx +152 -117
- package/themes/original/src/components/AddressList/index.tsx +26 -21
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
- package/themes/original/src/components/BusinessController/index.tsx +145 -68
- package/themes/original/src/components/BusinessController/styles.tsx +22 -9
- 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 +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
- package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
- package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -490
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
- package/themes/original/src/components/Cart/index.tsx +87 -43
- package/themes/original/src/components/CartContent/index.tsx +77 -15
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +294 -175
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +70 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -16
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -25
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +43 -19
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +32 -10
- package/themes/original/src/components/MomentOption/index.tsx +195 -88
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
- package/themes/original/src/components/MultiCheckout/index.tsx +247 -83
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +66 -17
- package/themes/original/src/components/NavBar/index.tsx +6 -11
- package/themes/original/src/components/NotFoundSource/index.tsx +1 -1
- package/themes/original/src/components/Notifications/index.tsx +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
- package/themes/original/src/components/OrderDetails/index.tsx +110 -221
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
- package/themes/original/src/components/OrderProgress/index.tsx +74 -112
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +66 -29
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +76 -83
- package/themes/original/src/components/PageBanner/index.tsx +171 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
- package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +240 -261
- package/themes/original/src/components/ProductForm/styles.tsx +4 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +10 -3
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +377 -270
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +79 -66
- package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +111 -49
- package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +8 -4
- package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/Wallets/index.tsx +20 -19
- package/themes/original/src/components/Wallets/styles.tsx +2 -0
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +45 -7
- package/themes/original/src/utils/index.tsx +364 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
useToast,
|
|
17
17
|
ToastType
|
|
18
18
|
} from 'ordering-components/native';
|
|
19
|
+
import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
|
|
20
|
+
|
|
19
21
|
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
|
|
20
22
|
import Spinner from 'react-native-loading-spinner-overlay';
|
|
21
23
|
import { useForm, Controller } from 'react-hook-form';
|
|
@@ -38,6 +40,8 @@ import {
|
|
|
38
40
|
import { GPSButton } from '../GPSButton';
|
|
39
41
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
40
42
|
|
|
43
|
+
const { useDeviceOrientation } = DeviceOrientationMethods
|
|
44
|
+
|
|
41
45
|
const inputNames = [
|
|
42
46
|
{ name: 'address', code: 'Address' },
|
|
43
47
|
{ name: 'internal_number', code: 'Internal number' },
|
|
@@ -58,12 +62,17 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
58
62
|
saveAddress,
|
|
59
63
|
isGuestUser,
|
|
60
64
|
isRequiredField,
|
|
65
|
+
showField,
|
|
61
66
|
isFromProductsList,
|
|
62
67
|
hasAddressDefault,
|
|
63
68
|
afterSignup,
|
|
69
|
+
businessSlug
|
|
64
70
|
} = props;
|
|
65
71
|
|
|
66
72
|
const theme = useTheme();
|
|
73
|
+
const [orientationState] = useDeviceOrientation();
|
|
74
|
+
|
|
75
|
+
const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
|
|
67
76
|
|
|
68
77
|
const tagsName = [
|
|
69
78
|
{ icon: theme.images.general.tag_home, value: 'home' },
|
|
@@ -72,6 +81,8 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
72
81
|
{ icon: theme.images.general.tag_plus, value: 'other' },
|
|
73
82
|
];
|
|
74
83
|
|
|
84
|
+
const HEIGHT_SCREEN = orientationState?.dimensions?.height
|
|
85
|
+
|
|
75
86
|
const styles = StyleSheet.create({
|
|
76
87
|
iconContainer: {
|
|
77
88
|
display: 'flex',
|
|
@@ -82,7 +93,6 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
82
93
|
backgroundColor: theme.colors.clear
|
|
83
94
|
},
|
|
84
95
|
inputsStyle: {
|
|
85
|
-
borderColor: theme.colors.border,
|
|
86
96
|
borderRadius: 10,
|
|
87
97
|
marginBottom: 20,
|
|
88
98
|
height: 50,
|
|
@@ -91,7 +101,6 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
91
101
|
flex: 1,
|
|
92
102
|
},
|
|
93
103
|
textAreaStyles: {
|
|
94
|
-
borderColor: theme.colors.border,
|
|
95
104
|
borderRadius: 10,
|
|
96
105
|
marginBottom: 20,
|
|
97
106
|
height: 104,
|
|
@@ -105,6 +114,12 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
105
114
|
end: 0,
|
|
106
115
|
top: 12,
|
|
107
116
|
zIndex: 1002,
|
|
117
|
+
right: autoCompleteInputFocused && (
|
|
118
|
+
!!address?.address ||
|
|
119
|
+
!!formState.changes?.address ||
|
|
120
|
+
!!addressState.address.address
|
|
121
|
+
) ? 30 : 15,
|
|
122
|
+
width: 16
|
|
108
123
|
},
|
|
109
124
|
wrapperNavbar: Platform.OS === 'ios'
|
|
110
125
|
? { paddingVertical: 0, paddingHorizontal: 40 }
|
|
@@ -153,8 +168,10 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
153
168
|
'true';
|
|
154
169
|
const maxLimitLocation =
|
|
155
170
|
configState?.configs?.meters_to_change_address?.value;
|
|
156
|
-
|
|
157
|
-
const
|
|
171
|
+
const countryCode = configState?.configs?.country_autocomplete?.value
|
|
172
|
+
const isHideMap = theme?.address?.components?.map?.hidden
|
|
173
|
+
const isHideIcons = theme?.address?.components?.icons?.hidden
|
|
174
|
+
const continueAsGuest = () => navigation.navigate(!!businessSlug ? 'Business' : 'BusinessList', { isGuestUser: true });
|
|
158
175
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
159
176
|
|
|
160
177
|
const getAddressFormatted = (address: any) => {
|
|
@@ -356,7 +373,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
356
373
|
if (
|
|
357
374
|
orderState.loading &&
|
|
358
375
|
!addressesList &&
|
|
359
|
-
orderState
|
|
376
|
+
orderState?.options?.address &&
|
|
360
377
|
auth &&
|
|
361
378
|
!afterSignup
|
|
362
379
|
) {
|
|
@@ -364,7 +381,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
364
381
|
? navigation.navigate('BottomTab')
|
|
365
382
|
: navigation.navigate('Business');
|
|
366
383
|
}
|
|
367
|
-
}, [orderState
|
|
384
|
+
}, [orderState?.options?.address]);
|
|
368
385
|
|
|
369
386
|
useEffect(() => {
|
|
370
387
|
if (alertState.open && alertState?.key !== 'ERROR_MAX_LIMIT_LOCATION') {
|
|
@@ -515,7 +532,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
515
532
|
/>
|
|
516
533
|
</View>
|
|
517
534
|
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
518
|
-
<AddressFormContainer style={{ height:
|
|
535
|
+
<AddressFormContainer style={{ height: HEIGHT_SCREEN * .78, overflow: 'scroll' }}>
|
|
519
536
|
<View>
|
|
520
537
|
<FormInput>
|
|
521
538
|
<AutocompleteInput>
|
|
@@ -543,7 +560,10 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
543
560
|
onPress={(data, details: any) => {
|
|
544
561
|
handleChangeAddress(data, details);
|
|
545
562
|
}}
|
|
546
|
-
query={{
|
|
563
|
+
query={{
|
|
564
|
+
key: googleMapsApiKey,
|
|
565
|
+
components: countryCode && countryCode !== '*' ? `country:${countryCode}` : ''
|
|
566
|
+
}}
|
|
547
567
|
fetchDetails
|
|
548
568
|
ref={googleInput}
|
|
549
569
|
textInputProps={{
|
|
@@ -562,6 +582,8 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
562
582
|
autoCorrect: false,
|
|
563
583
|
blurOnSubmit: false,
|
|
564
584
|
returnKeyType: 'next',
|
|
585
|
+
onFocus: () => setAutoCompleteInputFocused(true),
|
|
586
|
+
onBlur: () => setAutoCompleteInputFocused(false)
|
|
565
587
|
}}
|
|
566
588
|
onFail={(error) =>
|
|
567
589
|
setAlertState({
|
|
@@ -585,13 +607,14 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
585
607
|
textInput: {
|
|
586
608
|
borderWidth: 1,
|
|
587
609
|
borderRadius: 7.6,
|
|
588
|
-
borderColor: theme.colors.border,
|
|
610
|
+
borderColor: autoCompleteInputFocused ? theme.colors.primary : theme.colors.border,
|
|
589
611
|
flexGrow: 1,
|
|
590
612
|
fontSize: 15,
|
|
591
|
-
|
|
613
|
+
paddingLeft: 16,
|
|
614
|
+
paddingRight: 32,
|
|
592
615
|
minHeight: 50,
|
|
593
616
|
fontFamily: 'Poppins-Regular',
|
|
594
|
-
marginBottom: 24
|
|
617
|
+
marginBottom: 24
|
|
595
618
|
},
|
|
596
619
|
}}
|
|
597
620
|
/>
|
|
@@ -599,10 +622,10 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
599
622
|
/>
|
|
600
623
|
|
|
601
624
|
{(
|
|
602
|
-
(!isEditing && !isGuestUser
|
|
603
|
-
|
|
604
|
-
(isGuestUser
|
|
605
|
-
|
|
625
|
+
((!isEditing && !isGuestUser) ||
|
|
626
|
+
(isEditing && !isGuestUser)) ||
|
|
627
|
+
(isGuestUser)) &&
|
|
628
|
+
(
|
|
606
629
|
<View style={styles.pinIcon}>
|
|
607
630
|
<GPSButton
|
|
608
631
|
apiKey={googleMapsApiKey}
|
|
@@ -616,7 +639,7 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
616
639
|
IconButton={<OIcon src={theme.images.general.pin} width={16} />}
|
|
617
640
|
/>
|
|
618
641
|
</View>
|
|
619
|
-
|
|
642
|
+
)}
|
|
620
643
|
</AutocompleteInput>
|
|
621
644
|
|
|
622
645
|
{(locationChange || formState.changes?.location) && (
|
|
@@ -641,129 +664,141 @@ const AddressFormUI = (props: AddressFormParams) => {
|
|
|
641
664
|
)}
|
|
642
665
|
|
|
643
666
|
<View style={{ flexDirection: 'row', flexBasis: '50%' }}>
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
667
|
+
{showField && showField('internal_number') && (
|
|
668
|
+
<Controller
|
|
669
|
+
control={control}
|
|
670
|
+
name="internal_number"
|
|
671
|
+
rules={{
|
|
672
|
+
required:
|
|
673
|
+
isRequiredField && isRequiredField('internal_number')
|
|
674
|
+
? t(
|
|
675
|
+
`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`,
|
|
676
|
+
`The field internal number is required`,
|
|
677
|
+
)
|
|
678
|
+
: null,
|
|
679
|
+
}}
|
|
680
|
+
defaultValue={
|
|
681
|
+
address?.internal_number ||
|
|
682
|
+
formState.changes?.internal_number ||
|
|
683
|
+
addressState?.address?.internal_number ||
|
|
684
|
+
''
|
|
685
|
+
}
|
|
686
|
+
render={() => (
|
|
687
|
+
<OInput
|
|
688
|
+
name="internal_number"
|
|
689
|
+
placeholder={t('INTERNAL_NUMBER', 'Internal number')}
|
|
690
|
+
onChange={(text: string) => {
|
|
691
|
+
handleChangeInput(text);
|
|
692
|
+
setValue('internal_number', text);
|
|
693
|
+
}}
|
|
694
|
+
value={
|
|
695
|
+
address?.internal_number ||
|
|
696
|
+
formState.changes?.internal_number ||
|
|
697
|
+
addressState?.address?.internal_number ||
|
|
698
|
+
''
|
|
699
|
+
}
|
|
700
|
+
isFocusHighlight
|
|
701
|
+
style={{
|
|
702
|
+
...styles.inputsStyle,
|
|
703
|
+
marginRight: showField('internal_number') && showField('zipcode') ? 24 : 0
|
|
704
|
+
}}
|
|
705
|
+
forwardRef={internalNumberRef}
|
|
706
|
+
returnKeyType="next"
|
|
707
|
+
onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
|
|
708
|
+
blurOnSubmit={false}
|
|
709
|
+
/>
|
|
710
|
+
)}
|
|
711
|
+
/>
|
|
712
|
+
)}
|
|
713
|
+
|
|
714
|
+
{showField && showField('zipcode') && (
|
|
715
|
+
<Controller
|
|
716
|
+
control={control}
|
|
717
|
+
name="zipcode"
|
|
718
|
+
rules={{
|
|
719
|
+
required:
|
|
720
|
+
isRequiredField && isRequiredField('zipcode')
|
|
721
|
+
? t(
|
|
722
|
+
`VALIDATION_ERROR_ZIP_CODE_REQUIRED`,
|
|
723
|
+
`The field Zip Code is required`,
|
|
724
|
+
)
|
|
725
|
+
: null,
|
|
726
|
+
}}
|
|
727
|
+
defaultValue={
|
|
728
|
+
address?.zipcode ||
|
|
729
|
+
formState.changes?.zipcode ||
|
|
730
|
+
addressState.address.zipcode ||
|
|
731
|
+
''
|
|
732
|
+
}
|
|
733
|
+
render={() => (
|
|
734
|
+
<OInput
|
|
735
|
+
name="zipcode"
|
|
736
|
+
placeholder={t('ZIP_CODE', 'Zip code')}
|
|
737
|
+
onChange={(text: string) => {
|
|
738
|
+
handleChangeInput(text);
|
|
739
|
+
setValue('zipcode', text);
|
|
740
|
+
}}
|
|
741
|
+
value={
|
|
742
|
+
address?.zipcode ||
|
|
743
|
+
formState.changes?.zipcode ||
|
|
744
|
+
addressState.address.zipcode ||
|
|
745
|
+
''
|
|
746
|
+
}
|
|
747
|
+
isFocusHighlight
|
|
748
|
+
style={styles.inputsStyle}
|
|
749
|
+
forwardRef={zipCodeRef}
|
|
750
|
+
returnKeyType="next"
|
|
751
|
+
onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
|
|
752
|
+
blurOnSubmit={false}
|
|
753
|
+
/>
|
|
754
|
+
)}
|
|
755
|
+
/>
|
|
756
|
+
)}
|
|
757
|
+
</View>
|
|
684
758
|
|
|
759
|
+
{showField && showField('address_notes') && (
|
|
685
760
|
<Controller
|
|
686
761
|
control={control}
|
|
687
|
-
name="
|
|
762
|
+
name="address_notes"
|
|
688
763
|
rules={{
|
|
689
764
|
required:
|
|
690
|
-
isRequiredField && isRequiredField('
|
|
765
|
+
isRequiredField && isRequiredField('address_notes')
|
|
691
766
|
? t(
|
|
692
|
-
`
|
|
693
|
-
`The field
|
|
767
|
+
`VALIDATION_ERROR_ADDRESS_NOTES_REQUIRED`,
|
|
768
|
+
`The field address notes is required`,
|
|
694
769
|
)
|
|
695
770
|
: null,
|
|
696
771
|
}}
|
|
697
772
|
defaultValue={
|
|
698
|
-
address?.
|
|
699
|
-
formState.changes?.
|
|
700
|
-
addressState.address.
|
|
773
|
+
address?.address_notes ||
|
|
774
|
+
formState.changes?.address_notes ||
|
|
775
|
+
addressState.address.address_notes ||
|
|
701
776
|
''
|
|
702
777
|
}
|
|
703
778
|
render={() => (
|
|
704
779
|
<OInput
|
|
705
|
-
name="
|
|
706
|
-
placeholder={t('
|
|
707
|
-
onChange={(text:
|
|
780
|
+
name="address_notes"
|
|
781
|
+
placeholder={t('ADDRESS_NOTES', 'Address notes')}
|
|
782
|
+
onChange={(text: any) => {
|
|
708
783
|
handleChangeInput(text);
|
|
709
|
-
setValue('
|
|
784
|
+
setValue('address_notes', text);
|
|
710
785
|
}}
|
|
711
786
|
value={
|
|
712
|
-
address?.
|
|
713
|
-
formState.changes?.
|
|
714
|
-
addressState.address.
|
|
787
|
+
address?.address_notes ||
|
|
788
|
+
formState.changes?.address_notes ||
|
|
789
|
+
addressState.address.address_notes ||
|
|
715
790
|
''
|
|
716
791
|
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
792
|
+
multiline
|
|
793
|
+
isFocusHighlight
|
|
794
|
+
style={styles.textAreaStyles}
|
|
795
|
+
returnKeyType="done"
|
|
796
|
+
forwardRef={addressNotesRef}
|
|
797
|
+
blurOnSubmit
|
|
722
798
|
/>
|
|
723
799
|
)}
|
|
724
800
|
/>
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
<Controller
|
|
728
|
-
control={control}
|
|
729
|
-
name="address_notes"
|
|
730
|
-
rules={{
|
|
731
|
-
required:
|
|
732
|
-
isRequiredField && isRequiredField('address_notes')
|
|
733
|
-
? t(
|
|
734
|
-
`VALIDATION_ERROR_ADDRESS_NOTES_REQUIRED`,
|
|
735
|
-
`The field address notes is required`,
|
|
736
|
-
)
|
|
737
|
-
: null,
|
|
738
|
-
}}
|
|
739
|
-
defaultValue={
|
|
740
|
-
address?.address_notes ||
|
|
741
|
-
formState.changes?.address_notes ||
|
|
742
|
-
addressState.address.address_notes ||
|
|
743
|
-
''
|
|
744
|
-
}
|
|
745
|
-
render={() => (
|
|
746
|
-
<OInput
|
|
747
|
-
name="address_notes"
|
|
748
|
-
placeholder={t('ADDRESS_NOTES', 'Address notes')}
|
|
749
|
-
onChange={(text: any) => {
|
|
750
|
-
handleChangeInput(text);
|
|
751
|
-
setValue('address_notes', text);
|
|
752
|
-
}}
|
|
753
|
-
value={
|
|
754
|
-
address?.address_notes ||
|
|
755
|
-
formState.changes?.address_notes ||
|
|
756
|
-
addressState.address.address_notes ||
|
|
757
|
-
''
|
|
758
|
-
}
|
|
759
|
-
multiline
|
|
760
|
-
style={styles.textAreaStyles}
|
|
761
|
-
returnKeyType="done"
|
|
762
|
-
forwardRef={addressNotesRef}
|
|
763
|
-
blurOnSubmit
|
|
764
|
-
/>
|
|
765
|
-
)}
|
|
766
|
-
/>
|
|
801
|
+
)}
|
|
767
802
|
</FormInput>
|
|
768
803
|
<IconsContainer>
|
|
769
804
|
{tagsName.map((tag) => (
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useEffect } from 'react'
|
|
2
2
|
import { AddressList as AddressListController, useLanguage, useOrder, useSession } from 'ordering-components/native'
|
|
3
|
-
import {
|
|
3
|
+
import { AddressItem, Container } from './styles'
|
|
4
4
|
import { Platform, RefreshControl, StyleSheet, View } from 'react-native'
|
|
5
5
|
import { OButton, OText, OAlert, OModal, OIcon } from '../shared'
|
|
6
|
-
import { Container } from '../../layouts/Container'
|
|
7
6
|
import { AddressListParams } from '../../types'
|
|
8
7
|
import { NotFoundSource } from '../NotFoundSource'
|
|
9
8
|
import NavBar from '../NavBar'
|
|
@@ -40,9 +39,6 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
40
39
|
|
|
41
40
|
const [isProfile, setIsProfile] = useState(isFromProfile || route?.params?.isFromProfile);
|
|
42
41
|
|
|
43
|
-
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
44
|
-
const onNavigationRedirect = (route: string, params?: any) => navigation.navigate(route, params)
|
|
45
|
-
|
|
46
42
|
const onNavigatorRedirect = () => {
|
|
47
43
|
if (route && (isFromBusinesses || isGoBack)) {
|
|
48
44
|
isGoBack ? goToBack() : onNavigationRedirect('BottomTab')
|
|
@@ -104,7 +100,6 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
104
100
|
const handleSetAddress = (address: any) => {
|
|
105
101
|
if (address.id === orderState?.options?.address_id) return
|
|
106
102
|
handleSetDefault(address)
|
|
107
|
-
onNavigatorRedirect()
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
const handleSaveAddress = (address: any) => {
|
|
@@ -133,13 +128,21 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
133
128
|
}
|
|
134
129
|
}
|
|
135
130
|
|
|
131
|
+
const goToBack = () => navigation?.canGoBack() && navigation.goBack()
|
|
132
|
+
const onNavigationRedirect = (route: string, params?: any) => navigation.navigate(route, params)
|
|
133
|
+
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
if (orderState.loading && auth && orderState.options.address?.location) {
|
|
136
|
+
onNavigatorRedirect()
|
|
137
|
+
}
|
|
138
|
+
}, [orderState.options.address])
|
|
139
|
+
|
|
136
140
|
useEffect(() => {
|
|
137
141
|
console.log('From profile : ' + isProfile)
|
|
138
142
|
}, [])
|
|
139
143
|
|
|
140
144
|
return (
|
|
141
|
-
<Container
|
|
142
|
-
noPadding
|
|
145
|
+
<Container
|
|
143
146
|
refreshControl={
|
|
144
147
|
<RefreshControl
|
|
145
148
|
refreshing={refreshing}
|
|
@@ -147,17 +150,18 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
147
150
|
/>
|
|
148
151
|
}
|
|
149
152
|
>
|
|
150
|
-
{isProfile && (
|
|
151
|
-
<NavBar
|
|
152
|
-
title={t('SAVED_PLACES', 'My saved places')}
|
|
153
|
-
titleAlign={'center'}
|
|
154
|
-
onActionLeft={goToBack}
|
|
155
|
-
showCall={false}
|
|
156
|
-
style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
|
|
157
|
-
/>
|
|
158
|
-
)}
|
|
159
153
|
{(!addressList.loading || (isFromProductsList || isFromBusinesses || isFromProfile || isProfile)) && (
|
|
160
|
-
|
|
154
|
+
<>
|
|
155
|
+
{isProfile && (
|
|
156
|
+
<NavBar
|
|
157
|
+
title={t('SAVED_PLACES', 'My saved places')}
|
|
158
|
+
titleAlign={'center'}
|
|
159
|
+
onActionLeft={goToBack}
|
|
160
|
+
showCall={false}
|
|
161
|
+
paddingTop={10}
|
|
162
|
+
btnStyle={{ paddingLeft: 0 }}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
161
165
|
{
|
|
162
166
|
route &&
|
|
163
167
|
(
|
|
@@ -173,8 +177,8 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
173
177
|
onActionLeft={() => goToBack()}
|
|
174
178
|
showCall={false}
|
|
175
179
|
btnStyle={{ paddingLeft: 0 }}
|
|
176
|
-
paddingTop={
|
|
177
|
-
style={{ marginTop:
|
|
180
|
+
paddingTop={10}
|
|
181
|
+
style={{ marginTop: 0 }}
|
|
178
182
|
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
179
183
|
titleStyle={{ marginLeft: 0, marginRight: 0 }}
|
|
180
184
|
/>
|
|
@@ -323,7 +327,8 @@ const AddressListUI = (props: AddressListParams) => {
|
|
|
323
327
|
/>
|
|
324
328
|
</>
|
|
325
329
|
)}
|
|
326
|
-
|
|
330
|
+
</>
|
|
331
|
+
|
|
327
332
|
)}
|
|
328
333
|
</Container>
|
|
329
334
|
)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import styled from 'styled-components/native'
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const Container = styled.ScrollView`
|
|
4
|
+
position: relative;
|
|
4
5
|
flex: 1;
|
|
5
6
|
paddingLeft: 40px;
|
|
6
7
|
paddingRight: 40px;
|
|
7
|
-
|
|
8
|
+
margin-bottom: 40px;
|
|
9
|
+
padding-top: 10px;
|
|
8
10
|
`
|
|
9
11
|
|
|
10
12
|
export const AddressItem = styled.TouchableOpacity`
|