Skip to content

Add alert bridge component - #2

Merged
zumkorn merged 1 commit into
mainfrom
alert-bridge-component
Jul 25, 2026
Merged

zumkorn merged 1 commit into
mainfrom
alert-bridge-component

Conversation

@zumkorn

@zumkorn zumkorn commented Jul 25, 2026 •

Copy link
Copy Markdown
Collaborator

Native half of the alert bridge component, copied from the hotwire-bridge-components registry.

Presents an AlertDialog from the web side's show message and replies to that message only when the confirming button is tapped. Every other way out — the dismiss button, a tap outside, the back press — sends nothing back, and the web side reads that silence as "not confirmed".

Android has no destructive button style, so destructive tints the positive button with the theme's colorError instead. The tint is applied after show(), since the dialog's buttons do not exist before that; the colour is resolved through resourceId when the theme hands back a reference rather than a literal.

Verified

Built and run on an emulator (Pixel, API 36) against the deployed demo. Both paths behave: Keep leaves the page untouched, Delete reports back and the page updates. The error tint resolves — the confirm button draws red. Recording is on the docs PR.

Native counterpart of the web side's `alert` component: presents an
AlertDialog from the `show` message and replies to it only when the
confirming button is tapped. Dismissing — the button, a tap outside, or
the back press — sends nothing, and the web side reads that silence as
"not confirmed".

Android has no destructive button style, so `destructive` tints the
positive button with the theme's error colour instead. The tint is
applied after show() because the buttons do not exist until then.

Copied from the hotwire-bridge-components registry, which follows
joemasilotti/bridge-components (MIT).
@zumkorn
zumkorn merged commit 75d64b3 into main Jul 25, 2026
@zumkorn
zumkorn deleted the alert-bridge-component branch July 25, 2026 17:29
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