Promise-based confirmation dialogs for React Native and Expo apps.
Mount the host once near the app root:
import {ConfirmDialogHost} from "askance"
export default function App() {
return <ConfirmDialogHost />
}Ask for confirmation from handlers:
import {confirmDialog} from "askance"
if (await confirmDialog("Are you sure?")) {
await model.destroy()
}Customize one dialog:
await confirmDialog({
cancelLabel: "Cancel",
confirmLabel: "Delete",
danger: true,
message: "Delete this record?",
title: "Confirm deletion"
})Enterconfirms.Escapecancels.- Pressing the backdrop cancels.
The default dialog root is askance-confirm.
askance-confirm-confirmaskance-confirm-cancelaskance-confirm-messageaskance-confirm-title