• Hook to subscribe to an event on the MapView.

    Must be used within a MapView component.

    Type Parameters

    Parameters

    • event: T

      The event to listen for.

    • callback: (
          payload: TEvents[T] extends { data: null }
              ? any[any]["data"]
              : TEvents[T],
      ) => void

      The callback to call when the event is triggered.

    Returns void

    If used outside of a MapView component.

    useMapViewEvent('click', event => {
    const { coordinate } = event;
    const { latitude, longitude } = coordinate;
    console.log(`Map was clicked at ${latitude}, ${longitude}`);
    });