ordering-ui-react-native 0.24.3 → 0.24.4

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.24.3",
3
+ "version": "0.24.4",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -33,9 +33,7 @@ const styles = StyleSheet.create({
33
33
 
34
34
  const MapViewComponent = (props: MapViewParams) => {
35
35
  const {
36
- isLoadingBusinessMarkers,
37
- markerGroups,
38
- customerMarkerGroups,
36
+ assingnedOrders,
39
37
  alertState,
40
38
  setAlertState,
41
39
  setDriverLocation,
@@ -65,7 +63,7 @@ const MapViewComponent = (props: MapViewParams) => {
65
63
  return { lat: userLocation?.latitude, lng: userLocation?.longitude }
66
64
  }, [userLocation?.latitude, userLocation?.longitude])
67
65
 
68
- const haveOrders = Object.values(markerGroups)?.length > 0 && Object.values(customerMarkerGroups)?.length > 0
66
+ const haveOrders = Object.values(assingnedOrders?.orders)?.length > 0 && assingnedOrders?.orders?.some(order => order?.customer?.id)
69
67
  const closeAlert = () => {
70
68
  setAlertState({
71
69
  open: false,
@@ -165,7 +163,7 @@ const MapViewComponent = (props: MapViewParams) => {
165
163
  return (
166
164
  <SafeAreaView style={{ flex: 1 }}>
167
165
  <View style={{ flex: 1 }}>
168
- {(isDeliveryApp || (!isLoadingBusinessMarkers && isFocused)) && !!initialPosition?.latitude && !!initialPosition?.longitude && (
166
+ {(isDeliveryApp || (!assingnedOrders?.loading && isFocused)) && !!initialPosition?.latitude && !!initialPosition?.longitude && (
169
167
  <View style={{ flex: 1 }}>
170
168
  <MapView
171
169
  ref={mapRef}
@@ -185,20 +183,18 @@ const MapViewComponent = (props: MapViewParams) => {
185
183
  onTouchStart={() => (following.current = false)}
186
184
  >
187
185
  <>
188
- {Object.values(markerGroups).map((marker: any) => (
186
+ {assingnedOrders?.orders.map((marker: any) => (
189
187
  <RenderMarker
190
188
  {...renderMarkerDefaultProps}
191
- key={marker[0]?.business_id}
192
- marker={marker[0]}
193
- orderIds={marker.map((order: any) => order.id).join(', ')}
189
+ key={`${marker?.id}_${marker?.business_id}`}
190
+ marker={marker}
194
191
  />
195
192
  ))}
196
- {Object.values(customerMarkerGroups).map((marker: any) => (
193
+ {assingnedOrders?.orders.map((marker: any) => (
197
194
  <RenderMarker
198
195
  {...renderMarkerDefaultProps}
199
- key={marker[0]?.customer_id}
200
- marker={marker[0]}
201
- orderIds={marker.map((order: any) => order.id).join(', ')}
196
+ key={`${marker?.id}_${marker?.customer_id}`}
197
+ marker={marker}
202
198
  customer
203
199
  />
204
200
  ))}
@@ -623,7 +623,8 @@ export interface MapViewParams {
623
623
  markerGroups: Array<any>,
624
624
  customerMarkerGroups: Array<any>,
625
625
  alertState: { open: boolean, content: Array<string>, key?: string | null },
626
- setAlertState: ({ open, content, key }: { open: boolean, content: Array<string>, key?: string | null }) => void
626
+ setAlertState: ({ open, content, key }: { open: boolean, content: Array<string>, key?: string | null }) => void,
627
+ assingnedOrders?: any
627
628
  }
628
629
 
629
630
  export interface ReviewCustomerParams {
@@ -657,7 +658,7 @@ export interface SessionsParams {
657
658
  }
658
659
 
659
660
  export interface RenderMarkerParams {
660
- key?: number,
661
+ key?: string,
661
662
  marker: any,
662
663
  customer?: boolean,
663
664
  orderIds?: Array<number>