Skip to content

kaspernj/askance

Repository files navigation

askance

Promise-based confirmation dialogs for React Native and Expo apps.

Usage

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"
})

Keyboard

  • Enter confirms.
  • Escape cancels.
  • Pressing the backdrop cancels.

Test IDs

The default dialog root is askance-confirm.

  • askance-confirm-confirm
  • askance-confirm-cancel
  • askance-confirm-message
  • askance-confirm-title

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors