ordering-ui-react-native 0.16.86 → 0.16.87-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 (214) 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 +19 -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 +2 -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 -2
  19. package/themes/business/src/components/Chat/index.tsx +31 -31
  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 +19 -8
  27. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +31 -41
  29. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  30. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
  31. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  32. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  33. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  34. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  35. package/themes/business/src/components/OrdersOption/index.tsx +79 -87
  36. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  37. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  38. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  39. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  40. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  41. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  42. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  43. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  44. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  46. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  47. package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
  48. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  49. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  50. package/themes/business/src/components/ReviewCustomer/index.tsx +54 -27
  51. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  52. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  53. package/themes/business/src/components/shared/OLink.tsx +33 -13
  54. package/themes/business/src/components/shared/OModal.tsx +16 -9
  55. package/themes/business/src/components/shared/OText.tsx +8 -2
  56. package/themes/business/src/types/index.tsx +35 -3
  57. package/themes/business/src/utils/index.tsx +53 -0
  58. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  60. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  64. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  65. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  66. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  67. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  68. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  69. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  70. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +1 -0
  71. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  72. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  73. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  74. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  75. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  76. package/themes/kiosk/src/types/index.d.ts +13 -0
  77. package/themes/kiosk/src/utils/index.tsx +15 -0
  78. package/themes/original/index.tsx +8 -0
  79. package/themes/original/src/components/AddressDetails/index.tsx +10 -8
  80. package/themes/original/src/components/AddressForm/index.tsx +155 -139
  81. package/themes/original/src/components/AddressList/index.tsx +18 -18
  82. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  83. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  84. package/themes/original/src/components/BusinessBasicInformation/index.tsx +118 -76
  85. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -4
  86. package/themes/original/src/components/BusinessController/index.tsx +100 -47
  87. package/themes/original/src/components/BusinessController/styles.tsx +14 -9
  88. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  89. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -3
  90. package/themes/original/src/components/BusinessListingSearch/index.tsx +87 -34
  91. package/themes/original/src/components/BusinessListingSearch/styles.tsx +6 -0
  92. package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +10 -8
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +564 -495
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +13 -12
  97. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +116 -81
  100. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  101. package/themes/original/src/components/BusinessesListing/index.tsx +6 -6
  102. package/themes/original/src/components/Cart/index.tsx +83 -42
  103. package/themes/original/src/components/CartContent/index.tsx +77 -15
  104. package/themes/original/src/components/CartContent/styles.tsx +11 -1
  105. package/themes/original/src/components/Checkout/index.tsx +280 -173
  106. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  107. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  108. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  109. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  110. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  111. package/themes/original/src/components/Favorite/index.tsx +7 -4
  112. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  113. package/themes/original/src/components/FavoriteList/index.tsx +70 -80
  114. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  115. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  116. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  117. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  118. package/themes/original/src/components/GoogleMap/index.tsx +10 -1
  119. package/themes/original/src/components/Help/index.tsx +8 -8
  120. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  121. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  122. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  123. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  124. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  125. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  126. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  127. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  128. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  129. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  130. package/themes/original/src/components/LoginForm/index.tsx +43 -19
  131. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  132. package/themes/original/src/components/MessageListing/index.tsx +7 -40
  133. package/themes/original/src/components/Messages/index.tsx +26 -10
  134. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  135. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  136. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +92 -93
  137. package/themes/original/src/components/MultiCheckout/index.tsx +193 -79
  138. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  139. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  140. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  141. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  142. package/themes/original/src/components/NavBar/index.tsx +6 -11
  143. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  144. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  145. package/themes/original/src/components/Notifications/index.tsx +144 -0
  146. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  147. package/themes/original/src/components/OrderDetails/index.tsx +109 -219
  148. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  149. package/themes/original/src/components/OrderItAgain/index.tsx +44 -42
  150. package/themes/original/src/components/OrderProgress/index.tsx +74 -104
  151. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  152. package/themes/original/src/components/OrderSummary/index.tsx +52 -17
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +9 -3
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +29 -20
  155. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
  156. package/themes/original/src/components/OrdersOption/index.tsx +76 -83
  157. package/themes/original/src/components/PageBanner/index.tsx +146 -0
  158. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  159. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
  162. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  163. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  164. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  165. package/themes/original/src/components/ProductForm/index.tsx +240 -256
  166. package/themes/original/src/components/ProductForm/styles.tsx +5 -8
  167. package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  169. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  170. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  171. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
  173. package/themes/original/src/components/Promotions/index.tsx +234 -220
  174. package/themes/original/src/components/Promotions/styles.tsx +7 -2
  175. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  176. package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
  177. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  178. package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
  179. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  180. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  181. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  182. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  183. package/themes/original/src/components/ServiceForm/index.tsx +377 -270
  184. package/themes/original/src/components/Sessions/index.tsx +11 -8
  185. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  186. package/themes/original/src/components/SignupForm/index.tsx +79 -67
  187. package/themes/original/src/components/SingleOrderCard/index.tsx +125 -56
  188. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
  189. package/themes/original/src/components/SingleProductCard/index.tsx +104 -45
  190. package/themes/original/src/components/SingleProductCard/styles.tsx +14 -13
  191. package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
  192. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  193. package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
  194. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
  195. package/themes/original/src/components/UpsellingProducts/index.tsx +243 -218
  196. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  197. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  198. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  199. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  200. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  201. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  202. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  203. package/themes/original/src/components/Wallets/index.tsx +96 -93
  204. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  205. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  206. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  207. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  208. package/themes/original/src/components/shared/OButton.tsx +6 -2
  209. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  210. package/themes/original/src/components/shared/OInput.tsx +10 -1
  211. package/themes/original/src/layouts/Container.tsx +13 -9
  212. package/themes/original/src/types/index.tsx +37 -5
  213. package/themes/original/src/utils/index.tsx +321 -58
  214. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -5,7 +5,6 @@ import {
5
5
  TouchableOpacity,
6
6
  Keyboard,
7
7
  TouchableWithoutFeedback,
8
- KeyboardAvoidingView,
9
8
  Platform,
10
9
  } from 'react-native';
