ordering-ui-react-native 0.8.3 → 0.8.7

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 (47) hide show
  1. package/package.json +2 -1
  2. package/src/components/OrdersOption/index.tsx +1 -12
  3. package/src/navigators/HomeNavigator.tsx +27 -2
  4. package/src/pages/Checkout.tsx +3 -3
  5. package/src/types/react-native-background-timer/index.d.ts +1 -0
  6. package/themes/business/index.tsx +6 -0
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +167 -240
  8. package/themes/business/src/components/Chat/index.tsx +68 -54
  9. package/themes/business/src/components/DriverMap/index.tsx +86 -116
  10. package/themes/business/src/components/GoogleMap/index.tsx +43 -39
  11. package/themes/business/src/components/MessagesOption/index.tsx +73 -59
  12. package/themes/business/src/components/MessagesOption/styles.tsx +1 -1
  13. package/themes/business/src/components/OrderDetails/index.tsx +104 -92
  14. package/themes/business/src/components/OrderDetails/styles.tsx +6 -2
  15. package/themes/business/src/components/OrderDetailsDelivery/index.tsx +816 -0
  16. package/themes/business/src/components/OrderDetailsDelivery/styles.tsx +144 -0
  17. package/themes/business/src/components/OrderMessage/index.tsx +122 -23
  18. package/themes/business/src/components/OrdersOption/index.tsx +52 -66
  19. package/themes/business/src/components/PreviousMessages/index.tsx +2 -2
  20. package/themes/business/src/components/PreviousOrders/index.tsx +5 -5
  21. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -1
  22. package/themes/business/src/components/StoresList/index.tsx +51 -49
  23. package/themes/business/src/components/UserFormDetails/index.tsx +2 -1
  24. package/themes/business/src/components/UserProfileForm/index.tsx +18 -30
  25. package/themes/business/src/components/UserProfileForm/styles.tsx +0 -2
  26. package/themes/business/src/components/shared/OInput.tsx +3 -2
  27. package/themes/business/src/hooks/useLocation.tsx +7 -3
  28. package/themes/business/src/layouts/SafeAreaContainer.tsx +43 -0
  29. package/themes/business/src/types/index.tsx +8 -0
  30. package/themes/doordash/index.tsx +4 -4
  31. package/themes/doordash/src/components/LoginForm/index.tsx +2 -5
  32. package/themes/doordash/src/components/SingleProductCard/index.tsx +1 -1
  33. package/themes/doordash/src/components/SocialShare/index.tsx +34 -5
  34. package/themes/doordash/src/components/shared/OModal.tsx +1 -6
  35. package/themes/instacart/src/components/AddressForm/index.tsx +2 -60
  36. package/themes/instacart/src/components/AddressList/index.tsx +6 -3
  37. package/themes/instacart/src/components/Home/index.tsx +39 -14
  38. package/themes/instacart/src/components/Home/styles.tsx +7 -0
  39. package/themes/instacart/src/components/LoginForm/index.tsx +3 -3
  40. package/themes/instacart/src/components/LoginForm/styles.tsx +1 -3
  41. package/themes/instacart/src/components/LogoutButton/index.tsx +7 -6
  42. package/themes/instacart/src/components/SocialShare/index.tsx +56 -19
  43. package/themes/instacart/src/components/SocialShare/styles.ts +0 -8
  44. package/themes/instacart/src/components/UserProfileForm/index.tsx +1 -1
  45. package/themes/instacart/src/components/shared/OIcon.tsx +2 -1
  46. package/themes/instacart/src/layouts/Container.tsx +1 -1
  47. package/themes/instacart/src/types/index.tsx +12 -12
@@ -147,7 +147,7 @@ const ChatUI = (props: MessagesParams) => {
147
147
  shadowRadius: 3.84,
148
148
  elevation: 2,
149
149
  backgroundColor: theme.colors.white,
150
- marginRight: 4,
150
+ marginLeft: 4,
151
151
  },
152
152
  avatarIcon: {
153
153
  height: 16,
@@ -267,59 +267,65 @@ const ChatUI = (props: MessagesParams) => {
267
267
  }
268
268
  };
269
269
 
