Skip to content

fix: keep ComposeView attached while info window is shown for compose-ui 1.10+ compat#931

Draft
kikoso wants to merge 1 commit into
mainfrom
fix/info-window-content-newer-compose-bom
Draft

fix: keep ComposeView attached while info window is shown for compose-ui 1.10+ compat#931
kikoso wants to merge 1 commit into
mainfrom
fix/info-window-content-newer-compose-bom

Conversation

@kikoso

@kikoso kikoso commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes #913

Summary

  • compose-ui 1.10.0 (shipped in compose-bom 2026.04.01) added an isShown guard to AbstractComposeView.draw(), causing detached views to draw nothing.
  • The previous implementation called renderComposeViewOnce, which attaches the ComposeView and then immediately detaches it. By the time the Maps SDK internally calls draw() to render the info window bitmap, the view is detached and isShown == false, so the content is never drawn.

Changes

  • ComposeInfoWindowAdapter: Replace renderComposeViewOnce with startRenderingComposeView so the view stays attached to the MapView's NoDrawContainerView while the info window is visible. A RenderHandle is stored per marker so we can clean up later.
  • MapApplier: Store a reference to ComposeInfoWindowAdapter and call disposeForMarker(marker) from the existing onInfoWindowClose listener, so the view is removed from the container as soon as the info window is dismissed.

Test plan

  • Add a MarkerInfoWindowContent with custom Compose content
  • Tap the marker to open the info window
  • Confirm the custom content is drawn correctly with compose-bom 2026.04.01+
  • Close the info window and confirm no view leak (the view is removed from the MapView hierarchy)
  • Open the same info window again — confirm it re-renders correctly

…-ui 1.10+ compat

Addresses issue #913: MarkerInfoWindowContent renders empty with
compose-bom 2026.04.01+ (compose-ui 1.10.0+).

compose-ui 1.10.0 added an isShown guard to AbstractComposeView.draw(),
which makes detached views draw nothing. The previous implementation
immediately detached the ComposeView via renderComposeViewOnce, so
by the time the Maps SDK called draw() the view was detached and
isShown == false.

Fix: use startRenderingComposeView (keeps view attached) instead of
renderComposeViewOnce, storing the RenderHandle per marker. The view
stays attached to the MapView's NoDrawContainerView while the info
window is visible, so isShown == true when the Maps SDK renders it.
The RenderHandle is disposed when the info window closes via a new
disposeForMarker() call wired into the existing onInfoWindowClose
listener in MapApplier.
@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 24.82%

There is no coverage information present for the Files changed

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.

MarkerInfoWindowContent not drawing content with androidx.compose:compose-bom:2026.04.01 and newer

2 participants