ordering-ui-react-native 0.17.12 → 0.17.13-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 (211) hide show
  1. package/package.json +5 -5
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +119 -120
  6. package/src/components/StripeMethodForm/index.tsx +108 -77
  7. package/src/components/VerifyPhone/styles.tsx +1 -2
  8. package/src/components/shared/OToast.tsx +4 -4
  9. package/src/types/index.tsx +5 -0
  10. package/src/utils/index.tsx +7 -1
  11. package/themes/business/index.tsx +2 -0
  12. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  13. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  14. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  15. package/themes/business/src/components/Chat/index.tsx +118 -107
  16. package/themes/business/src/components/DriverMap/index.tsx +17 -7
  17. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  18. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  19. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  20. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  21. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +43 -50
  24. package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
  25. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +98 -50
  26. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
  27. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  28. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  29. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  30. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  31. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  33. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  34. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  35. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  36. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  37. package/themes/business/src/components/ReviewCustomer/index.tsx +41 -24
  38. package/themes/business/src/components/StoresList/index.tsx +2 -2
  39. package/themes/business/src/components/shared/OLink.tsx +33 -13
  40. package/themes/business/src/components/shared/OModal.tsx +16 -9
  41. package/themes/business/src/components/shared/OText.tsx +8 -2
  42. package/themes/business/src/types/index.tsx +32 -2
  43. package/themes/business/src/utils/index.tsx +44 -1
  44. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  45. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  46. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
  48. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  49. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  50. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  51. package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
  52. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
  57. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  58. package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  61. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  62. package/themes/kiosk/src/types/index.d.ts +13 -0
  63. package/themes/kiosk/src/utils/index.tsx +15 -0
  64. package/themes/original/index.tsx +8 -0
  65. package/themes/original/src/components/AddressDetails/index.tsx +29 -11
  66. package/themes/original/src/components/AddressForm/index.tsx +41 -16
  67. package/themes/original/src/components/AddressList/index.tsx +26 -21
  68. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  69. package/themes/original/src/components/AnalyticsSegment/index.tsx +189 -9
  70. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
  73. package/themes/original/src/components/BusinessController/index.tsx +145 -68
  74. package/themes/original/src/components/BusinessController/styles.tsx +22 -9
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  79. package/themes/original/src/components/BusinessListingSearch/index.tsx +350 -323
  80. package/themes/original/src/components/BusinessPreorder/index.tsx +97 -16
  81. package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
  82. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  83. package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -492
  84. package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
  85. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  86. package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
  87. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +105 -78
  89. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
  90. package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
  91. package/themes/original/src/components/Cart/index.tsx +88 -43
  92. package/themes/original/src/components/CartContent/index.tsx +110 -19
  93. package/themes/original/src/components/CartContent/styles.tsx +15 -1
  94. package/themes/original/src/components/Checkout/index.tsx +323 -178
  95. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  96. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  97. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  98. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  99. package/themes/original/src/components/DriverTips/index.tsx +52 -37
  100. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  101. package/themes/original/src/components/Favorite/index.tsx +7 -4
  102. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  103. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  104. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  105. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  106. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  107. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  108. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +178 -0
  112. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  113. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  114. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  115. package/themes/original/src/components/Help/index.tsx +8 -8
  116. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
  117. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
  118. package/themes/original/src/components/HelpGuide/index.tsx +12 -16
  119. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  120. package/themes/original/src/components/HelpOrder/index.tsx +12 -25
  121. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  122. package/themes/original/src/components/Home/index.tsx +13 -4
  123. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  124. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  125. package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
  126. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  127. package/themes/original/src/components/LoginForm/index.tsx +48 -19
  128. package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
  129. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  130. package/themes/original/src/components/Messages/index.tsx +32 -10
  131. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  132. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +195 -116
  134. package/themes/original/src/components/MultiCheckout/index.tsx +262 -83
  135. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  136. package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
  137. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  138. package/themes/original/src/components/MyOrders/index.tsx +66 -17
  139. package/themes/original/src/components/NavBar/index.tsx +6 -11
  140. package/themes/original/src/components/Notifications/index.tsx +144 -0
  141. package/themes/original/src/components/Notifications/styles.tsx +20 -0
  142. package/themes/original/src/components/OrderDetails/OrderEta.tsx +61 -0
  143. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +10 -3
  144. package/themes/original/src/components/OrderDetails/index.tsx +262 -347
  145. package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
  146. package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
  147. package/themes/original/src/components/OrderProgress/index.tsx +74 -112
  148. package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
  149. package/themes/original/src/components/OrderSummary/index.tsx +67 -29
  150. package/themes/original/src/components/OrderTypeSelector/index.tsx +3 -2
  151. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
  152. package/themes/original/src/components/OrdersOption/index.tsx +99 -89
  153. package/themes/original/src/components/PageBanner/index.tsx +171 -0
  154. package/themes/original/src/components/PageBanner/styles.tsx +11 -0
  155. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  156. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  157. package/themes/original/src/components/PaymentOptions/index.tsx +34 -6
  158. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  159. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  160. package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
  161. package/themes/original/src/components/ProductForm/index.tsx +231 -253
  162. package/themes/original/src/components/ProductForm/styles.tsx +4 -7
  163. package/themes/original/src/components/ProductItemAccordion/index.tsx +197 -138
  164. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
  165. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
  166. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  167. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  168. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  169. package/themes/original/src/components/Promotions/index.tsx +234 -220
  170. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  171. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  172. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  173. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  174. package/themes/original/src/components/ReviewProducts/index.tsx +7 -4
  175. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  176. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  177. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  178. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  179. package/themes/original/src/components/ServiceForm/index.tsx +358 -275
  180. package/themes/original/src/components/Sessions/index.tsx +11 -8
  181. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  182. package/themes/original/src/components/SignupForm/index.tsx +82 -67
  183. package/themes/original/src/components/SingleOrderCard/index.tsx +148 -62
  184. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -9
  185. package/themes/original/src/components/SingleProductCard/index.tsx +99 -55
  186. package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
  187. package/themes/original/src/components/SingleProductReview/index.tsx +8 -2
  188. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  189. package/themes/original/src/components/StripeCardsList/index.tsx +9 -2
  190. package/themes/original/src/components/StripeElementsForm/index.tsx +28 -15
  191. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
  192. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  193. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  194. package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
  195. package/themes/original/src/components/UserProfile/index.tsx +58 -35
  196. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  197. package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
  198. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  199. package/themes/original/src/components/Wallets/index.tsx +31 -17
  200. package/themes/original/src/components/Wallets/styles.tsx +2 -0
  201. package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
  202. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  203. package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
  204. package/themes/original/src/components/shared/OButton.tsx +6 -2
  205. package/themes/original/src/components/shared/OIcon.tsx +8 -1
  206. package/themes/original/src/components/shared/OInput.tsx +10 -1
  207. package/themes/original/src/components/shared/OModal.tsx +3 -3
  208. package/themes/original/src/layouts/Container.tsx +13 -9
  209. package/themes/original/src/types/index.tsx +43 -9
  210. package/themes/original/src/utils/index.tsx +375 -58
  211. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 43px;
