Skip to content

Share placement, clipping, and lifecycle helpers for embedded native views - #64

Merged
rdlabo merged 7 commits into
mainfrom
feat/shared-placement-lifecycle
Nov 28, 2026
Merged

rdlabo merged 7 commits into
mainfrom
feat/shared-placement-lifecycle

Conversation

@rdlabo

@rdlabo rdlabo commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Native views embedded in a WebView need to follow the visible part of their DOM host. Capacitor Stripe and AdMob both handle clipping, scroll updates, and cleanup when the page or activity goes away.

Changes

  • Add measureProjectionFrame and observeProjectionLayout to measure the host in viewport CSS pixels and observe changes across scroll containers, shadow roots, and the visual viewport.
  • Add bindSnapshotVisibleArea to clip visible snapshot images to an app-provided area during scrolling. A prepared, hidden image does not poll the callback.
  • On Android, share CSS-to-pixel conversion and clipped placement for scroll-hosted SDK views. Provide a UI-thread helper that rechecks the activity before running queued SDK work.
  • On iOS, add NativeUIDocumentObservation so plugins can release document-bound resources when their WebView loads a new main document.

Verification

Engine browser and controls suites, lint, and npm package validation passed locally. Native tests exercised Android scroll and touch handling and iOS document replacement. Both Capacitor plugins were also built against this branch and passed their web, Android, and iOS plugin tests.

Related consumer work includes Stripe embedded checkout, AdMob visible areas, and AdMob activity teardown.

@rdlabo
rdlabo merged commit 0569b37 into main Nov 28, 2026
10 checks passed
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