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

オープン
#539 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

@jokerttu がすでに取り組んでいます。

2026年3月1日 から。

  • #695 @sr1k3sh による — オープン

評価

この issue はまだ評価されていません。

説明

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+
主要言語
TypeScript
スター
226
フォーク
39
平均マージ
1日 20時間
マージ済み PR(30日)
7

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

googlemaps/react-native-navigation-sdk のほかの issue

googlemaps/react-native-navigation-sdk の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。