5
+ padding: 0 30px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
- flex-wrap: wrap;
24
23
  `
25
24
 
26
25
  export const WrappCountdown = styled.View`
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
- import { Animated, StyleSheet, Text, View } from "react-native";
2
+ import { Animated, StyleSheet, Text, View, Platform } from "react-native";
3
3
  import { ToastType, useToast, useLanguage } from "ordering-components/native";
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { getTraduction } from '../../utils'
6
6
 
7
7
  const fadeDuration = 300;
8
- const bottomPosition = 20;
8
+ const topPosition = Platform.OS === 'ios' ? 40 : 20
9
9
 
10
10
  export const Toast = (props: any) => {
11
11
  const [toastConfig, { hideToast }] = useToast();
@@ -54,7 +54,7 @@ export const Toast = (props: any) => {
54
54
  backgroundColor = theme.colors.toastInfo || '#6BA4FF';
55
55
  break;
56
56
  case ToastType.Error:
57
- backgroundColor = theme.colors.toastError || '#D83520' ;
57
+ backgroundColor = theme.colors.toastError || '#D83520';
58
58
  break;
59
59
  case ToastType.Success:
60
60
  backgroundColor = theme.colors.toastSuccess || '#90C68E';
@@ -65,7 +65,7 @@ export const Toast = (props: any) => {
65
65
  <Animated.View
66
66
  style={[
67
67
  styles.container,
68
- { bottom: bottomPosition, opacity },
68
+ { top: topPosition, opacity },
69
69
  ]}
70
70
  >
71
71
  <View style={[styles.toast, { backgroundColor }]}>
@@ -490,4 +490,9 @@ export interface StripeMethodFormParams {
490
490
  setErrors: (error: string) => void;
491
491
  paymethod: string;
492
492
  devMode?: boolean;
493
+ setMethodPaySupported?: any
494
+ placeByMethodPay?: any
495
+ methodPaySupported?: any,
496
+ setPlaceByMethodPay?: any,
497
+ cartTotal?: number
493
498
  }
@@ -34,7 +34,8 @@ export const getTraduction = (key: string, t: any) => {
34
34
  ERROR_ADD_PRODUCT_VERY_FAR_FOR_DELIVERY: 'Error adding product, very far for delivery',
35
35
  ERROR_PRODUCT_NOT_FOUND: 'Error with the product',
36
36
  ERROR_ADD_BUSINESS_INVALID: 'An error occurred with the business',
37
- ERROR_INVALID_OFFER: 'The offer doesn\'t exist'
37
+ ERROR_INVALID_OFFER: 'The offer doesn\'t exist',
38
+ ERROR_ADD_PRODUCT_BEFORE_ADDRESS: 'You must have an address'
38
39
  }
39
40
 
40
41
  return keyList[key] ? t(key, keyList[key]) : t(key)
@@ -153,6 +154,11 @@ export const transformCountryCode = (countryCode : number) => {
153
154
  return code?.countryCode
154
155
  }
155
156
 
157
+ export const verifyCountryCode = (countryCode : string) => {
158
+ const code = CODES.find((code : any) => code.countryCode === (countryCode || '').toUpperCase())
159
+ return code?.countryCode
160
+ }
161
+
156
162
  /**
157
163
  * Function to check if a number is decimal or not
158
164
  * @param {*} value number to check if decimal or not
@@ -41,6 +41,7 @@ import { MapViewUI as MapView } from './src/components/MapView'
41
41
  import { NewOrderNotification } from './src/components/NewOrderNotification';
42
42
  import { DriverSchedule } from './src/components/DriverSchedule';
43
43
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
44
+ import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
44
45
  //OComponents
45
46
  import {
46
47
  OText,
@@ -110,6 +111,7 @@ export {
110
111
  VerifyPhone,
111
112
  DriverSchedule,
112
113
  ScheduleBlocked,
114
+ OrderDetailsLogistic,
113
115
  //OComponents
114
116
  OAlert,
115
117
  OButton,
@@ -7,23 +7,22 @@ import {
7
7
  View,
8
8
  KeyboardAvoidingView,
9
9
  TextInput,
10
- StyleSheet
10
+ StyleSheet,
11
+ TouchableOpacity
11
12
  } from 'react-native';
12
13
  import { useTheme } from 'styled-components/native';
13
14
  import SelectDropdown from 'react-native-select-dropdown'
14
- import { useLanguage, useSession } from 'ordering-components/native';
15
- import { Content, Timer, TimeField, Header, Action, Comments, CommentsButtonGroup } from './styles';
16
- import { FloatingButton } from '../FloatingButton';
17
- import { OText, OButton, OTextarea, OIconButton } from '../shared';
15
+ import { useLanguage } from 'ordering-components/native';
16
+ import { Content, Timer, TimeField, Header, Comments, CommentsButtonGroup, TopActions } from './styles';
17
+ import { OText, OButton, OTextarea, OIcon } from '../shared';
18
18
  import { AcceptOrRejectOrderParams } from '../../types';
19
- import { useSafeAreaInsets } from 'react-native-safe-area-context';
20
19
 
21
20
  import { orderCommentList } from '../../../../../src/utils'
22
21
 
23
22
  export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
24
23
  const {
24
+ isPage,
25
25
  customerCellphone,
26
- loading,
27
26
  action,
28
27
  handleUpdateOrder,
29
28
  actions,
@@ -35,7 +34,6 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
35
34
  } = props;
36
35
 
37
36
  const [, t] = useLanguage();
38
- const [{ user }] = useSession();
39
37
  const theme = useTheme();
40
38
  const scrollViewRef = useRef<any>(null);
41
39
  const viewRef = useRef<any>(null);
@@ -46,11 +44,9 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
46
44
  const [time, setTime] = useState('');
47
45
  const [comments, setComments] = useState('');
48
46
  const [rejectReason, setRejectReason] = useState(null);
49
- const [isKeyboardShow, setIsKeyboardShow] = useState(false);
50
- const { top, bottom } = useSafeAreaInsets()
47
+ const [keyboardState, setKeyboardState] = useState({ show: false, height: 0 });
51
48
 
52
49
  const isDriverApp = appTitle?.key === 'DELIVERY_APP'
53
-
54
50
  const orderCommentsList = orderCommentList(action)
55
51
 
56
52
  let codeNumberPhone, numberPhone, numberToShow;
@@ -93,6 +89,39 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
93
89
  alignItems: 'center',
94
90
  paddingHorizontal: 10
95
91
  },
92
+ parent: {
93
+ flex: 1,
94
+ backgroundColor: theme.colors.backgroundPage,
95
+ },
96
+ upper: {
97
+ flex: 1,
98
+ zIndex: 1001,
99
+ paddingTop: isPage ? 30 : 40,
100
+ marginBottom: 10,
101
+ backgroundColor: theme.colors.backgroundPage
102
+ },
103
+ bottomParent: {
104
+ justifyContent: "center",
105
+ paddingHorizontal: 30,
106
+ alignItems: "center",
107
+ width: '100%',
108
+ height: 45,
109
+ },
110
+ bottom: {
111
+ textAlignVertical: "center",
112
+ textAlign: "center",
113
+ },
114
+ btnBackArrow: {
115
+ borderWidth: 0,
116
+ width: 32,
117
+ height: 32,
118
+ tintColor: theme.colors.textGray,
119
+ backgroundColor: theme.colors.clear,
120
+ borderColor: theme.colors.clear,
121
+ shadowColor: theme.colors.clear,
122
+ paddingLeft: 0,
123
+ paddingRight: 0
124
+ },
96
125
  })
97
126
 
98
127
  const handleFocus = () => {
@@ -101,25 +130,6 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
101
130
  });
102
131
  };
103
132
 
104
- useEffect(() => {
105
- const keyboardDidShowListener = Keyboard.addListener(
106
- 'keyboardDidShow',
107
- () => {
108
- setIsKeyboardShow(true);
109
- },
110
- );
111
- const keyboardDidHideListener = Keyboard.addListener(
112
- 'keyboardDidHide',
113
- () => {
114
- setIsKeyboardShow(false);
115
- },
116
- );
117
- return () => {
118
- keyboardDidShowListener.remove();
119
- keyboardDidHideListener.remove();
120
- };
121
- }, []);
122
-
123
133
  if (!notShowCustomerPhone) {
124
134
  if (phoneNumber) {
125
135
  codeNumberPhone = phoneNumber.slice(0, 3);
@@ -172,15 +182,15 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
172
182
  };
173
183
 
174
184
  const openTimerIOnput = () => {
175
- const isFocus = timerRef.current.isFocused();
185
+ const isFocus = timerRef.current?.isFocused();
176
186
  if (isFocus) {
177
- timerRef.current.blur();
187
+ timerRef.current?.blur();
178
188
  }
179
189
 
180
190
  };
181
191
 
182
192
  const openTextTareaOInput = () => {
183
- const isFocus = textTareaRef.current.isFocused();
193
+ const isFocus = textTareaRef.current?.isFocused();
184
194
  if (isFocus && textTareaRef?.current) {
185
195
  textTareaRef.current.blur();
186
196
  }
@@ -281,227 +291,242 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
281
291
  }
282
292
  }, [timerRef?.current])
283
293
 
294
+ useEffect(() => {
295
+ const keyboardDidShowListener =
296
+ Keyboard.addListener('keyboardDidShow', (e) => setKeyboardState({
297
+ show: true,
298
+ height: e.endCoordinates.height > 100
299
+ ? Platform.OS == 'ios' ? e.endCoordinates.height : 0 : 0
300
+ }))
301
+ const keyboardDidHideListener =
302
+ Keyboard.addListener('keyboardDidHide', () => setKeyboardState({ show: false, height: 0 }))
303
+ return () => {
304
+ keyboardDidShowListener.remove()
305
+ keyboardDidHideListener.remove()
306
+ }
307
+ }, [])
308
+
284
309
  return (
285
- <KeyboardAvoidingView
286
- enabled
287
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
288
- style={{ flex: 1, paddingHorizontal: 30, paddingVertical: 30, marginTop: top, marginBottom: bottom, justifyContent: 'space-between' }}>
289
- <View>
290
- <OIconButton
291
- icon={theme.images.general.arrow_left}
292
- borderColor={theme.colors.clear}
293
- iconStyle={{ width: 20, height: 20 }}
294
- style={{
295
- maxWidth: 40,
296
- height: 35,
297
- justifyContent: 'flex-end',
298
- marginBottom: 30,
299
- }}
300
- onClick={() => handleArrowBack()}
301
- />
302
- <OText
303
- size={20}
304
- color={theme.colors.textGray}
305
- style={{
306
- fontFamily: 'Poppins',
307
- fontStyle: 'normal',
308
- }}
309
- weight="600">
310
- {titleOrder}
311
- </OText>
312
- </View>
313
- <Content showsVerticalScrollIndicator={false} ref={scrollViewRef}>
314
- <Header>
315
- {action === 'reject' && (
316
- <>
317
- {!notShowCustomerPhone && (
310
+ <KeyboardAvoidingView style={{ flex: 1 }}>
311
+ <View style={styles.parent}>
312
+ <View style={styles.upper}>
313
+ <TopActions>
314
+ <TouchableOpacity onPress={() => handleArrowBack()} style={styles.btnBackArrow}>
315
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
316
+ </TouchableOpacity>
317
+ <OText
318
+ size={20}
319
+ color={theme.colors.textGray}
320
+ style={{
321
+ fontFamily: 'Poppins',
322
+ fontStyle: 'normal',
323
+ marginBottom: 10,
324
+ }}
325
+ weight="600">
326
+ {titleOrder}
327
+ </OText>
328
+ </TopActions>
329
+ <Content showsVerticalScrollIndicator={false} ref={scrollViewRef}>
330
+ <Header>
331
+ {action === 'reject' && (
318
332
  <>
333
+ {!notShowCustomerPhone && (
334
+ <>
335
+ <OText
336
+ size={15}
337
+ color={theme.colors.textGray}
338
+ style={{ marginTop: 10 }}>
339
+ {t(
340
+ 'CALL_YOUR_CUSTOMER_TO_RESOLVE_THE_ISSUE_AS_POLITELY_AS_POSSIBLE',
341
+ 'Call your customer to resolve the issue as politely as possible',
342
+ )}
343
+ </OText>
344
+
345
+ {numberToShow ? (
346
+ <OButton
347
+ bgColor="transparent"
348
+ borderColor={theme.colors.primary}
349
+ textStyle={{
350
+ color: theme.colors.primary,
351
+ fontSize: 20,
352
+ }}
353
+ style={{
354
+ borderRadius: 10,
355
+ marginVertical: 20,
356
+ }}
357
+ imgLeftStyle={{
358
+ resizeMode: 'contain',
359
+ left: 20,
360
+ position: 'absolute',
361
+ }}
362
+ imgLeftSrc={theme.images.general.cellphone}
363
+ text={numberToShow}
364
+ onClick={() =>
365
+ Linking.openURL(`tel:${customerCellphone}`)
366
+ }
367
+ />
368
+ ) : (
369
+ <OButton
370
+ bgColor="transparent"
371
+ borderColor={theme.colors.primary}
372
+ textStyle={{
373
+ color: theme.colors.primary,
374
+ fontSize: 15,
375
+ }}
376
+ style={{
377
+ borderRadius: 10,
378
+ marginVertical: 20,
379
+ }}
380
+ imgLeftStyle={{
381
+ resizeMode: 'contain',
382
+ left: 20,
383
+ position: 'absolute',
384
+ }}
385
+ isDisabled={true}
386
+ imgLeftSrc={theme.images.general.cellphone}
387
+ text={t('NOT_NUMBER', "There's not phonenumber.")}
388
+ onClick={() =>
389
+ Linking.openURL(`tel:${customerCellphone}`)
390
+ }
391
+ />
392
+ )}
393
+ </>
394
+ )}
395
+
319
396
  <OText
320
397
  size={15}
321
398
  color={theme.colors.textGray}
322
- style={{ marginTop: 10 }}>
399
+ style={{ marginBottom: 10 }}>
323
400
  {t(
324
- 'CALL_YOUR_CUSTOMER_TO_RESOLVE_THE_ISSUE_AS_POLITELY_AS_POSSIBLE',
325
- 'Call your customer to resolve the issue as politely as possible',
401
+ 'MARK_THE_ORDER_AS_REJECTED',
402
+ 'Mark the order as rejected',
326
403
  )}
327
404
  </OText>
328
405
 
329
- {numberToShow ? (
330
- <OButton
331
- bgColor="transparent"
332
- borderColor={theme.colors.primary}
333
- textStyle={{
334
- color: theme.colors.primary,
335
- fontSize: 20,
336
- }}
337
- style={{
338
- borderRadius: 10,
339
- marginVertical: 20,
340
- }}
341
- imgLeftStyle={{
342
- resizeMode: 'contain',
343
- left: 20,
344
- position: 'absolute',
345
- }}
346
- imgLeftSrc={theme.images.general.cellphone}
347
- text={numberToShow}
348
- onClick={() =>
349
- Linking.openURL(`tel:${customerCellphone}`)
350
- }
351
- />
352
- ) : (
353
- <OButton
354
- bgColor="transparent"
355
- borderColor={theme.colors.primary}
356
- textStyle={{
357
- color: theme.colors.primary,
358
- fontSize: 15,
359
- }}
360
- style={{
361
- borderRadius: 10,
362
- marginVertical: 20,
363
- }}
364
- imgLeftStyle={{
365
- resizeMode: 'contain',
366
- left: 20,
367
- position: 'absolute',
368
- }}
369
- isDisabled={true}
370
- imgLeftSrc={theme.images.general.cellphone}
371
- text={t('NOT_NUMBER', "There's not phonenumber.")}
372
- onClick={() =>
373
- Linking.openURL(`tel:${customerCellphone}`)
374
- }
375
- />
376
- )}
406
+ <OText>
407
+ <OText style={{ fontWeight: '600' }}>
408
+ {t('NOTE', 'Note')}
409
+ {': '}
410
+ </OText>
411
+
412
+ <OText size={15} color={theme.colors.textGray}>
413
+ {t(
414
+ 'YOUR_CUSTOMER_WILL_RECEIVE_A_NOTIFICATION_ABOUT_THIS_ACTIONS',
415
+ 'Your customer will receive a notification about this actions',
416
+ )}
417
+ </OText>
418
+ </OText>
377
419
  </>
378
420
  )}
421
+ </Header>
379
422
 
380
- <OText
381
- size={15}
382
- color={theme.colors.textGray}
383
- style={{ marginBottom: 10 }}>
384
- {t(
385
- 'MARK_THE_ORDER_AS_REJECTED',
386
- 'Mark the order as rejected',
387
- )}
388
- </OText>
389
-
390
- <OText>
391
- <OText style={{ fontWeight: '600' }}>
392
- {t('NOTE', 'Note')}
393
- {': '}
394
- </OText>
395
-
396
- <OText size={15} color={theme.colors.textGray}>
397
- {t(
398
- 'YOUR_CUSTOMER_WILL_RECEIVE_A_NOTIFICATION_ABOUT_THIS_ACTIONS',
399
- 'Your customer will receive a notification about this actions',
400
- )}
401
- </OText>
402
- </OText>
403
- </>
404
- )}
405
- </Header>
406
-
407
- {action === 'accept' && (
408
- <View style={{ height: 400, justifyContent: 'center' }}>
409
- <Timer onPress={() => openTimerIOnput()}>
410
- <OText weight="600" style={{ textAlign: 'center' }} size={55}>
411
- {hour}
412
- </OText>
413
- {hour.length > 0 && <OText size={55}>:</OText>}
414
- <OText weight="600" style={{ textAlign: 'center' }} size={55}>
415
- {min}
416
- </OText>
417
- </Timer>
418
- </View>
419
- )}
420
- <TimeField
421
- ref={timerRef}
422
- keyboardType="numeric"
423
- value={time}
424
- placeholder={'00:00'}
425
- onChangeText={handleTime}
426
- onPressOut={() => handleFixTime()}
427
- editable={true}
428
- selectionColor={theme.colors.primary}
429
- placeholderTextColor={theme.colors.textGray}
430
- color={theme.colors.textGray}
431
- onEndEditing={handleFixTime}
432
- onSubmitEditing={() => handleAcceptOrReject()}
433
- onBlur={() => actions && action === 'accept' && timerRef?.current?.focus?.()}
434
- />
435
-
436
- {orderCommentsList && isDriverApp && (
437
- <CommentsButtonGroup>
438
- <SelectDropdown
439
- defaultButtonText={t('REJECT_REASONS_OPTIONS', 'Reject reasons')}
440
- data={orderCommentsList?.list}
441
- onSelect={(selectedItem) => {
442
- setRejectReason(selectedItem?.value)
443
- }}
444
- buttonTextAfterSelection={(selectedItem) => selectedItem.content}
445
- rowTextForSelection={(item) => item.key}
446
- buttonStyle={styles.selectOption}
447
- buttonTextStyle={styles.buttonTextStyle}
448
- renderDropdownIcon={isOpened => {
449
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
450
- }}
451
- dropdownStyle={styles.dropdownStyle}
452
- dropdownOverlayColor='transparent'
453
- rowStyle={styles.rowStyle}
454
- renderCustomizedRowChild={(item) => {
455
- return (
456
- <View
457
- style={{
458
- flexDirection: 'row',
459
- alignItems: 'center'
460
- }}
461
- >
462
- <View>
463
- <OText
464
- size={14}
465
- color={'#748194'}
466
- style={{ textTransform: 'capitalize' }}
467
- >
468
- {item?.content}
469
- </OText>
470
- </View>
471
- </View>
472
- );
473
- }}
474
- />
475
- </CommentsButtonGroup>
476
- )}
477
-
478
- {showTextArea && (
479
- <Comments ref={viewRef}>
480
- <OTextarea
481
- textTareaRef={textTareaRef}
482
- autoFocus
483
- onFocus={handleFocus}
484
- placeholder={t(
485
- 'PLEASE_TYPE_YOUR_COMMENTS_IN_HERE',
486
- 'Please type your comments in here',
487
- )}
488
- value={comments}
489
- onChange={setComments}
423
+ {action === 'accept' && (
424
+ <View style={{ height: 300, justifyContent: 'center' }}>
425
+ <Timer onPress={() => openTimerIOnput()}>
426
+ <OText weight="600" style={{ textAlign: 'center' }} size={55}>
427
+ {hour}
428
+ </OText>
429
+ {hour.length > 0 && <OText size={55}>:</OText>}
430
+ <OText weight="600" style={{ textAlign: 'center' }} size={55}>
431
+ {min}
432
+ </OText>
433
+ </Timer>
434
+ </View>
435
+ )}
436
+ <TimeField
437
+ ref={timerRef}
438
+ keyboardType="numeric"
439
+ value={time}
440
+ placeholder={'00:00'}
441
+ onChangeText={handleTime}
442
+ onPressOut={() => handleFixTime()}
443
+ editable={true}
444
+ selectionColor={theme.colors.primary}
445
+ placeholderTextColor={theme.colors.textGray}
446
+ color={theme.colors.textGray}
447
+ onEndEditing={handleFixTime}
448
+ onSubmitEditing={() => handleAcceptOrReject()}
449
+ onBlur={() => actions && action === 'accept' && timerRef?.current?.focus?.()}
490
450
  />
491
- </Comments>
492
- )}
493
- </Content>
494
-
495
- <Action>
496
- <FloatingButton
497
- firstButtonClick={() => {
498
- handleAcceptOrReject();
451
+
452
+ {orderCommentsList && isDriverApp && (
453
+ <CommentsButtonGroup>
454
+ <SelectDropdown
455
+ defaultButtonText={t('REJECT_REASONS_OPTIONS', 'Reject reasons')}
456
+ data={orderCommentsList?.list}
457
+ onSelect={(selectedItem) => {
458
+ setRejectReason(selectedItem?.value)
459
+ }}
460
+ buttonTextAfterSelection={(selectedItem) => selectedItem.content}
461
+ rowTextForSelection={(item) => item.key}
462
+ buttonStyle={styles.selectOption}
463
+ buttonTextStyle={styles.buttonTextStyle}
464
+ renderDropdownIcon={isOpened => {
465
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
466
+ }}
467
+ dropdownStyle={styles.dropdownStyle}
468
+ dropdownOverlayColor='transparent'
469
+ rowStyle={styles.rowStyle}
470
+ renderCustomizedRowChild={(item) => {
471
+ return (
472
+ <View
473
+ style={{
474
+ flexDirection: 'row',
475
+ alignItems: 'center'
476
+ }}
477
+ >
478
+ <View>
479
+ <OText
480
+ size={14}
481
+ color={'#748194'}
482
+ style={{ textTransform: 'capitalize' }}
483
+ >
484
+ {item?.content}
485
+ </OText>
486
+ </View>
487
+ </View>
488
+ );
489
+ }}
490
+ />
491
+ </CommentsButtonGroup>
492
+ )}
493
+
494
+ {showTextArea && (
495
+ <Comments ref={viewRef}>
496
+ <OTextarea
497
+ textTareaRef={textTareaRef}
498
+ autoFocus
499
+ onFocus={handleFocus}
500
+ placeholder={t(
501
+ 'PLEASE_TYPE_YOUR_COMMENTS_IN_HERE',
502
+ 'Please type your comments in here',
503
+ )}
504
+ value={comments}
505
+ onChange={setComments}
506
+ />
507
+ </Comments>
508
+ )}
509
+ </Content>
510
+ </View>
511
+ <View
512
+ style={{
513
+ ...styles.bottomParent,
514
+ marginBottom: (keyboardState.height === 0) ? isPage ? 0 : 30 : keyboardState.height - (isPage ? 20 : -10)
499
515
  }}
500
- btnText={buttonText}
501
- color={action === 'accept' ? theme.colors.green : theme.colors.red}
502
- widthButton={'100%'}
503
- />
504
- </Action>
516
+ >
517
+ <OButton
518
+ text={buttonText}
519
+ bgColor={action === 'accept' ? theme.colors.green : theme.colors.red}
520
+ borderColor={action === 'accept' ? theme.colors.green : theme.colors.red}
521
+ imgRightSrc={null}
522
+ style={{ borderRadius: 7, height: 45 }}
523
+ parentStyle={{ width: '100%' }}
524
+ textStyle={{ color: '#FFF', fontSize: 18 }}
525
+ isDisabled={showTextArea && !comments}
526
+ onClick={() => handleAcceptOrReject()}
527
+ />
528
+ </View>
529
+ </View>
505
530
  </KeyboardAvoidingView>
506
531
  );
507
532
  };