Skip to content

feat(mapview): add staticMode prop for static maps in lists#85

Open
lodev09 wants to merge 5 commits into
mainfrom
feat/static-mode
Open

feat(mapview): add staticMode prop for static maps in lists#85
lodev09 wants to merge 5 commits into
mainfrom
feat/static-mode

Conversation

@lodev09

@lodev09 lodev09 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a staticMode prop to MapView for rendering non-interactive static maps, optimized for list views where mounting many live maps is expensive.

  • Android (Google) - uses lite mode (GoogleMapOptions.liteMode), rendering a static bitmap instead of a live GL surface. Lite mode toolbar disabled.
  • iOS (Apple/Google) - map initializes with interaction disabled; once fully rendered (mapViewDidFinishRenderingMap: / mapViewSnapshotReady:), the live map is swapped with a snapshot image and torn down, releasing Metal/GL resources per instance. Swap is deferred if the view is off-window; map stays live if rendering never completes (e.g. offline).
  • Web - forces gestureHandling: 'none'.

staticMode is creation-time only. On iOS, camera commands and prop updates are no-ops after the snapshot swap.

Example: new StaticMapsScreen (shared) renders a FlatList of pressable place cards with static maps + markers, with an Apple/Google provider toggle. Wired into bare (StaticMaps route) and expo (/static-maps), reachable via a "Static Maps" button in the control sheet.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Test Plan

  • yarn typecheck, yarn test, yarn lint, ktlint, objclint pass
  • Example app: Static Maps screen renders static map list on iOS (Apple/Google via toggle) and Android (lite mode); row press navigates while maps ignore touches

Screenshots / Videos

N/A

Checklist

  • I tested on iOS
  • I tested on Android
  • I tested on Web
  • I updated the documentation (if needed)

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

lodev09 added 5 commits July 6, 2026 22:47
drawMapRect: runs on MapKit's background render queues; snapshot
polyline/distances/colors so main-thread updates can't cause
out-of-bounds reads or use-after-free of the color cache
- reset static content on staticKey change (prevents stale/poisoned
  snapshot cache with in-place list recycling)
- re-arm snapshot swap on zero-size capture instead of giving up
- bound snapshot cache by memory; include camera in cache key
- reset recycled wrapper placeholder styling
- web: disable POI clicks, keyboard, and press handlers in staticMode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant