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

Aperta
#539 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

@jokerttu ci sta già lavorando.

Dal 1/3/2026.

  • #695 di @sr1k3sh — aperta

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

priority: p3 type: bug

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+
Lingua principale
TypeScript
Stelle
226
Fork
39
Merge medio
1g 20h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di googlemaps/react-native-navigation-sdk

Tutte le issue di googlemaps/react-native-navigation-sdk

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.