ordering-ui-react-native 0.12.35 → 0.12.39

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 (54) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressForm/index.tsx +5 -5
  3. package/src/components/FacebookLogin/index.tsx +2 -2
  4. package/src/components/LoginForm/index.tsx +1 -1
  5. package/src/components/PaymentOptions/index.tsx +5 -5
  6. package/src/components/SignupForm/index.tsx +2 -2
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -8
  8. package/themes/business/src/components/LoginForm/index.tsx +1 -1
  9. package/themes/business/src/components/OrderDetails/Business.tsx +2 -4
  10. package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -108
  11. package/themes/business/src/components/SearchBar/index.tsx +1 -1
  12. package/themes/business/src/components/SignupForm/index.tsx +2 -2
  13. package/themes/business/src/types/index.tsx +3 -3
  14. package/themes/doordash/src/components/AddressForm/index.tsx +5 -5
  15. package/themes/doordash/src/components/FacebookLogin/index.tsx +2 -2
  16. package/themes/doordash/src/components/LoginForm/index.tsx +1 -1
  17. package/themes/doordash/src/components/PaymentOptions/index.tsx +5 -5
  18. package/themes/doordash/src/components/SignupForm/index.tsx +2 -2
  19. package/themes/franchises/src/components/AddressForm/index.tsx +5 -5
  20. package/themes/franchises/src/components/FacebookLogin/index.tsx +2 -2
  21. package/themes/franchises/src/components/LoginForm/index.tsx +1 -1
  22. package/themes/franchises/src/components/PaymentOptions/index.tsx +3 -3
  23. package/themes/franchises/src/components/SignupForm/index.tsx +2 -2
  24. package/themes/instacart/src/components/AddressForm/index.tsx +5 -5
  25. package/themes/instacart/src/components/FacebookLogin/index.tsx +2 -2
  26. package/themes/instacart/src/components/LoginForm/index.tsx +1 -1
  27. package/themes/instacart/src/components/PaymentOptions/index.tsx +4 -4
  28. package/themes/instacart/src/components/SignupForm/index.tsx +2 -2
  29. package/themes/original/src/components/AddressForm/index.tsx +5 -5
  30. package/themes/original/src/components/FacebookLogin/index.tsx +2 -2
  31. package/themes/original/src/components/LoginForm/index.tsx +1 -1
  32. package/themes/original/src/components/PaymentOptions/index.tsx +5 -5
  33. package/themes/original/src/components/SignupForm/index.tsx +2 -2
  34. package/themes/single-business/src/components/AddressForm/index.tsx +5 -5
  35. package/themes/single-business/src/components/AppleLogin/index.tsx +2 -2
  36. package/themes/single-business/src/components/FacebookLogin/index.tsx +2 -2
  37. package/themes/single-business/src/components/GoogleLogin/index.tsx +2 -2
  38. package/themes/single-business/src/components/LanguageSelector/index.tsx +87 -70
  39. package/themes/single-business/src/components/LoginForm/index.tsx +1 -1
  40. package/themes/single-business/src/components/OrderDetails/index.tsx +14 -14
  41. package/themes/single-business/src/components/PaymentOptions/index.tsx +4 -4
  42. package/themes/single-business/src/components/ProductForm/index.tsx +682 -656
  43. package/themes/single-business/src/components/ProductForm/styles.tsx +1 -1
  44. package/themes/single-business/src/components/SignupForm/index.tsx +2 -2
  45. package/themes/single-business/src/components/UserProfile/index.tsx +2 -2
  46. package/themes/single-business/src/components/shared/OInput.tsx +1 -0
  47. package/themes/single-business/src/components/shared/OLink.tsx +80 -0
  48. package/themes/single-business/src/components/shared/index.tsx +2 -0
  49. package/themes/single-business/src/types/index.tsx +1 -0
  50. package/themes/uber-eats/src/components/AddressForm/index.tsx +5 -5
  51. package/themes/uber-eats/src/components/FacebookLogin/index.tsx +2 -2
  52. package/themes/uber-eats/src/components/LoginForm/index.tsx +1 -1
  53. package/themes/uber-eats/src/components/PaymentOptions/index.tsx +5 -5
  54. package/themes/uber-eats/src/components/SignupForm/index.tsx +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.35",
