Skip to content

[Bug]: onMapIdle and onRegionDidChange events do not work #3836

@sabuhiteymurov

Description

@sabuhiteymurov

Mapbox Implementation

Mapbox

Mapbox Version

10.1.38

React Native Version

0.76.9

Platform

iOS

@rnmapbox/maps version

default

Standalone component to reproduce

import React from 'react';
import { StyleSheet, View } from 'react-native';
import Mapbox, { MapView } from '@rnmapbox/maps';

const Map = () => {
  return (
    <View style={styles.container}>
      <MapView
        style={styles.map}
        onMapIdle={() => console.log('map idle')}
        onRegionDidChange={() => console.log('region did change')}
      />
    </View>
  );
};

export default Map;

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

Observed behavior and steps to reproduce

  1. Launch the app using the component above.
  2. Let the map fully load.
  3. Try interacting with it by zooming or dragging.
  4. Notice that neither onMapIdle nor onRegionDidChange trigger initially.

I found that if any state change occurs after the map finishes loading (e.g., inside onDidFinishLoadingMap), then onRegionDidChange starts working as expected. onMapIdle still never triggers, regardless of state changes.

So there seems to be some internal dependency on state/context updates before events begin firing properly — and onMapIdle seems completely non-functional.

Expected behavior

onRegionDidChange should trigger whenever the map's visible region changes — either via user interaction or camera animation.

onMapIdle should fire once the map settles after a movement or animation.

Notes / preliminary analysis

No warnings or errors in the console.

Map loads and renders correctly otherwise.

I’ve temporarily added a dummy state update in the onDidFinishLoadingMap event to "kickstart" the event system, and this made onRegionDidChange work:

const [mapReady, setMapReady] = useState(false);

<MapView onDidFinishLoadingMap={() => {
  setMapReady(true); // Temporary workaround
}} />

This is not ideal, but confirms there might be an internal state issue blocking events from firing until something triggers a re-render.

Additional links and references

Minimal repro repo: https://github.com/sabuhiteymurov/rnmapbox-on-map-idle-reproducer

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