ordering-ui-react-native 0.23.74-test2 → 0.23.74-test4

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.23.74-test2",
3
+ "version": "0.23.74-test4",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -52,7 +52,7 @@ const MapViewComponent = (props: MapViewParams) => {
52
52
  };
53
53
 
54
54
  const fitCoordinates = (location?: any) => {
55
- if (mapRef.current) {
55
+ if (mapRef.current && typeof location.latitude === 'number' && !Number.isNaN(location.latitude) && typeof location.longitude === 'number' && !Number.isNaN(location.longitude)) {
56
56
  const isSendCoordinates =
57
57
  location &&
58
58
  userLocation &&
@@ -143,20 +143,17 @@ const MapViewComponent = (props: MapViewParams) => {
143
143
  let coordinateLat = (customer
144
144
  ? typeof marker?.customer?.location?.lat === 'number' && !Number.isNaN(marker?.customer?.location?.lat)
145
145
  ? marker?.customer?.location?.lat
146
- : initialPosition?.latitude || 0
146
+ : 0
147
147
  : typeof marker?.business?.location?.lat === 'number' && !Number.isNaN(marker?.business?.location?.lat)
148
148
  ? marker?.business?.location?.lat
149
- : initialPosition?.latitude || 0
150
- ) ?? 0;
151
-
149
+ : 0) ?? (initialPosition?.latitude || 0)
152
150
  let coordinateLng = (customer
153
151
  ? typeof marker?.customer?.location?.lng === 'number' && !Number.isNaN(marker?.customer?.location?.lng)
154
152
  ? marker?.customer?.location?.lng
155
- : initialPosition?.longitude || 0
153
+ : 0
156
154
  : typeof marker?.business?.location?.lng === 'number' && !Number.isNaN(marker?.business?.location?.lng)
157
155
  ? marker?.business?.location?.lng
158
- : initialPosition?.longitude || 0
159
- ) ?? 0;
156
+ : 0) ?? (initialPosition?.longitude || 0)
160
157
 
161
158
  useEffect(() => {
162
159
  if (
@@ -254,7 +251,7 @@ const MapViewComponent = (props: MapViewParams) => {
254
251
  return (
255
252
  <SafeAreaView style={{ flex: 1 }}>
256
253
  <View style={{ flex: 1 }}>
257
- {!isLoadingBusinessMarkers && isFocused && (
254
+ {!isLoadingBusinessMarkers && isFocused ? (
258
255
  <View style={{ flex: 1 }}>
259
256
  <MapView
260
257
  ref={mapRef}
@@ -274,34 +271,34 @@ const MapViewComponent = (props: MapViewParams) => {
274
271
  onTouchStart={() => (following.current = false)}
275
272
  >
276
273
  <>
277
- {Object.values(markerGroups).length && Object.values(markerGroups).map((marker: any) => (
274
+ {/* {Object.values(markerGroups).length ? (Object.values(markerGroups).map((marker: any) => (
278
275
  <RenderMarker
279
276
  key={marker[0]?.business_id}
280
277
  marker={marker[0]}
281
278
  orderIds={marker.map((order: any) => order.id).join(', ')}
282
279
  />
283
- ))}
284
- {Object.values(customerMarkerGroups).length && Object.values(customerMarkerGroups).map((marker: any) => (
280
+ ))) : null}
281
+ {Object.values(customerMarkerGroups).length ? (Object.values(customerMarkerGroups).map((marker: any) => (
285
282
  <RenderMarker
286
283
  key={marker[0]?.customer_id}
287
284
  marker={marker[0]}
288
285
  orderIds={marker.map((order: any) => order.id).join(', ')}
289
286
  customer
290
287
  />
291
- ))}
292
- <Marker
293
- coordinate={{
294
- latitude: typeof location.lat === 'number' && !Number.isNaN(location.lat) ? location.lat : 0,
295
- longitude: typeof location.lng === 'number' && !Number.isNaN(location.lng) ? location.lng : 0,
296
- }}
297
- title={t('YOUR_LOCATION', 'Your Location')}
298
- >
299
- <Icon
300
- name="map-marker"
301
- size={50}
302
- color={theme.colors.primary}
303
- />
304
- {user?.photo && (
288
+ ))) : null} */}
289
+ {typeof location.lat === 'number' && !Number.isNaN(location.lat) && typeof location.lng === 'number' && !Number.isNaN(location.lng) ? (
290
+ <Marker
291
+ coordinate={{
292
+ latitude: typeof location.lat === 'number' && !Number.isNaN(location.lat) ? location.lat : 0,
293
+ longitude: typeof location.lng === 'number' && !Number.isNaN(location.lng) ? location.lng : 0,
294
+ }}
295
+ title={t('YOUR_LOCATION', 'Your Location')}
296
+ >
297
+ <Icon
298
+ name="map-marker"
299
+ size={50}
300
+ color={theme.colors.primary}
301
+ />
305
302
  <View style={styles.view}>
306
303
  <OIcon
307
304
  style={styles.image}
@@ -310,8 +307,8 @@ const MapViewComponent = (props: MapViewParams) => {
310
307
  height={25}
311
308
  />
312
309
  </View>
313
- )}
314
- </Marker>
310
+ </Marker>
311
+ ) : null}
315
312
  </>
316
313
  </MapView>
317
314
  <OFab
@@ -335,7 +332,7 @@ const MapViewComponent = (props: MapViewParams) => {
335
332
  }}
336
333
  />
337
334
  </View>
338
- )}
335
+ ) : null}
339
336
  </View>
340
337
  <View>
341
338
  <Alert