3
+ "version": "0.12.39",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -513,7 +513,7 @@ const AddressFormUI = (props: AddressFormParams) => {
513
513
  }
514
514
  setIsFirstTime(false)
515
515
  },
516
- onSubmitEditing: () => internalNumberRef.current.focus(),
516
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
517
517
  autoCorrect: false,
518
518
  blurOnSubmit: false,
519
519
  returnKeyType: 'next'
@@ -573,7 +573,7 @@ const AddressFormUI = (props: AddressFormParams) => {
573
573
  control={control}
574
574
  name='internal_number'
575
575
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
576
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
576
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
577
577
  render={() => (
578
578
  <OInput
579
579
  name='internal_number'
@@ -582,11 +582,11 @@ const AddressFormUI = (props: AddressFormParams) => {
582
582
  handleChangeInput(text)
583
583
  setValue('internal_number', text)
584
584
  }}
585
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
585
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
586
586
  style={styles.inputsStyle}
587
587
  forwardRef={internalNumberRef}
588
588
  returnKeyType='next'
589
- onSubmitEditing={() => zipCodeRef.current.focus()}
589
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
590
590
  blurOnSubmit={false}
591
591
  />
592
592
  )}
@@ -609,7 +609,7 @@ const AddressFormUI = (props: AddressFormParams) => {
609
609
  style={styles.inputsStyle}
610
610
  forwardRef={zipCodeRef}
611
611
  returnKeyType='next'
612
- onSubmitEditing={() => addressNotesRef.current.focus()}
612
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
613
613
  blurOnSubmit={false}
614
614
  />
615
615
  )}
