googlemaps / react-native-navigation-sdk

Apache License 2.0
25 stars 5 forks source link

onMarkerClick callback sometimes missing properties #207

Open jmcguiresignifyhealth opened 3 months ago

jmcguiresignifyhealth commented 3 months ago

Environment details

OS: iOS 17.5 simulator Version: react-native-navigation-sdk@0.3.3-beta

Steps to reproduce

  1. Provide a callback function for onMarkerClick in the mapViewCallbacks property of component. Then either console.log the marker that's passed to that function or just debug that callback
  2. Add markers to the map using addMarker on MapViewController
  3. Run the app and click the far outside edge of the marker
  4. The marker passed to the onMarkerClick callback is missing properties, such as Id and snippet

Code example

mapViewController
  ?.addMarker({
  position: coordinates,
  snippet: 'hello world',
  visible: true,
})

onMarkerClick: (selectedMarker: Marker) => {
  console.log("marker clicked", JSON.stringify(selectedMarker));

  const selectedAppointmentMarker = appointmentMarkers.find(appointmentMarker => appointmentMarker.id === selectedMarker.id);

  const appointment = appointments?.find(
    (appointment) => appointment.appointmentId.toString() === selectedAppointmentMarker?.appointmentId.toString()
  );

  setSelectedAppointment(appointment ?? null);
},

See attached video In the video, I'm logging the selected marker in the terminal. Notice in the first "marker clicked" log we are missing Id and snippet, while in the second log for marker clicked we have Id and snippet. It's also worth noting, that in this video we have multiple markers stacked on precisely the same lat/lng.

https://github.com/user-attachments/assets/0362030b-09b1-4dab-a5a6-e1ffa5df2dcc

illuminati1911 commented 3 months ago

@jmcguiresignifyhealth Thanks for reporting this!