Repository navigation
fix(ios): keep a custom map view's gesture delegate - #4375
Merged
Merged
Conversation
A map view returned by RNMBXMapViewFactory may already have a gestures.delegate, e.g. a Navigation SDK NavigationMapView. Forward gesture callbacks to it instead of dropping it.
mfazekas
added a commit
to rnmapbox/navigation
that referenced
this pull request
Oct 20, 2026
Use the tightened navigation SPI from rnmapbox/maps#4374: the factories get an RNMBXMapView parent, so the casts and @preconcurrency go away, and the Android camera-will-move listener is unregistered through the returned Cancelable when the map detaches. rnmapbox/maps#4375 keeps the factory map's gesture delegate on iOS, so the gesture-recognizer workaround is replaced by NavigationMapViewDelegate.navigationMapViewUserDidStartInteraction.
mfazekas
added a commit
to rnmapbox/navigation
that referenced
this pull request
Oct 20, 2026
Use the tightened navigation SPI from rnmapbox/maps#4374: the factories get an RNMBXMapView parent, so the casts and @preconcurrency go away, and the Android camera-will-move listener is unregistered through the returned Cancelable when the map detaches. rnmapbox/maps#4375 keeps the factory map's gesture delegate on iOS, so the gesture-recognizer workaround is replaced by NavigationMapViewDelegate.navigationMapViewUserDidStartInteraction.
mfazekas
added a commit
to rnmapbox/navigation
that referenced
this pull request
Oct 20, 2026
Use the tightened navigation SPI from rnmapbox/maps#4374: the factories get an RNMBXMapView parent, so the casts and @preconcurrency go away, and the Android camera-will-move listener is unregistered through the returned Cancelable when the map detaches. rnmapbox/maps#4375 keeps the factory map's gesture delegate on iOS, so the gesture-recognizer workaround is replaced by NavigationMapViewDelegate.navigationMapViewUserDidStartInteraction.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RNMBXMapView.createMapView()setsmapView.gestures.delegate = self, which drops any delegate a map view fromRNMBXMapViewFactoryalready had. With this change an existing delegate is added to the gesture delegatesRNMBXMapViewalready forwards to (the weak set behindaddGestureDelegate), so it keeps gettingdidBegin/didEnd/didEndAnimatingFor. Plain maps have no prior delegate, so nothing changes for them.The use case is @rnmapbox/navigation, whose factory returns the
MapViewof a Navigation SDKNavigationMapView. That view is the gesture delegate and turns these callbacks intoNavigationMapViewDelegate.navigationMapViewUserDidStartInteraction/DidEndInteraction. With this fix navigation can drop its workaround (anaddTargeton every gesture recognizer) and set its camera state to idle fromnavigationMapViewUserDidStartInteractioninstead.Tested on an iOS 26.5 simulator:
portal:, simulated guidance in following mode. Before the fix theNavigationMapViewDelegateinteraction callbacks never fire. With the fix and the workaround replaced by the delegate, pan, pinch, rotate and double-tap zoom each switch the camera state to idle, the same as with the workaround. Without the fix the delegate version stays in following.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp.