ordering-ui-react-native 0.22.98 → 0.22.99

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.98",
3
+ "version": "0.22.99",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -53,19 +53,23 @@ const MapViewComponent = (props: MapViewParams) => {
53
53
 
54
54
  const fitCoordinates = (location?: any) => {
55
55
  if (mapRef.current) {
56
- mapRef.current.fitToCoordinates(
57
- [
58
- {
59
- latitude: typeof location?.latitude !== 'object' ? location?.latitude : 0,
60
- longitude: typeof location?.longitude !== 'object' ? location?.latitude : 0
61
- },
62
- {
63
- latitude: typeof userLocation?.latitude !== 'object' ? userLocation?.latitude : 0,
64
- longitude: typeof userLocation?.longitude !== 'object' ? userLocation?.latitude : 0
65
- },
66
- ],
56
+ const isSendCoordinates =
57
+ location &&
58
+ userLocation &&
59
+ location.latitude !== userLocation.latitude &&
60
+ location.longitude !== userLocation.longitude &&
61
+ location.latitude !== 0 &&
62
+ location.longitude !== 0 &&
63
+ userLocation.latitude !== 0 &&
64
+ userLocation.longitude !== 0
65
+
66
+ isSendCoordinates && mapRef.current.fitToCoordinates(
67
+ [location, userLocation].map(_location => ({
68
+ latitude: _location.latitude,
69
+ longitude: _location.longitude
70
+ })),
67
71
  {
68
- edgePadding: { top: 120, right: 120, bottom: 120, left: 120 },
72
+ edgePadding: { top: 120, right: 120, bottom: 120, left: 120 }
69
73
  },
70
74
  );
71
75
  }