ordering-ui-react-native 0.12.13 → 0.12.14

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.12.13",
3
+ "version": "0.12.14",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -41,7 +41,7 @@ export const GoogleMap = (props: GoogleMapsParams) => {
41
41
  ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
42
42
  ERROR_MAX_LIMIT_LOCATION_TO: 'Sorry, You can only set the position to'
43
43
  }
44
- const MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
44
+ let MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
45
45
  return {
46
46
  latitude: location.lat,
47
47
  longitude: location.lng
@@ -176,6 +176,17 @@ export const GoogleMap = (props: GoogleMapsParams) => {
176
176
  return () => clearInterval(interval)
177
177
  }, [locations])
178
178
 
179
+ useEffect(() => {
180
+ if(!locations) return
181
+ locations[0] = {...locations[0], lat: location.lat, lng: location.lng}
182
+ MARKERS = locations && locations.map((location: { lat: number, lng: number }) => {
183
+ return {
184
+ latitude: location.lat,
185
+ longitude: location.lng
186
+ }
187
+ })
188
+ }, [location])
189
+
179
190
  return (
180
191
  <>
181
192
  <MapView
@@ -208,7 +208,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
208
208
  }
209
209
  }, [messagesReadList])
210
210
 
211
- const locations = [
211
+ let locations = [
212
212
  { ...order?.driver?.location, title: t('DRIVER', 'Driver'), icon: order?.driver?.photo || 'https://res.cloudinary.com/demo/image/fetch/c_thumb,g_face,r_max/https://www.freeiconspng.com/thumbs/driver-icon/driver-icon-14.png' },
213
213
  { ...order?.business?.location, title: order?.business?.name, icon: order?.business?.logo || theme.images.dummies.businessLogo },
214
214
  { ...order?.customer?.location, title: t('YOUR_LOCATION', 'Your Location'), icon: order?.customer?.photo || 'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png' }
@@ -216,7 +216,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
216
216
 
217
217
  useEffect(() => {
218
218
  if (driverLocation) {
219
- locations[0] = driverLocation
219
+ locations[0] = {...locations[0], lat: driverLocation.lat, lng: driverLocation.lng}
220
220
  }
221
221
  }, [driverLocation])
222
222
 
@@ -361,9 +361,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
361
361
  {order?.driver?.location && parseInt(order?.status) === 9 && (
362
362
  <Map>
363
363
  <GoogleMap
364
- location={order?.driver?.location}
364
+ location={driverLocation ?? order?.driver?.location}
365
365
  locations={locations}
366
- readOnly
367
366
  />
368
367
  </Map>
369
368
  )}