270
- const getStatus = (status: number) => {
270
+ const getStatus = (status: number, attribute: any) => {
271
271
  const hour = Math.trunc(status / 60);
272
272
  const min = Math.round((status / 60 - hour) * 60);
273
273
 
274
- switch (status) {
275
- case 0:
276
- return 'ORDER_STATUS_PENDING';
277
- case 1:
278
- return 'ORDERS_COMPLETED';
279
- case 2:
280
- return 'ORDER_REJECTED';
281
- case 3:
282
- return 'ORDER_STATUS_IN_BUSINESS';
283
- case 4:
284
- return 'ORDER_READY';
285
- case 5:
286
- return 'ORDER_REJECTED_RESTAURANT';
287
- case 6:
288
- return 'ORDER_STATUS_CANCELLEDBYDRIVER';
289
- case 7:
290
- return 'ORDER_STATUS_ACCEPTEDBYRESTAURANT';
291
- case 8:
292
- return 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER';
293
- case 9:
294
- return 'ORDER_PICKUP_COMPLETED_BY_DRIVER';
295
- case 10:
296
- return 'ORDER_PICKUP_FAILED_BY_DRIVER';
297
- case 11:
298
- return 'ORDER_DELIVERY_COMPLETED_BY_DRIVER';
299
- case 12:
300
- return 'ORDER_DELIVERY_FAILED_BY_DRIVER';
301
- case 13:
302
- return 'PREORDER';
303
- case 14:
304
- return 'ORDER_NOT_READY';
305
- case 15:
306
- return 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER';
307
- case 16:
308
- return 'ORDER_STATUS_CANCELLED_BY_CUSTOMER';
309
- case 17:
310
- return 'ORDER_NOT_PICKEDUP_BY_CUSTOMER';
311
- case 18:
312
- return 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS';
313
- case 19:
314
- return 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER';
315
- case 20:
316
- return 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS';
317
- case 21:
318
- return 'ORDER_CUSTOMER_ARRIVED_BUSINESS';
319
- default:
320
- return `${hour < 10 ? '0' + hour : hour}:${
321
- min < 10 ? '0' + min : min
322
- } ${status > 60 ? 'hours' : 'minutes'}`;
274
+ if (attribute === 'status') {
275
+ switch (status) {
276
+ case 0:
277
+ return 'ORDER_STATUS_PENDING';
278
+ case 1:
279
+ return 'ORDERS_COMPLETED';
280
+ case 2:
281
+ return 'ORDER_REJECTED';
282
+ case 3:
283
+ return 'ORDER_STATUS_IN_BUSINESS';
284
+ case 4:
285
+ return 'ORDER_READY';
286
+ case 5:
287
+ return 'ORDER_REJECTED_RESTAURANT';
288
+ case 6:
289
+ return 'ORDER_STATUS_CANCELLEDBYDRIVER';
290
+ case 7:
291
+ return 'ORDER_STATUS_ACCEPTEDBYRESTAURANT';
292
+ case 8:
293
+ return 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER';
294
+ case 9:
295
+ return 'ORDER_PICKUP_COMPLETED_BY_DRIVER';
296
+ case 10:
297
+ return 'ORDER_PICKUP_FAILED_BY_DRIVER';
298
+ case 11:
299
+ return 'ORDER_DELIVERY_COMPLETED_BY_DRIVER';
300
+ case 12:
301
+ return 'ORDER_DELIVERY_FAILED_BY_DRIVER';
302
+ case 13:
303
+ return 'PREORDER';
304
+ case 14:
305
+ return 'ORDER_NOT_READY';
306
+ case 15:
307
+ return 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER';
308
+ case 16:
309
+ return 'ORDER_STATUS_CANCELLED_BY_CUSTOMER';
310
+ case 17:
311
+ return 'ORDER_NOT_PICKEDUP_BY_CUSTOMER';
312
+ case 18:
313
+ return 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS';
314
+ case 19:
315
+ return 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER';
316
+ case 20:
317
+ return 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS';
318
+ case 21:
319
+ return 'ORDER_CUSTOMER_ARRIVED_BUSINESS';
320
+ default:
321
+ return ``;
322
+ }
323
+ }
324
+
325
+ if (attribute === 'prepared_in' || attribute === 'delivered_in') {
326
+ return `${hour < 10 ? '0' + hour : hour}:${min < 10 ? '0' + min : min} ${
327
+ status > 60 ? 'hours' : 'minutes'
328
+ }`;
323
329
  }
324
330
  };
325
331
 
@@ -348,10 +354,18 @@ const ChatUI = (props: MessagesParams) => {
348
354
  message.change.attribute,
349
355
  )} ${t('CHANGED_FROM', 'Changed from')} ${
350
356
  message.change.old !== null
351
- ? t(getStatus(parseInt(message.change.old, 10)))
357
+ ? t(
358
+ getStatus(
359
+ parseInt(message.change.old, 10),
360
+ message.change?.attribute,
361
+ ),
362
+ )
352
363
  : '0'
353
364
  } ${t('TO', 'to')} ${t(
354
- getStatus(parseInt(message.change.new, 10)),
365
+ getStatus(
366
+ parseInt(message.change.new, 10),
367
+ message.change?.attribute,
368
+ ),
355
369
  )}`
356
370
  : message.change.new
357
371
  ? `${message.driver?.name} ${
@@ -868,7 +882,7 @@ const ChatUI = (props: MessagesParams) => {
868
882
  };
869
883
 
870
884
  const renderAvatar = (props: any) => (
871
- <View style={{ marginBottom: 10, alignItems: 'flex-start' }}>
885
+ <View style={{ marginBottom: 10, alignItems: 'flex-end' }}>
872
886
  <OText size={9} color={theme.colors.textGray}>
873
887
  {`${t('SENT_TO', 'Sent to')}:`}
874
888
  </OText>
@@ -1,7 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
- import { Dimensions, StyleSheet, View, Platform } from 'react-native';
2
+ import { Dimensions, StyleSheet, View } from 'react-native';
3
3
  import MapView, {
4
- PROVIDER_DEFAULT,
5
4
  PROVIDER_GOOGLE,
6
5
  Marker,
7
6
  Region,
@@ -15,23 +14,20 @@ import { OIconButton, OIcon, OFab, OText } from '../shared';
15
14
  import Icon from 'react-native-vector-icons/FontAwesome5';
16
15
  import { useTheme } from 'styled-components/native';
17
16
  import { useLocation } from '../../hooks/useLocation';
18
- import Spinner from 'react-native-loading-spinner-overlay';
19
17
  // import MapViewDirections from 'react-native-maps-directions';
20
18
  import { FloatingButton } from '../FloatingButton';
19
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
21
20
 
22
21
  export const DriverMap = (props: GoogleMapsParams) => {
23
22
  const {
24
23
  location,
25
- handleChangeAddressMap,
26
24
  maxLimitLocation,
27
- readOnly,
28
25
  markerTitle,
29
26
  handleOpenMapView,
30
27
  showAcceptOrReject,
31
28
  saveLocation,
32
29
  setSaveLocation,
33
30
  order,
34
- handleToggleMap,
35
31
  isSetInputs,
36
32
  orderStatus,
37
33
  isBusinessMarker,
@@ -48,7 +44,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
48
44
  const following = useRef<boolean>(true);
49
45
  const autoFit = useRef<boolean>(true);
50
46
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value;
47
+ const [travelTime, setTravelTime] = useState(0);
51
48
  const [distancesFromTwoPlacesKm, setDistancesFromTwoPlacesKm] = useState(0);
49
+ const [isMin, setIsMin] = useState(false);
52
50
  const [infoRealTime, setInfoRealTime] = useState({ formatted_address: '' });
53
51
  const [{ parseDate }] = useUtils();
54
52
  const mapErrors: any = {
@@ -68,7 +66,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
68
66
  getCurrentLocation,
69
67
  userLocation,
70
68
  stopFollowUserLocation,
71
- routeLines,
72
69
  } = useLocation();
73
70
 
74
71
  const origin = {
@@ -77,6 +74,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
77
74
  };
78
75
  const destination = { latitude: location.lat, longitude: location.lng };
79
76
 
77
+ const { top } = useSafeAreaInsets();
78
+
80
79
  useEffect(() => {
81
80
  if (isToFollow) {
82
81
  fitCoordinates();
@@ -179,7 +178,13 @@ export const DriverMap = (props: GoogleMapsParams) => {
179
178
 
180
179
  const distance = R * c;
181
180
  const distanceInKm = distance / 1000;
181
+ const estimatedTimeTravel = distance / userLocation.speed / 60;
182
+ const time =
183
+ estimatedTimeTravel > 60 ? estimatedTimeTravel / 60 : estimatedTimeTravel;
184
+ setIsMin(estimatedTimeTravel < 60);
185
+ const timeEstimated = userLocation.speed > 0 ? time : travelTime;
182
186
  setDistancesFromTwoPlacesKm(distanceInKm);
187
+ setTravelTime(timeEstimated);
183
188
  return distance;
184
189
  };
185
190
 
@@ -266,10 +271,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
266
271
  return () => clearInterval(interval);
267
272
  }, [initialPosition]);
268
273
 
269
- if (!hasLocation) {
270
- return <Spinner visible={!hasLocation} />;
271
- }
272
-
273
274
  const fitCoordinatesZoom = () => {
274
275
  following.current = false;
275
276
  fitCoordinates();
@@ -292,44 +293,31 @@ export const DriverMap = (props: GoogleMapsParams) => {
292
293
  right: 0,
293
294
  },
294
295
  buttonBack: {
295
- borderRadius: 7.6,
296
296
  borderWidth: 0,
297
+ maxWidth: 100,
298
+ alignItems: 'flex-start',
299
+ justifyContent: 'flex-start',
297
300
  },
298
- facOrderStatus: {
301
+ facContainer: {
299
302
  position: 'absolute',
300
- height: 100,
301
- top: Platform.OS === 'ios' ? 15 : 0,
302
- left: 0,
303
+ top: 0,
303
304
  zIndex: 9999,
304
305
  width: '100%',
305
- flexDirection: 'row',
306
- justifyContent: 'center',
307
- alignItems: 'center',
308
306
  backgroundColor: theme.colors.white,
309
- borderWidth: 0,
310
- paddingLeft: 0,
311
- paddingVertical: 10,
312
- borderBottomWidth: 10,
307
+ },
308
+ facOrderStatus: {
309
+ flexDirection: 'row',
310
+ paddingTop: top + 5,
311
+ borderBottomWidth: 11,
313
312
  borderBottomColor: theme.colors.inputChat,
314
313
  },
315
314
  facDistance: {
316
- position: 'absolute',
317
- height: 100,
318
- top: 95,
319
- left: 0,
320
- zIndex: 9999,
321
- width: '100%',
322
315
  flexDirection: 'row',
323
- justifyContent: 'center',
316
+ minHeight: 70,
324
317
  alignItems: 'center',
325
- backgroundColor: theme.colors.white,
326
- borderWidth: 0,
327
- paddingLeft: 0,
328
318
  },
329
319
  arrowDistance: {
330
- borderRadius: 7.6,
331
320
  borderWidth: 0,
332
- paddingHorizontal: 40,
333
321
  },
334
322
  });
335
323
 
@@ -337,35 +325,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
337
325
  validateResult(coordinates);
338
326
  };
339
327
 
340
- const validateResult = (curPos: { latitude: number; longitude: number }) => {
341
- const loc1 = { lat: userLocation.latitude, lng: userLocation.longitude };
342
- const loc2 = curPos;
343
- const distance = calculateDistance(loc1, loc2);
344
-
345
- // if (!maxLimitLocation) {
346
- // geocodePosition(curPos);
347
- // setMarkerPosition(curPos);
348
- // setRegion({
349
- // ...region,
350
- // longitude: curPos.longitude,
351
- // latitude: curPos.latitude,
352
- // });
353
- // return;
354
- // }
355
-
356
- // if (distance <= maxLimitLocation) {
357
- // setMarkerPosition(curPos);
358
- // setRegion({
359
- // ...region,
360
- // longitude: curPos.longitude,
361
- // latitude: curPos.latitude,
362
- // });
363
- // } else {
364
- // setMapErrors && setMapErrors('ERROR_MAX_LIMIT_LOCATION');
365
- // setMarkerPosition({ latitude: center.lat, longitude: center.lng });
366
- // }
367
- };
368
-
369
328
  return (
370
329
  <>
371
330
  <View style={{ flex: 1 }}>
@@ -461,61 +420,72 @@ export const DriverMap = (props: GoogleMapsParams) => {
461
420
  right: 20,
462
421
  }}
463
422
  />
464
-
465
- <View style={styles.facOrderStatus}>
466
- <OIconButton
467
- icon={theme.images.general.close}
468
- iconStyle={{ width: 32, height: 32 }}
469
- style={styles.buttonBack}
470
- onClick={() => handleArrowBack()}
471
- />
472
- <View style={{ width: '70%' }}>
473
- <OText size={12} color={theme.colors.textGray}>
474
- {order?.delivery_datetime_utc
475
- ? parseDate(order?.delivery_datetime_utc)
476
- : parseDate(order?.delivery_datetime, { utc: false })}
477
- {` - ${order?.paymethod?.name}`}
478
- </OText>
479
- <OText weight="600">
480
- {t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}
481
- {` ${t('IS', 'is')} `}
482
- <OText
483
- size={16}
484
- numberOfLines={1}
485
- adjustsFontSizeToFit
486
- color={colors[order?.status] || theme.colors.statusOrderBlue}>
487
- {`${orderStatus}`}
423
+ <View style={styles.facContainer}>
424
+ <View style={styles.facOrderStatus}>
425
+ <View
426
+ style={{
427
+ width: '25%',
428
+ justifyContent: 'flex-start',
429
+ }}>
430
+ <OIconButton
431
+ icon={theme.images.general.close}
432
+ iconStyle={{
433
+ width: 32,
434
+ height: 25,
435
+ }}
436
+ style={styles.buttonBack}
437
+ onClick={() => handleArrowBack()}
438
+ />
439
+ </View>
440
+ <View style={{ width: '75%' }}>
441
+ <OText size={12} color={theme.colors.textGray}>
442
+ {order?.delivery_datetime_utc
443
+ ? parseDate(order?.delivery_datetime_utc)
444
+ : parseDate(order?.delivery_datetime, { utc: false })}
445
+ {` - ${order?.paymethod?.name}`}
488
446
  </OText>
489
- </OText>
490
- </View>
491
- </View>
492
-
493
- <View style={styles.facDistance}>
494
- <View
495
- style={{
496
- justifyContent: 'center',
497
- alignItems: 'center',
498
- }}>
499
- <OIcon
500
- src={theme.images.general.arrow_distance}
501
- style={styles.arrowDistance}
502
- />
503
- <OText size={13} numberOfLines={1} adjustsFontSizeToFit space>{`${(
504
- distancesFromTwoPlacesKm * 3280.84
505
- ).toFixed(0)} Ft`}</OText>
447
+ <OText weight="bold">
448
+ {t('INVOICE_ORDER_NO', 'Order No.')} {order?.id}
449
+ {` ${t('IS', 'is')} `}
450
+ <OText
451
+ size={16}
452
+ numberOfLines={2}
453
+ color={colors[order?.status] || theme.colors.statusOrderBlue}>
454
+ {`${orderStatus}`}
455
+ </OText>
456
+ </OText>
457
+ </View>
506
458
  </View>
507
459
 
508
- <View style={{ width: '70%' }}>
509
- <OText
510
- color={theme.colors.unselectText}
511
- size={13}
512
- numberOfLines={2}
513
- adjustsFontSizeToFit>
514
- {`30 min - ${distancesFromTwoPlacesKm.toFixed(2)} km`}
515
- </OText>
516
- <OText size={13} numberOfLines={3} adjustsFontSizeToFit>
517
- {infoRealTime?.formatted_address}
518
- </OText>
460
+ <View style={styles.facDistance}>
461
+ <View
462
+ style={{
463
+ width: '25%',
464
+ alignItems: 'center',
465
+ paddingHorizontal: 20,
466
+ }}>
467
+ <OIcon
468
+ src={theme.images.general.arrow_distance}
469
+ style={styles.arrowDistance}
470
+ />
471
+ <OText size={12} numberOfLines={2}>{`${(
472
+ distancesFromTwoPlacesKm * 3280.84
473
+ ).toFixed(0)} ${t('FT', 'Ft')}`}</OText>
474
+ </View>
475
+ <View style={{ width: '75%' }}>
476
+ <OText
477
+ color={theme.colors.unselectText}
478
+ size={13}
479
+ numberOfLines={2}
480
+ adjustsFontSizeToFit>
481
+ {`${travelTime.toFixed(2)} - ${
482
+ isMin ? t('MINNUTES', 'mins') : t('HOURS', 'hours')
483
+ } ${distancesFromTwoPlacesKm.toFixed(2)} km`}
484
+ </OText>
485
+ <OText size={13} numberOfLines={3} adjustsFontSizeToFit>
486
+ {infoRealTime?.formatted_address}
487
+ </OText>
488
+ </View>
519
489
  </View>
520
490
  </View>
521
491
 
@@ -1,11 +1,6 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
- import { Dimensions, StyleSheet, View, Platform } from 'react-native';
3
- import MapView, {
4
- PROVIDER_DEFAULT,
5
- PROVIDER_GOOGLE,
6
- Marker,
7
- Region,
8
- } from 'react-native-maps';
2
+ import { Dimensions, StyleSheet, View } from 'react-native';
3
+ import MapView, { PROVIDER_GOOGLE, Marker, Region } from 'react-native-maps';
9
4
  import Geocoder from 'react-native-geocoding';
10
5
  import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
11
6
  import { GoogleMapsParams } from '../../types';
@@ -14,6 +9,7 @@ import { OIconButton, OIcon } from '../shared';
14
9
  import { FloatingButton } from '../FloatingButton';
15
10
  import Icon from 'react-native-vector-icons/FontAwesome5';
16
11
  import { useTheme } from 'styled-components/native';
12
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
17
13
 
18
14
  export const GoogleMap = (props: GoogleMapsParams) => {
19
15
  const {
@@ -24,6 +20,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
24
20
  handleViewActionOrder,
25
21
  markerTitle,
26
22
  showAcceptOrReject,
23
+ driverLocation,
27
24
  saveLocation,
28
25
  handleOpenMapView,
29
26
  setSaveLocation,
@@ -33,6 +30,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
33
30
  navigation,
34
31
  } = props;
35
32
 
33
+ const { top } = useSafeAreaInsets();
36
34
  const theme = useTheme();
37
35
  const [, t] = useLanguage();
38
36
  const [configState] = useConfig();
@@ -64,13 +62,16 @@ export const GoogleMap = (props: GoogleMapsParams) => {
64
62
  ERROR_NOT_FOUND_ADDRESS: "Sorry, we couldn't find an address",
65
63
  ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to',
66
64
  };
65
+
67
66
  const MARKERS =
68
67
  locations &&
69
- locations.map((location: { lat: number; lng: number }) => {
70
- return {
71
- latitude: location.lat,
72
- longitude: location.lng,
73
- };
68
+ locations.map((location: { lat: number; lng: number; level: number }) => {
69
+ return location.level === 4 && driverLocation?.lat
70
+ ? {
71
+ latitude: driverLocation?.lat,
72
+ longitude: driverLocation?.lng,
73
+ }
74
+ : { latitude: location.lat, longitude: location.lng };
74
75
  });
75
76
 
76
77
  const handleArrowBack: any = () => {
@@ -223,6 +224,35 @@ export const GoogleMap = (props: GoogleMapsParams) => {
223
224
  return () => clearInterval(interval);
224
225
  }, [locations]);
225
226
 
227
+ const styles = StyleSheet.create({
228
+ map: {
229
+ flex: 1,
230
+ ...StyleSheet.absoluteFillObject,
231
+ },
232
+ image: {
233
+ borderRadius: 50,
234
+ },
235
+ view: {
236
+ width: 25,
237
+ position: 'absolute',
238
+ top: 6,
239
+ left: 6,
240
+ bottom: 0,
241
+ right: 0,
242
+ },
243
+ buttonBack: {
244
+ borderRadius: 7.6,
245
+ borderWidth: 0,
246
+ paddingLeft: 0,
247
+ },
248
+ buttonContainer: {
249
+ position: 'absolute',
250
+ top: 0,
251
+ left: 15,
252
+ marginTop: top,
253
+ },
254
+ });
255
+
226
256
  return (
227
257
  <>
228
258
  <View style={{ flex: 1, position: 'relative' }}>
@@ -303,7 +333,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
303
333
  secondColorCustom={theme.colors.green}
304
334
  />
305
335
  )}
306
- <View style={styles.buttonBack}>
336
+ <View style={styles.buttonContainer}>
307
337
  <OIconButton
308
338
  icon={theme.images.general.close}
309
339
  iconStyle={{ width: 32, height: 32 }}
@@ -314,29 +344,3 @@ export const GoogleMap = (props: GoogleMapsParams) => {
314
344
  </>
315
345
  );
316
346
  };
317
-
318
- const styles = StyleSheet.create({
319
- map: {
320
- flex: 1,
321
- ...StyleSheet.absoluteFillObject,
322
- },
323
- image: {
324
- borderRadius: 50,
325
- },
326
- view: {
327
- width: 25,
328
- position: 'absolute',
329
- top: 6,
330
- left: 6,
331
- bottom: 0,
332
- right: 0,
333
- },
334
- buttonBack: {
335
- position: 'absolute',
336
- borderRadius: 7.6,
337
- top: 30,
338
- left: 15,
339
- borderWidth: 0,
340
- paddingLeft: 0,
341
- },
342
- });