11
10
  import {
@@ -22,7 +21,7 @@ import Spinner from 'react-native-loading-spinner-overlay';
22
21
  import { useForm, Controller } from 'react-hook-form';
23
22
  import Geocoder from 'react-native-geocoding';
24
23
 
25
- import { OInput, OButton, OText, OModal, OIcon } from '../shared';
24
+ import { OInput, OButton, OModal, OIcon } from '../shared';
26
25
  import { AddressFormParams } from '../../types';
27
26
  import { getTraduction } from '../../utils';
28
27
  import { useTheme } from 'styled-components/native';
@@ -57,15 +56,16 @@ const AddressFormUI = (props: AddressFormParams) => {
57
56
  addressState,
58
57
  addressesList,
59
58
  saveAddress,
60
- userCustomerSetup,
61
59
  isGuestUser,
62
60
  isRequiredField,
61
+ showField,
63
62
  isFromProductsList,
64
63
  hasAddressDefault,
65
64
  afterSignup,
66
65
  } = props;
67
66
 
68
67
  const theme = useTheme();
68
+ const [autoCompleteInputFocused, setAutoCompleteInputFocused] = useState(false)
69
69
 
70
70
  const tagsName = [
71
71
  { icon: theme.images.general.tag_home, value: 'home' },
@@ -84,7 +84,6 @@ const AddressFormUI = (props: AddressFormParams) => {
84
84
  backgroundColor: theme.colors.clear
85
85
  },
86
86
  inputsStyle: {
87
- borderColor: theme.colors.border,
88
87
  borderRadius: 10,
89
88
  marginBottom: 20,
90
89
  height: 50,
@@ -93,7 +92,6 @@ const AddressFormUI = (props: AddressFormParams) => {
93
92
  flex: 1,
94
93
  },
95
94
  textAreaStyles: {
96
- borderColor: theme.colors.border,
97
95
  borderRadius: 10,
98
96
  marginBottom: 20,
99
97
  height: 104,
@@ -107,6 +105,12 @@ const AddressFormUI = (props: AddressFormParams) => {
107
105
  end: 0,
108
106
  top: 12,
109
107
  zIndex: 1002,
108
+ right: autoCompleteInputFocused && (
109
+ !!address?.address ||
110
+ !!formState.changes?.address ||
111
+ !!addressState.address.address
112
+ ) ? 30 : 15,
113
+ width: 16
110
114
  },
111
115
  wrapperNavbar: Platform.OS === 'ios'
112
116
  ? { paddingVertical: 0, paddingHorizontal: 40 }
@@ -155,7 +159,7 @@ const AddressFormUI = (props: AddressFormParams) => {
155
159
  'true';
156
160
  const maxLimitLocation =
157
161
  configState?.configs?.meters_to_change_address?.value;
158
-
162
+ const countryCode = configState?.configs?.country_autocomplete?.value
159
163
  const continueAsGuest = () => navigation.navigate('BusinessList', { isGuestUser: true });
160
164
  const goToBack = () => navigation?.canGoBack() && navigation.goBack();
161
165
 
@@ -358,7 +362,7 @@ const AddressFormUI = (props: AddressFormParams) => {
358
362
  if (
359
363
  orderState.loading &&
360
364
  !addressesList &&
361
- orderState.options.address &&
365
+ orderState?.options?.address &&
362
366
  auth &&
363
367
  !afterSignup
364
368
  ) {
@@ -366,7 +370,7 @@ const AddressFormUI = (props: AddressFormParams) => {
366
370
  ? navigation.navigate('BottomTab')
367
371
  : navigation.navigate('Business');
368
372
  }
369
- }, [orderState.options.address]);
373
+ }, [orderState?.options?.address]);
370
374
 
371
375
  useEffect(() => {
372
376
  if (alertState.open && alertState?.key !== 'ERROR_MAX_LIMIT_LOCATION') {
@@ -545,7 +549,10 @@ const AddressFormUI = (props: AddressFormParams) => {
545
549
  onPress={(data, details: any) => {
546
550
  handleChangeAddress(data, details);
547
551
  }}
548
- query={{ key: googleMapsApiKey }}
552
+ query={{
553
+ key: googleMapsApiKey,
554
+ components: countryCode && countryCode !== '*' ? `country:${countryCode}` : ''
555
+ }}
549
556
  fetchDetails
550
557
  ref={googleInput}
551
558
  textInputProps={{
@@ -564,6 +571,8 @@ const AddressFormUI = (props: AddressFormParams) => {
564
571
  autoCorrect: false,
565
572
  blurOnSubmit: false,
566
573
  returnKeyType: 'next',
574
+ onFocus: () => setAutoCompleteInputFocused(true),
575
+ onBlur: () => setAutoCompleteInputFocused(false)
567
576
  }}
568
577
  onFail={(error) =>
569
578
  setAlertState({
@@ -587,45 +596,40 @@ const AddressFormUI = (props: AddressFormParams) => {
587
596
  textInput: {
588
597
  borderWidth: 1,
589
598
  borderRadius: 7.6,
590
- borderColor: theme.colors.border,
599
+ borderColor: autoCompleteInputFocused ? theme.colors.primary : theme.colors.border,
591
600
  flexGrow: 1,
592
601
  fontSize: 15,
593
- paddingHorizontal: 16,
602
+ paddingLeft: 16,
603
+ paddingRight: 32,
594
604
  minHeight: 50,
595
605
  fontFamily: 'Poppins-Regular',
596
- marginBottom: 24,
606
+ marginBottom: 24
597
607
  },
598
608
  }}
599
609
  />
600
610
  )}
601
611
  />
602
- {hasEditing ? (
603
- <View style={styles.pinIcon}>
604
- <GPSButton
605
- apiKey={googleMapsApiKey}
606
- handleGPS={(data: any, detail: any) => {
607
- handleChangeAddress(data, detail);
608
- setValue(data.address);
609
- if (googleInput?.current) {
610
- googleInput?.current?.setAddressText(data.address);
611
- }
612
- }}
613
- IconButton={<OIcon src={theme.images.general.pin} width={16} />}
614
- />
615
- </View>
616
- ) : null}
617
- </AutocompleteInput>
618
612
 
619
- {/* {!isKeyboardShow && (addressState?.address?.location || formState?.changes?.location) && (
620
- <TouchableOpacity onPress={handleToggleMap} style={{ marginBottom: 10 }}>
621
- <OText
622
- color={theme.colors.primary}
623
- style={{ textAlign: 'center' }}
624
- >
625
- {t('VIEW_MAP', 'View map to modify the exact location')}
626
- </OText>
627
- </TouchableOpacity>
628
- )} */}
613
+ {(
614
+ ((!isEditing && !isGuestUser) ||
615
+ (isEditing && !isGuestUser)) ||
616
+ (isGuestUser)) &&
617
+ (
618
+ <View style={styles.pinIcon}>
619
+ <GPSButton
620
+ apiKey={googleMapsApiKey}
621
+ handleGPS={(data: any, detail: any) => {
622
+ handleChangeAddress(data, detail);
623
+ setValue('address', data.address);
624
+ if (googleInput?.current) {
625
+ googleInput?.current?.setAddressText(data.address);
626
+ }
627
+ }}
628
+ IconButton={<OIcon src={theme.images.general.pin} width={16} />}
629
+ />
630
+ </View>
631
+ )}
632
+ </AutocompleteInput>
629
633
 
630
634
  {(locationChange || formState.changes?.location) && (
631
635
  <View
@@ -649,129 +653,141 @@ const AddressFormUI = (props: AddressFormParams) => {
649
653
  )}
650
654
 
651
655
  <View style={{ flexDirection: 'row', flexBasis: '50%' }}>
652
- <Controller
653
- control={control}
654
- name="internal_number"
655
- rules={{
656
- required:
657
- isRequiredField && isRequiredField('internal_number')
658
- ? t(
659
- `VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`,
660
- `The field internal number is required`,
661
- )
662
- : null,
663
- }}
664
- defaultValue={
665
- address?.internal_number ||
666
- formState.changes?.internal_number ||
667
- addressState?.address?.internal_number ||
668
- ''
669
- }
670
- render={() => (
671
- <OInput
672
- name="internal_number"
673
- placeholder={t('INTERNAL_NUMBER', 'Internal number')}
674
- onChange={(text: string) => {
675
- handleChangeInput(text);
676
- setValue('internal_number', text);
677
- }}
678
- value={
679
- address?.internal_number ||
680
- formState.changes?.internal_number ||
681
- addressState?.address?.internal_number ||
682
- ''
683
- }
684
- style={{ ...styles.inputsStyle, marginRight: 24 }}
685
- forwardRef={internalNumberRef}
686
- returnKeyType="next"
687
- onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
688
- blurOnSubmit={false}
689
- />
690
- )}
691
- />
656
+ {showField && showField('internal_number') && (
657
+ <Controller
658
+ control={control}
659
+ name="internal_number"
660
+ rules={{
661
+ required:
662
+ isRequiredField && isRequiredField('internal_number')
663
+ ? t(
664
+ `VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`,
665
+ `The field internal number is required`,
666
+ )
667
+ : null,
668
+ }}
669
+ defaultValue={
670
+ address?.internal_number ||
671
+ formState.changes?.internal_number ||
672
+ addressState?.address?.internal_number ||
673
+ ''
674
+ }
675
+ render={() => (
676
+ <OInput
677
+ name="internal_number"
678
+ placeholder={t('INTERNAL_NUMBER', 'Internal number')}
679
+ onChange={(text: string) => {
680
+ handleChangeInput(text);
681
+ setValue('internal_number', text);
682
+ }}
683
+ value={
684
+ address?.internal_number ||
685
+ formState.changes?.internal_number ||
686
+ addressState?.address?.internal_number ||
687
+ ''
688
+ }
689
+ isFocusHighlight
690
+ style={{
691
+ ...styles.inputsStyle,
692
+ marginRight: showField('internal_number') && showField('zipcode') ? 24 : 0
693
+ }}
694
+ forwardRef={internalNumberRef}
695
+ returnKeyType="next"
696
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
697
+ blurOnSubmit={false}
698
+ />
699
+ )}
700
+ />
701
+ )}
692
702
 
703
+ {showField && showField('zipcode') && (
704
+ <Controller
705
+ control={control}
706
+ name="zipcode"
707
+ rules={{
708
+ required:
709
+ isRequiredField && isRequiredField('zipcode')
710
+ ? t(
711
+ `VALIDATION_ERROR_ZIP_CODE_REQUIRED`,
712
+ `The field Zip Code is required`,
713
+ )
714
+ : null,
715
+ }}
716
+ defaultValue={
717
+ address?.zipcode ||
718
+ formState.changes?.zipcode ||
719
+ addressState.address.zipcode ||
720
+ ''
721
+ }
722
+ render={() => (
723
+ <OInput
724
+ name="zipcode"
725
+ placeholder={t('ZIP_CODE', 'Zip code')}
726
+ onChange={(text: string) => {
727
+ handleChangeInput(text);
728
+ setValue('zipcode', text);
729
+ }}
730
+ value={
731
+ address?.zipcode ||
732
+ formState.changes?.zipcode ||
733
+ addressState.address.zipcode ||
734
+ ''
735
+ }
736
+ isFocusHighlight
737
+ style={styles.inputsStyle}
738
+ forwardRef={zipCodeRef}
739
+ returnKeyType="next"
740
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
741
+ blurOnSubmit={false}
742
+ />
743
+ )}
744
+ />
745
+ )}
746
+ </View>
747
+
748
+ {showField && showField('address_notes') && (
693
749
  <Controller
694
750
  control={control}
695
- name="zipcode"
751
+ name="address_notes"
696
752
  rules={{
697
753
  required:
698
- isRequiredField && isRequiredField('zipcode')
754
+ isRequiredField && isRequiredField('address_notes')
699
755
  ? t(
700
- `VALIDATION_ERROR_ZIP_CODE_REQUIRED`,
701
- `The field Zip Code is required`,
756
+ `VALIDATION_ERROR_ADDRESS_NOTES_REQUIRED`,
757
+ `The field address notes is required`,
702
758
  )
703
759
  : null,
704
760
  }}
705
761
  defaultValue={
706
- address?.zipcode ||
707
- formState.changes?.zipcode ||
708
- addressState.address.zipcode ||
762
+ address?.address_notes ||
763
+ formState.changes?.address_notes ||
764
+ addressState.address.address_notes ||
709
765
  ''
710
766
  }
711
767
  render={() => (
712
768
  <OInput
713
- name="zipcode"
714
- placeholder={t('ZIP_CODE', 'Zip code')}
715
- onChange={(text: string) => {
769
+ name="address_notes"
770
+ placeholder={t('ADDRESS_NOTES', 'Address notes')}
771
+ onChange={(text: any) => {
716
772
  handleChangeInput(text);
717
- setValue('zipcode', text);
773
+ setValue('address_notes', text);
718
774
  }}
719
775
  value={
720
- address?.zipcode ||
721
- formState.changes?.zipcode ||
722
- addressState.address.zipcode ||
776
+ address?.address_notes ||
777
+ formState.changes?.address_notes ||
778
+ addressState.address.address_notes ||
723
779
  ''
724
780
  }
725
- style={styles.inputsStyle}
726
- forwardRef={zipCodeRef}
727
- returnKeyType="next"
728
- onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
729
- blurOnSubmit={false}
781
+ multiline
782
+ isFocusHighlight
783
+ style={styles.textAreaStyles}
784
+ returnKeyType="done"
785
+ forwardRef={addressNotesRef}
786
+ blurOnSubmit
730
787
  />
731
788
  )}
732
789
  />
733
- </View>
734
-
735
- <Controller
736
- control={control}
737
- name="address_notes"
738
- rules={{
739
- required:
740
- isRequiredField && isRequiredField('address_notes')
741
- ? t(
742
- `VALIDATION_ERROR_ADDRESS_NOTES_REQUIRED`,
743
- `The field address notes is required`,
744
- )
745
- : null,
746
- }}
747
- defaultValue={
748
- address?.address_notes ||
749
- formState.changes?.address_notes ||
750
- addressState.address.address_notes ||
751
- ''
752
- }
753
- render={() => (
754
- <OInput
755
- name="address_notes"
756
- placeholder={t('ADDRESS_NOTES', 'Address notes')}
757
- onChange={(text: any) => {
758
- handleChangeInput(text);
759
- setValue('address_notes', text);
760
- }}
761
- value={
762
- address?.address_notes ||
763
- formState.changes?.address_notes ||
764
- addressState.address.address_notes ||
765
- ''
766
- }
767
- multiline
768
- style={styles.textAreaStyles}
769
- returnKeyType="done"
770
- forwardRef={addressNotesRef}
771
- blurOnSubmit
772
- />
773
- )}
774
- />
790
+ )}
775
791
  </FormInput>
776
792
  <IconsContainer>
777
793
  {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'
@@ -56,7 +55,7 @@ const AddressListUI = (props: AddressListParams) => {
56
55
  }
57
56
 
58
57
  const uniqueAddressesList = (addressList.addresses && addressList.addresses.filter(
59
- (address: any, i: number, self: any) =>
58
+ (address: any, i: number, self: any) => address.address &&
60
59
  i === self.findIndex((obj: any) => (
61
60
  address.address === obj.address &&
62
61
  address.address_notes === obj.address_notes &&
@@ -143,8 +142,7 @@ const AddressListUI = (props: AddressListParams) => {
143
142
  }, [])
144
143
 
145
144
  return (
146
- <Container
147
- noPadding
145
+ <Container
148
146
  refreshControl={
149
147
  <RefreshControl
150
148
  refreshing={refreshing}
@@ -152,17 +150,18 @@ const AddressListUI = (props: AddressListParams) => {
152
150
  />
153
151
  }
154
152
  >
155
- {isProfile && (
156
- <NavBar
157
- title={t('SAVED_PLACES', 'My saved places')}
158
- titleAlign={'center'}
159
- onActionLeft={goToBack}
160
- showCall={false}
161
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
162
- />
163
- )}
164
153
  {(!addressList.loading || (isFromProductsList || isFromBusinesses || isFromProfile || isProfile)) && (
165
- <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
+ )}
166
165
  {
167
166
  route &&
168
167
  (
@@ -178,8 +177,8 @@ const AddressListUI = (props: AddressListParams) => {
178
177
  onActionLeft={() => goToBack()}
179
178
  showCall={false}
180
179
  btnStyle={{ paddingLeft: 0 }}
181
- paddingTop={0}
182
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 40 }}
180
+ paddingTop={10}
181
+ style={{ marginTop: 0 }}
183
182
  titleWrapStyle={{ paddingHorizontal: 0 }}
184
183
  titleStyle={{ marginLeft: 0, marginRight: 0 }}
185
184
  />
@@ -328,7 +327,8 @@ const AddressListUI = (props: AddressListParams) => {
328
327
  />
329
328
  </>
330
329
  )}
331
- </AddressListContainer>
330
+ </>
331
+
332
332
  )}
333
333
  </Container>
334
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`
@@ -21,7 +21,7 @@ export const AppleLogin = (props: any) => {
21
21
  const [{ configs }] = useConfig();
22
22
  const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
23
23
 
24
- let user : any= null
24
+ let user: any = null
25
25
 
26
26
  const buttonText = auth
27
27
  ? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
@@ -53,7 +53,7 @@ export const AppleLogin = (props: any) => {
53
53
  }
54
54
  }
55
55
 
56
- const fetchAndUpdateCredentialState = async (updateCredentialStateForUser : any) => {
56
+ const fetchAndUpdateCredentialState = async (updateCredentialStateForUser: any) => {
57
57
  if (user === null) {
58
58
  updateCredentialStateForUser('N/A');
59
59
  } else {
@@ -66,7 +66,7 @@ export const AppleLogin = (props: any) => {
66
66
  }
67
67
  }
68
68
 
69
- const onIOSButtonPress = async (updateCredentialStateForUser : any) => {
69
+ const onIOSButtonPress = async (updateCredentialStateForUser: any) => {
70
70
  try {
71
71
  const appleAuthRequestResponse = await appleAuth.performRequest({
72
72
  requestedOperation: appleAuth.Operation.LOGIN,
@@ -79,7 +79,7 @@ export const AppleLogin = (props: any) => {
79
79
  identityToken,
80
80
  authorizationCode
81
81
  } = appleAuthRequestResponse;
82
-
82
+
83
83
  user = newUser;
84
84
 
85
85
  fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>