@@ -26,7 +26,7 @@ export const FacebookLogin = (props: any) => {
26
26
  : t('LOGIN_WITH_FACEBOOK', 'Login with Facebook');
27
27
 
28
28
  const logoutWithFacebook = () => {
29
- LoginManager.logOut();
29
+ LoginManager && LoginManager.logOut();
30
30
  };
31
31
 
32
32
  const handleLoginClick = async (accessToken: string) => {
@@ -57,7 +57,7 @@ export const FacebookLogin = (props: any) => {
57
57
 
58
58
  const loginWithFacebook = () => {
59
59
  handleLoading && handleLoading(true)
60
- LoginManager.logInWithPermissions(['public_profile']).then(
60
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
61
61
  (login: any) => {
62
62
  if (login.isCancelled) {
63
63
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -270,7 +270,7 @@ const LoginFormUI = (props: LoginParams) => {
270
270
  handleData={(val: any) => setPhoneInputData(val)}
271
271
  textInputProps={{
272
272
  returnKeyType: 'next',
273
- onSubmitEditing: () => inputRef.current.focus(),
273
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
274
274
  }}
275
275
  />
276
276
  </View>
@@ -159,7 +159,7 @@ const PaymentOptionsUI = (props: any) => {
159
159
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
160
160
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeGateway.includes(p.gateway))}
161
161
  renderItem={renderPaymethods}
162
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
162
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
163
163
  />
164
164
  )}
165
165
  {(paymethodsList.loading || isLoading) && (
@@ -232,7 +232,7 @@ const PaymentOptionsUI = (props: any) => {
232
232
  )}
233
233
 
234
234
  {/* Stripe */}
235
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
235
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
236
236
  <View style={{ width: '100%' }}>
237
237
  <OButton
238
238
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -281,7 +281,7 @@ const PaymentOptionsUI = (props: any) => {
281
281
  <OModal
282
282
  entireModal
283
283
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
284
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
284
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
285
285
  onClose={() => handlePaymethodClick(null)}
286
286
  >
287
287
  <KeyboardAvoidingView
@@ -299,7 +299,7 @@ const PaymentOptionsUI = (props: any) => {
299
299
  </OModal>
300
300
 
301
301
  {/* Stripe Connect */}
302
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
302
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
303
303
  <View>
304
304
  <OButton
305
305
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -365,7 +365,7 @@ const PaymentOptionsUI = (props: any) => {
365
365
  {/* Paypal */}
366
366
  {/* <Modal
367
367
  className='modal-info'
368
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
368
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
369
369
  onClose={() => handlePaymethodClick(null)}
370
370
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
371
371
  >
@@ -368,7 +368,7 @@ const SignupFormUI = (props: SignupParams) => {
368
368
  returnKeyType='next'
369
369
  blurOnSubmit={false}
370
370
  forwardRef={(ref : any) => handleRefs(ref,field.code)}
371
- onSubmitEditing={() => field.code === 'email' ? phoneRef.current.focus() : handleFocusRef(getNextFieldCode(i))}
371
+ onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
372
372
  />
373
373
  )}
374
374
  name={field.code}
@@ -387,7 +387,7 @@ const SignupFormUI = (props: SignupParams) => {
387
387
  forwardRef={phoneRef}
388
388
  textInputProps={{
389
389
  returnKeyType: 'next',
390
- onSubmitEditing: () => passwordRef.current.focus()
390
+ onSubmitEditing: () => passwordRef?.current?.focus?.()
391
391
  }}
392
392
  />
393
393
  </View>
@@ -40,12 +40,14 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
40
40
  const [time, setTime] = useState('');
41
41
  const [comments, setComments] = useState('');
42
42
  const [isKeyboardShow, setIsKeyboardShow] = useState(false);
43
- const phoneNumber = customerCellphone;
44
- let codeNumberPhone, numberPhone, numberToShow;
45
43
  const { top, bottom } = useSafeAreaInsets()
46
- const titleOrder = t(orderTitle[action].key, orderTitle[action].text)
47
- const buttonText = t(orderTitle[action].btnKey, orderTitle[action].btnText)
44
+
45
+ let codeNumberPhone, numberPhone, numberToShow;
46
+ const phoneNumber = customerCellphone;
47
+ const titleOrder = t(orderTitle[action]?.key, orderTitle[action]?.text)
48
+ const buttonText = t(orderTitle[action]?.btnKey, orderTitle[action]?.btnText)
48
49
  const showTextArea = ['reject', 'deliveryFailed', 'pickupFailed', 'notReady'].includes(action)
50
+
49
51
  const handleFocus = () => {
50
52
  viewRef?.current?.measure((x: any, y: any) => {
51
53
  scrollViewRef?.current?.scrollTo({ x: 0, y });
@@ -136,7 +138,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
136
138
 
137
139
  if (!isFocus) {
138
140
  if (time.length > 1) timerRef.current.clear();
139
- timerRef.current.focus();
141
+ timerRef?.current?.focus?.();
140
142
  handleFocusTimer();
141
143
  }
142
144
  };
@@ -148,7 +150,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
148
150
  }
149
151
 
150
152
  if (!isFocus && textTareaRef?.current) {
151
- textTareaRef.current.focus();
153
+ textTareaRef?.current?.focus?.();
152
154
  }
153
155
  };
154
156
 
@@ -161,7 +163,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
161
163
 
162
164
  const time = parseInt(hour || '0') * 60 + (parseInt(minsToSend) || 0);
163
165
 
164
- let bodyToSend;
166
+ let bodyToSend : any = {};
165
167
  const orderStatus: any = {
166
168
  acceptByBusiness: {
167
169
  prepared_in: time,
@@ -210,7 +212,6 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
210
212
  }
211
213
 
212
214
  bodyToSend.id = orderId;
213
-
214
215
  handleUpdateOrder && handleUpdateOrder(bodyToSend.status, bodyToSend);
215
216
  };
216
217
 
@@ -535,7 +535,7 @@ const LoginFormUI = (props: LoginParams) => {
535
535
  onSubmitEditing={() => null}
536
536
  textInputProps={{
537
537
  returnKeyType: 'next',
538
- onSubmitEditing: () => inputRef.current.focus(),
538
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
539
539
  }}
540
540
  />
541
541
  </View>
@@ -48,8 +48,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
48
48
  isFromCheckout,
49
49
  driverLocation,
50
50
  actions,
51
- titleAccept,
52
- titleReject,
51
+ orderTitle,
53
52
  appTitle,
54
53
  } = props;
55
54
 
@@ -607,8 +606,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
607
606
  orderId={order?.id}
608
607
  notShowCustomerPhone={false}
609
608
  actions={actions}
610
- titleAccept={titleAccept}
611
- titleReject={titleReject}
609
+ orderTitle={orderTitle}
612
610
  appTitle={appTitle}
613
611
  />
614
612
  </OModal>
@@ -128,6 +128,36 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
128
128
  setOpenModalForAccept(true);
129
129
  };
130
130
 
131
+ const handleCloseModal = () => {
132
+ setOpenModalForBusiness(false);
133
+ };
134
+
135
+ const handleArrowBack: any = () => {
136
+ navigation?.canGoBack() && navigation.goBack();
137
+ };
138
+
139
+ const handleRejectLogisticOrder = () => {
140
+ handleClickLogisticOrder?.(2, order?.logistic_order_id)
141
+ handleArrowBack()
142
+ }
143
+
144
+ const locations = [
145
+ {
146
+ ...order?.business?.location,
147
+ title: order?.business?.name,
148
+ icon: order?.business?.logo || theme.images.dummies.businessLogo,
149
+ type: 'Business',
150
+ },
151
+ {
152
+ ...order?.customer?.location,
153
+ title: order?.customer?.name,
154
+ icon:
155
+ order?.customer?.photo ||
156
+ 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
157
+ type: 'Customer',
158
+ },
159
+ ];
160
+
131
161
  useEffect(() => {
132
162
  if (permissions.locationStatus !== 'granted' && openModalForMapView) {
133
163
  setOpenModalForMapView(false);
@@ -146,20 +176,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
146
176
  if (openModalForMapView) {
147
177
  setOpenModalForMapView(false);
148
178
  }
149
- }, [order?.loading]);
150
-
151
- const handleCloseModal = () => {
152
- setOpenModalForBusiness(false);
153
- };
154
-
155
- const handleArrowBack: any = () => {
156
- navigation?.canGoBack() && navigation.goBack();
157
- };
158
-
159
- const handleRejectLogisticOrder = () => {
160
- handleClickLogisticOrder?.(2, order?.logistic_order_id)
161
- handleArrowBack()
162
- }
179
+ }, [props.order?.loading]);
163
180
 
164
181
  useEffect(() => {
165
182
  if (order?.driver === null && session?.user?.level === 4) {
@@ -176,23 +193,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
176
193
  }
177
194
  }, [order?.driver]);
178
195
 
179
- const locations = [
180
- {
181
- ...order?.business?.location,
182
- title: order?.business?.name,
183
- icon: order?.business?.logo || theme.images.dummies.businessLogo,
184
- type: 'Business',
185
- },
186
- {
187
- ...order?.customer?.location,
188
- title: order?.customer?.name,
189
- icon:
190
- order?.customer?.photo ||
191
- 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
192
- type: 'Customer',
193
- },
194
- ];
195
-
196
196
  useEffect(() => {
197
197
  if (driverLocation) {
198
198
  locations[0] = driverLocation;
@@ -270,7 +270,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
270
270
  />
271
271
  </Pickup>
272
272
  )}
273
- {(order?.status === 3) && order?.delivery_type === 1 && (
273
+ {order?.status === 3 && order?.delivery_type === 1 && (
274
274
  <View style={{ paddingVertical: 20, marginBottom: 20 }}>
275
275
  <OButton
276
276
  style={styles.btnPickUp}
@@ -285,67 +285,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
285
285
  </View>
286
286
  )}
287
287
  </>
288
-
289
- <OModal
290
- open={openModalForBusiness}
291
- order={order}
292
- title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
293
- entireModal
294
- onClose={() => handleCloseModal()}>
295
- <Chat
296
- type={
297
- openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
298
- }
299
- orderId={order?.id}
300
- messages={messages}
301
- order={order}
302
- setMessages={setMessages}
303
- />
304
- </OModal>
305
-
306
- <OModal
307
- open={openModalForAccept}
308
- onClose={() => setOpenModalForAccept(false)}
309
- entireModal
310
- customClose>
311
- <AcceptOrRejectOrder
312
- handleUpdateOrder={handleChangeOrderStatus}
313
- closeModal={setOpenModalForAccept}
314
- customerCellphone={order?.customer?.cellphone}
315
- loading={order?.loading}
316
- action={actionOrder}
317
- orderId={order?.id}
318
- notShowCustomerPhone
319
- actions={actions}
320
- orderTitle={orderTitle}
321
- appTitle={appTitle}
322
- />
323
- </OModal>
324
-
325
- <OModal
326
- open={openModalForMapView}
327
- onClose={() => handleOpenMapView()}
328
- entireModal
329
- customClose>
330
- <DriverMap
331
- navigation={navigation}
332
- order={order}
333
- orderStatus={getOrderStatus(order?.status, t)?.value || ''}
334
- location={locationMarker}
335
- readOnly
336
- updateDriverPosition={updateDriverPosition}
337
- driverUpdateLocation={driverUpdateLocation}
338
- setDriverUpdateLocation={setDriverUpdateLocation}
339
- handleViewActionOrder={handleViewActionOrder}
340
- isBusinessMarker={isBusinessMarker}
341
- isToFollow={isToFollow}
342
- showAcceptOrReject={
343
- showFloatButtonsAcceptOrReject[order?.status]
344
- }
345
- handleOpenMapView={handleOpenMapView}
346
- />
347
- </OModal>
348
-
349
288
  <View
350
289
  style={{
351
290
  height:
@@ -356,14 +295,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
356
295
 
357
296
  {showFloatButtonsPickUp[order?.status] && (
358
297
  <FloatingButton
359
- disabled={order?.loading}
298
+ disabled={props.order?.loading}
360
299
  btnText={t('PICKUP_FAILED', 'Pickup failed')}
361
300
  isSecondaryBtn={false}
362
301
  secondButtonClick={() =>
363
302
  handleChangeOrderStatus && handleChangeOrderStatus(9)
364
303
  }
365
304
  firstButtonClick={() =>
366
- handleViewActionOrder && handleViewActionOrder('failed')
305
+ handleViewActionOrder && handleViewActionOrder('pickupFailed')
367
306
  }
368
307
  secondBtnText={t('PICKUP_COMPLETE', 'Pickup complete')}
369
308
  secondButton={true}
@@ -375,14 +314,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
375
314
  {(order?.status === 9 || order?.status === 19) && (
376
315
  <>
377
316
  <FloatingButton
378
- disabled={order?.loading}
317
+ disabled={props.order?.loading}
379
318
  btnText={t('DELIVERY_FAILED', 'Delivery Failed')}
380
319
  isSecondaryBtn={false}
381
320
  secondButtonClick={() =>
382
321
  handleChangeOrderStatus && handleChangeOrderStatus(11)
383
322
  }
384
323
  firstButtonClick={() =>
385
- handleViewActionOrder && handleViewActionOrder('failed')
324
+ handleViewActionOrder && handleViewActionOrder('deliveryFailed')
386
325
  }
387
326
  secondBtnText={t('DELIVERY_COMPLETE', 'Delivery complete')}
388
327
  secondButton={true}
@@ -405,14 +344,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
405
344
  widthButton={'45%'}
406
345
  />
407
346
  )}
408
-
409
- <Alert
410
- open={alertState.open}
411
- onAccept={handleArrowBack}
412
- onClose={handleArrowBack}
413
- content={alertState.content}
414
- title={t('WARNING', 'Warning')}
415
- />
416
347
  </>
417
348
  )
418
349
  }
@@ -420,7 +351,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
420
351
  return (
421
352
  <>
422
353
  {(!order || Object.keys(order).length === 0) &&
423
- (order?.error?.length < 1 || !order?.error) && (
354
+ (props.order?.error?.length < 1 || !props.order?.error) && (
424
355
  <View style={{ flex: 1 }}>
425
356
  {[...Array(6)].map((item, i) => (
426
357
  <Placeholder key={i} Animation={Fade}>
@@ -437,7 +368,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
437
368
  </View>
438
369
  )}
439
370
 
440
- {(!!order?.error || order?.error) && (
371
+ {(!!props.order?.error || props.order?.error) && (
441
372
  <NotFoundSource
442
373
  btnTitle={t('GO_TO_MY_ORDERS', 'Go to my orders')}
443
374
  content={
@@ -457,7 +388,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
457
388
  handleArrowBack={handleArrowBack}
458
389
  logisticOrderStatus={logisticOrderStatus}
459
390
  />
460
- {order && Object.keys(order).length > 0 && (order?.error?.length < 1 || !order?.error) && (
391
+ {order && Object.keys(order).length > 0 && (props.order?.error?.length < 1 || !props.order?.error) && (
461
392
  <>
462
393
  {order?.order_group && order?.order_group_id ? order?.order_group?.orders.map((order: any) => (
463
394
  <OrderDetailsInformation order={order} />
@@ -466,7 +397,79 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
466
397
  )}
467
398
  </>
468
399
  )}
400
+ {openModalForMapView && (
401
+ <OModal
402
+ open={openModalForMapView}
403
+ onClose={() => handleOpenMapView()}
404
+ entireModal
405
+ customClose>
406
+ <DriverMap
407
+ navigation={navigation}
408
+ order={order}
409
+ orderStatus={getOrderStatus(order?.status, t)?.value || ''}
410
+ location={locationMarker}
411
+ readOnly
412
+ updateDriverPosition={updateDriverPosition}
413
+ driverUpdateLocation={driverUpdateLocation}
414
+ setDriverUpdateLocation={setDriverUpdateLocation}
415
+ handleViewActionOrder={handleViewActionOrder}
416
+ isBusinessMarker={isBusinessMarker}
417
+ isToFollow={isToFollow}
418
+ showAcceptOrReject={
419
+ showFloatButtonsAcceptOrReject[order?.status]
420
+ }
421
+ handleOpenMapView={handleOpenMapView}
422
+ />
423
+ </OModal>
424
+ )}
425
+ {openModalForBusiness && (
426
+ <OModal
427
+ open={openModalForBusiness}
428
+ order={order}
429
+ title={`${t('INVOICE_ORDER_NO', 'Order No.')} ${order.id}`}
430
+ entireModal
431
+ onClose={() => handleCloseModal()}>
432
+ <Chat
433
+ type={
434
+ openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER
435
+ }
436
+ orderId={order?.id}
437
+ messages={messages}
438
+ order={order}
439
+ setMessages={setMessages}
440
+ />
441
+ </OModal>
442
+ )}
443
+ {openModalForAccept && (
444
+ <OModal
445
+ open={openModalForAccept}
446
+ onClose={() => setOpenModalForAccept(false)}
447
+ entireModal
448
+ customClose>
449
+ <AcceptOrRejectOrder
450
+ handleUpdateOrder={handleChangeOrderStatus}
451
+ closeModal={setOpenModalForAccept}
452
+ customerCellphone={order?.customer?.cellphone}
453
+ loading={props.order?.loading}
454
+ action={actionOrder}
455
+ orderId={order?.id}
456
+ notShowCustomerPhone
457
+ actions={actions}
458
+ orderTitle={orderTitle}
459
+ appTitle={appTitle}
460
+ />
461
+ </OModal>
462
+ )}
469
463
  </View>
464
+ {alertState?.open && (
465
+ <Alert
466
+ open={alertState.open}
467
+ onAccept={handleArrowBack}
468
+ onClose={handleArrowBack}
469
+ content={alertState.content}
470
+ title={t('WARNING', 'Warning')}
471
+ />
472
+ )}
470
473
  </>
471
474
  );
472
475
  };
@@ -27,7 +27,7 @@ export const SearchBar = (props: any) => {
27
27
  };
28
28
 
29
29
  const handleActiveInput = () => {
30
- inputRef.current.focus();
30
+ inputRef?.current?.focus?.();
31
31
  };
32
32
 
33
33
  let timeout: null | any = null;
@@ -392,7 +392,7 @@ const SignupFormUI = (props: SignupParams) => {
392
392
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
393
393
  onSubmitEditing={() =>
394
394
  field.code === 'email'
395
- ? phoneRef.current.focus()
395
+ ? phoneRef?.current?.focus?.()
396
396
  : handleFocusRef(getNextFieldCode(i))
397
397
  }
398
398
  />
@@ -414,7 +414,7 @@ const SignupFormUI = (props: SignupParams) => {
414
414
  onSubmitEditing={() => null}
415
415
  textInputProps={{
416
416
  returnKeyType: 'next',
417
- onSubmitEditing: () => passwordRef.current.focus(),
417
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
418
418
  }}
419
419
  />
420
420
  </View>
@@ -526,9 +526,9 @@ export interface TagsParams {
526
526
  interface actions {
527
527
  accept: string;
528
528
  reject: string;
529
- pickupFailed: string;
530
- deliveryFailed: string;
531
- notReady: string;
529
+ pickupFailed?: string;
530
+ deliveryFailed?: string;
531
+ notReady?: string;
532
532
  }
533
533
 
534
534
  interface textTranslate {
@@ -437,7 +437,7 @@ const AddressFormUI = (props: AddressFormParams) => {
437
437
  }
438
438
  setIsFirstTime(false)
439
439
  },
440
- onSubmitEditing: () => internalNumberRef.current.focus(),
440
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
441
441
  autoCorrect: false,
442
442
  blurOnSubmit: false,
443
443
  returnKeyType: 'next'
@@ -499,7 +499,7 @@ const AddressFormUI = (props: AddressFormParams) => {
499
499
  control={control}
500
500
  name='internal_number'
501
501
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
502
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
502
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
503
503
  render={() => (
504
504
  <OInput
505
505
  name='internal_number'
@@ -508,11 +508,11 @@ const AddressFormUI = (props: AddressFormParams) => {
508
508
  handleChangeInput(text)
509
509
  setValue('internal_number', text)
510
510
  }}
511
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
511
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
512
512
  style={styles.inputsStyle}
513
513
  forwardRef={internalNumberRef}
514
514
  returnKeyType='next'
515
- onSubmitEditing={() => zipCodeRef.current.focus()}
515
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
516
516
  blurOnSubmit={false}
517
517
  inputStyle={{ fontSize: 12 }}
518
518
  />
@@ -538,7 +538,7 @@ const AddressFormUI = (props: AddressFormParams) => {
538
538
  style={styles.inputsStyle}
539
539
  forwardRef={zipCodeRef}
540
540
  returnKeyType='next'
541
- onSubmitEditing={() => addressNotesRef.current.focus()}
541
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
542
542
  blurOnSubmit={false}
543
543
  inputStyle={{ fontSize: 12 }}
544
544
  />
@@ -31,7 +31,7 @@ export const FacebookLogin = (props: any) => {
31
31
  : text;
32
32
 
33
33
  const logoutWithFacebook = () => {
34
- LoginManager.logOut();
34
+ LoginManager && LoginManager.logOut();
35
35
  };
36
36
 
37
37
  const handleLoginClick = async (accessToken: string) => {
@@ -61,7 +61,7 @@ export const FacebookLogin = (props: any) => {
61
61
 
62
62
  const loginWithFacebook = () => {
63
63
  handleLoading && handleLoading(true)
64
- LoginManager.logInWithPermissions(['public_profile']).then(
64
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
65
65
  (login: any) => {
66
66
  if (login.isCancelled) {
67
67
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -355,7 +355,7 @@ const LoginFormUI = (props: LoginParams) => {
355
355
  handleData={(val: any) => setPhoneInputData(val)}
356
356
  textInputProps={{
357
357
  returnKeyType: 'next',
358
- onSubmitEditing: () => inputRef.current.focus(),
358
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
359
359
  }}
360
360
  />
361
361
  </View>