Skip to content

[Bug]: onMapSteady event not triggered on Android #4148

@jaka-kralj

Description

@jaka-kralj

Mapbox Implementation

Mapbox

Mapbox Version

11.15.2

React Native Version

0.83.1

React Native Architecture

New Architecture (Fabric/TurboModules)

Platform

Android

@rnmapbox/maps version

v10.2.10

Standalone component to reproduce

import React, { useRef } from 'react';
import { StyleSheet } from 'react-native';
import {
  MapView,
  CameraGestureObserver,
  Camera,
  LocationPuck
} from '@rnmapbox/maps';

const Map: React.FC = () => {
  const mapRef = useRef<MapView>(null);
  const cameraRef = useRef<Camera>(null);

  return (
    <MapView
      ref={mapRef}
      style={styles.map}
      styleURL={"mapbox://styles/mapbox/outdoors-v12"}
    >
      <CameraGestureObserver
        quietPeriodMs={200}
        maxIntervalMs={5000}
        onMapSteady={({ nativeEvent }) => {
          console.log("onMapSteady", nativeEvent);
        }}
      />
      <Camera
        ref={cameraRef}
        followZoomLevel={8}
      />
      <LocationPuck />
    </MapView>
  );
};

export default Map;

const styles = StyleSheet.create({
  map: {
    flex: 1,
  },
});

Observed behavior and steps to reproduce

I am trying to use the new onMapSteady callback in order to handle some logic after map position is steady, but it seems that the event is not being fired on component mount on Android for me. Works perfectly on iOS but not for Android. Later when moving around the map I receive following error:

Unsupported top level event type "topOnMapSteady" dispatched

Expected behavior

onMapSteady event should fire on map load bit it does not for Android devices on component mount.

Notes / preliminary analysis

Currently using the onMapIdle for Android instead, but I am getting multiple event triggers which are causing performance issues.

Additional links and references

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🪲Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions