Skip to content

[Bug]: iOS crash during dev reload — NavModule event emitters called with invalid bridge #539

Open

Description

@christian-apollo

Bug Description

During React Native development reloads (e.g. CMD+R or fast refresh), the app crashes on iOS because callback methods in NavModule.mm attempt to emit events through the React Native bridge after it has been invalidated/torn down.

The crash occurs because navigation callbacks (onLocationChanged, onArrival, onRemainingTimeOrDistanceChanged, onRouteChanged, onReroutingRequestedByOffRoute, onStartGuidance, onTurnByTurn) continue to fire after the bridge is destroyed during reload, and the emit* calls throw exceptions when the bridge is unavailable.

Steps to Reproduce

  1. Start a React Native app using @googlemaps/react-native-navigation-sdk on iOS
  2. Begin an active navigation session (so callbacks are firing)
  3. Trigger a development reload (CMD+R or save a file with fast refresh)
  4. App crashes

Expected Behavior

The app should gracefully handle the bridge being unavailable during reload without crashing.

Suggested Fix

Wrap each emit* call in the INavigationCallback methods in NavModule.mm with a try-catch block to silently ignore exceptions when the bridge is invalid during reload. The affected methods are:

  • onLocationChanged:
  • onArrival:
  • onRemainingTimeOrDistanceChangedWithNavigator:
  • onRouteChanged
  • onReroutingRequestedByOffRoute
  • onStartGuidance
  • onTurnByTurn:

Example fix for one method:

- (void)onLocationChanged:(NSDictionary *)mappedLocation {
  try {
    [self emitOnLocationChanged:@{@"location" : mappedLocation}];
  } catch (...) {
    // Bridge may be invalid during dev reload - ignore to prevent crash
  }
}

The same pattern applies to all 7 callback methods listed above.

Environment

  • SDK version: 0.14.1
  • Platform: iOS
  • React Native: 0.76+

Activity

  1. illuminati1911 commented on Mar 11, 2026

    @illuminati1911
    Contributor

    @christian-apollo Thank you for opening the issue. We'll look into it.

  2. added
    priority: p3Desirable enhancement or fix. May not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Mar 11, 2026
  3. sr1k3sh commented on Apr 10, 2026

    @sr1k3sh

    i'm having similar issue, when app reload it crash on IOS. I figured out the issue was related to calling setOnArrival , setOnRemainingTimeOrDistanceChanged from useNavigationSDK hooks.

  4. sr1k3sh commented on Nov 2, 2026

    @sr1k3sh

    I can still reproduce this on 0.18.0. On main, the callbacks in NavModule.mm (onLocationChanged, onArrival, onRemainingTimeOrDistanceChanged, onRouteChanged, onReroutingRequestedByOffRoute, onStartGuidance, onTurnByTurn) still call the emitOn* methods with no guard for a module that has been invalidated during a reload.

    I'd be happy to open a PR that stops emitting once the module is invalidated (and detaches the navigator listener in invalidate), so a CMD+R / fast refresh no longer crashes. Would that be welcome? I've signed the Google CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions