ordering-ui-react-native 0.16.97 → 0.16.98-release

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/styles.tsx +8 -14
  4. package/src/components/BusinessInformation/index.tsx +11 -4
  5. package/src/components/BusinessInformation/styles.tsx +2 -2
  6. package/src/components/BusinessProductsList/index.tsx +1 -1
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/OrderCreating/index.tsx +1 -21
  9. package/src/components/OrdersOption/index.tsx +54 -56
  10. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  11. package/src/components/SingleProductReview/index.tsx +7 -4
  12. package/src/components/VerifyPhone/styles.tsx +1 -2
  13. package/src/components/shared/OToast.tsx +4 -4
  14. package/src/utils/index.tsx +7 -1
  15. package/themes/business/index.tsx +2 -0
  16. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  17. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  18. package/themes/business/src/components/BusinessController/index.tsx +2 -3
  19. package/themes/business/src/components/Chat/index.tsx +146 -135
  20. package/themes/business/src/components/DriverMap/index.tsx +22 -9
  21. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  22. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  23. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  24. package/themes/business/src/components/LoginForm/index.tsx +239 -80
  25. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  26. package/themes/business/src/components/MapView/index.tsx +18 -7
  27. package/themes/business/src/components/NewOrderNotification/index.tsx +33 -43
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  34. package/themes/business/src/components/OrdersOption/index.tsx +33 -75
  35. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +1 -1
  36. package/themes/business/src/components/PreviousMessages/index.tsx +16 -18
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  38. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  39. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  41. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  42. package/themes/business/src/components/ReviewCustomer/index.tsx +42 -25
  43. package/themes/business/src/components/StoresList/index.tsx +2 -2
  44. package/themes/business/src/components/shared/OLink.tsx +33 -13
  45. package/themes/business/src/components/shared/OModal.tsx +16 -9
  46. package/themes/business/src/components/shared/OText.tsx +8 -2
  47. package/themes/business/src/types/index.tsx +33 -2
  48. package/themes/business/src/utils/index.tsx +53 -0
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  54. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  55. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  56. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  57. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  58. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  59. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  60. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  61. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  62. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  64. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  65. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  66. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  67. package/themes/kiosk/src/types/index.d.ts +13 -0
  68. package/themes/kiosk/src/utils/index.tsx +15 -0
  69. package/themes/original/index.tsx +8 -0
  70. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  71. package/themes/original/src/components/AddressForm/index.tsx +152 -117
  72. package/themes/original/src/components/AddressList/index.tsx +26 -21
  73. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  74. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  75. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  77. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  78. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  79. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  80. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  81. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  82. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  83. package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
  85. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  86. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  87. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -490
  89. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  90. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  91. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  92. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  95. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  96. package/themes/original/src/components/Cart/index.tsx +87 -43
  97. package/themes/original/src/components/CartContent/index.tsx +77 -15
  98. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  99. package/themes/original/src/components/Checkout/index.tsx +294 -175
  100. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  101. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  102. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  103. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  104. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  105. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  106. package/themes/original/src/components/Favorite/index.tsx +7 -4
  107. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  108. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  109. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  112. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  113. package/themes/original/src/components/Help/index.tsx +8 -8
  114. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  115. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  116. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  117. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  119. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  120. package/themes/original/src/components/Home/index.tsx +13 -4
  121. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  122. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  124. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  125. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  126. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  127. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  128. package/themes/original/src/components/Messages/index.tsx +32 -10
  129. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  130. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
  132. package/themes/original/src/components/MultiCheckout/index.tsx +247 -83
  133. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  135. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  136. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  137. package/themes/original/src/components/NavBar/index.tsx +6 -11
  138. package/themes/original/src/components/NotFoundSource/index.tsx +1 -1
  139. package/themes/original/src/components/Notifications/index.tsx +144 -0
  140. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  141. package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
  142. package/themes/original/src/components/OrderDetails/index.tsx +110 -221
  143. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  144. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  145. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  146. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  147. package/themes/original/src/components/OrderSummary/index.tsx +66 -29
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
  149. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  151. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  152. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  153. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  154. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  155. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  156. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  157. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  158. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  159. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  160. package/themes/original/src/components/ProductForm/index.tsx +240 -261
  161. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  165. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  168. package/themes/original/src/components/Promotions/index.tsx +234 -220
  169. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  170. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  171. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  172. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  173. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  174. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  175. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  176. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  177. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  178. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  179. package/themes/original/src/components/Sessions/index.tsx +11 -8
  180. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  181. package/themes/original/src/components/SignupForm/index.tsx +79 -66
  182. package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
  183. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  184. package/themes/original/src/components/SingleProductCard/index.tsx +111 -49
  185. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  186. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  187. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  188. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  189. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  190. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  191. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  192. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  193. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  194. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  195. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  196. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  197. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  198. package/themes/original/src/components/Wallets/index.tsx +20 -19
  199. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  200. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  201. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  202. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  203. package/themes/original/src/components/shared/OButton.tsx +6 -2
  204. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  205. package/themes/original/src/components/shared/OInput.tsx +10 -1
  206. package/themes/original/src/components/shared/OModal.tsx +3 -3
  207. package/themes/original/src/layouts/Container.tsx +13 -9
  208. package/themes/original/src/types/index.tsx +45 -7
  209. package/themes/original/src/utils/index.tsx +359 -58
  210. 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 continueAsGuest = () => navigation.navigate('BusinessList', { isGuestUser: true });
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.options.address &&
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.options.address]);
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: 600, overflow: 'scroll' }}>
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={{ key: googleMapsApiKey }}
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
- paddingHorizontal: 16,
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 && !formState.changes?.address) ||
603
- (isEditing && !isGuestUser && !formState.changes?.address && formState.changes?.address !== undefined)) ||
604
- (isGuestUser && !formState.changes?.address && formState.changes?.address !== undefined) &&
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
- <Controller
645
- control={control}
646
- name="internal_number"
647
- rules={{
648
- required:
649
- isRequiredField && isRequiredField('internal_number')
650
- ? t(
651
- `VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`,
652
- `The field internal number is required`,
653
- )
654
- : null,
655
- }}
656
- defaultValue={
657
- address?.internal_number ||
658
- formState.changes?.internal_number ||
659
- addressState?.address?.internal_number ||
660
- ''
661
- }
662
- render={() => (
663
- <OInput
664
- name="internal_number"
665
- placeholder={t('INTERNAL_NUMBER', 'Internal number')}
666
- onChange={(text: string) => {
667
- handleChangeInput(text);
668
- setValue('internal_number', text);
669
- }}
670
- value={
671
- address?.internal_number ||
672
- formState.changes?.internal_number ||
673
- addressState?.address?.internal_number ||
674
- ''
675
- }
676
- style={{ ...styles.inputsStyle, marginRight: 24 }}
677
- forwardRef={internalNumberRef}
678
- returnKeyType="next"
679
- onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
680
- blurOnSubmit={false}
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="zipcode"
762
+ name="address_notes"
688
763
  rules={{
689
764
  required:
690
- isRequiredField && isRequiredField('zipcode')
765
+ isRequiredField && isRequiredField('address_notes')
691
766
  ? t(
692
- `VALIDATION_ERROR_ZIP_CODE_REQUIRED`,
693
- `The field Zip Code is required`,
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?.zipcode ||
699
- formState.changes?.zipcode ||
700
- addressState.address.zipcode ||
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="zipcode"
706
- placeholder={t('ZIP_CODE', 'Zip code')}
707
- onChange={(text: string) => {
780
+ name="address_notes"
781
+ placeholder={t('ADDRESS_NOTES', 'Address notes')}
782
+ onChange={(text: any) => {
708
783
  handleChangeInput(text);
709
- setValue('zipcode', text);
784
+ setValue('address_notes', text);
710
785
  }}
711
786
  value={
712
- address?.zipcode ||
713
- formState.changes?.zipcode ||
714
- addressState.address.zipcode ||
787
+ address?.address_notes ||
788
+ formState.changes?.address_notes ||
789
+ addressState.address.address_notes ||
715
790
  ''
716
791
  }
717
- style={styles.inputsStyle}
718
- forwardRef={zipCodeRef}
719
- returnKeyType="next"
720
- onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
721
- blurOnSubmit={false}
792
+ multiline
793
+ isFocusHighlight
794
+ style={styles.textAreaStyles}
795
+ returnKeyType="done"
796
+ forwardRef={addressNotesRef}
797
+ blurOnSubmit
722
798
  />
723
799
  )}
724
800
  />
725
- </View>
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 { AddressListContainer, AddressItem } from './styles'
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
- <AddressListContainer>
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={0}
177
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 40 }}
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
- </AddressListContainer>
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 AddressListContainer = styled.View`
3
+ export const Container = styled.ScrollView`
4
+ position: relative;
4
5
  flex: 1;
5
6
  paddingLeft: 40px;
6
7
  paddingRight: 40px;
7
- paddingBottom: 20px;
8
+ margin-bottom: 40px;
9
+ padding-top: 10px;
8
10
  `
9
11
 
10
12
  export const AddressItem = styled.TouchableOpacity`