Repository navigation
feat(android): let an external map's owner invalidate it before destroying it - #4417
Merged
Merged
Conversation
This was referenced Oct 27, 2026
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
Adds
RNMBXExternalMap.invalidate()(SPI, Android) for the owner of an external map (#4412) to call before destroying it. TheRNMBXMapViews showing that map then remove their children right away, while the map is still alive, and skip style work when React unmounts them later. Without it, an Android AutoMapSurfacedestroyed before<CarMap>unmounts gets its layers and sources removed from a dead style. rnmapbox/navigation#17 will call it beforeMapSurface.onDestroy().iOS needs no counterpart:
RNMBXMapViewkeeps the CarPlayMapViewalive until it unmounts, and there's no explicit destroy there.Checklist
CONTRIBUTING.mdyarn generatein the root folder/exampleapp./example)Tested with navigation#17's expo example and its debug car preview on an Android emulator (
<CarMap>with POI circles and a location ring), hiding and re-showing the preview./examplebuilds; it has no external map to exercise.Screenshot OR Video
Before, on every hide:
After, with navigation calling
invalidate(): no such warnings over 11 hide/show cycles (one during simulated guidance), and the re-shown car map still renders the<CarMap>children. View count and native heap stayed flat over 20 more cycles.Component to reproduce the issue you're fixing
Navigation side of the repro (debug car preview from navigation#17):