Version: 3.0.0-next.38

AlertDialog

AlertDialog component is used to interrupt the user with a mandatory confirmation or action. AlertDialog composes Modal so you can use all its props.

Import#

  • AlertDialog: provides context and state for the dialog.
  • AlertDialog.Header: contains the title announced by screen readers.
  • AlertDialog.Body: contains the description announced by screen readers.
  • AlertDialog.Footer: contains the actions of the dialog.
  • AlertDialog.Content: The wrapper for the alert dialog's content.
  • AlertDialog.CloseButton: The button that closes the dialog.
import { AlertDialog } from 'native-base';

Examples#

Basic#

Transition#

Props#

AlertDialog and its components compose the Modal component, so all the Modal props can be passed to it. The only exception is that it requires leastDestructiveRef which is similar to initialFocusRef of Modal.

NameTypeDescriptionDefault
leastDestructiveRefReact.RefThe least destructive action to get focus when dialog is open.-