Docyrus

RecordDeleteConfirmDialog

Delete confirmation dialog with cascade relation management for related data.

iOSAndroid
Preview RecordDeleteConfirmDialog on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-record-delete-confirm-dialog

Usage

import { RecordDeleteConfirmDialog } from '@/components/docyrus-native/record-delete-confirm-dialog';

<RecordDeleteConfirmDialog
  open={isOpen}
  onOpenChange={setIsOpen}
  recordCount={selectedIds.length}
  relations={relations}
  isLoadingRelations={relationsQuery.isLoading}
  isPending={deleteMutation.isPending}
  onConfirm={async (childActions) => {
    await deleteMany(selectedIds, childActions);   // { [dataSourceId]: 'keep' | 'delete' }
    setIsOpen(false);
  }}
/>

The dialog is a bottom ActionSheet. Each related data source gets a Keep / Delete choice (plus Keep all / Delete all shortcuts). Every time the sheet opens — and when the relations finish loading while it is open — all choices reset to keep, so a previous session's selection never leaks into the next delete. Relations are de-duplicated by dataSourceId (a data source linked through two fields is listed once), and onConfirm always receives an entry for every listed data source. While isPending, both buttons are disabled and the sheet cannot be dismissed; while isLoadingRelations, the confirm button is disabled.

API Reference

RecordDeleteConfirmDialogProps

PropTypeDefaultDescription
openboolean—Controls sheet visibility.
onOpenChange(open: boolean) => void—Called on Cancel / backdrop / close (not while isPending).
recordCountnumber—Number of records being deleted (title + description).
relationsDataSourceRelation[]—Related data sources that reference the records. De-duplicated by dataSourceId.
isLoadingRelationsbooleanfalseShows a loading row and disables the confirm button.
onConfirm(childActions: Record<string, ChildAction>) => void | Promise<void>—Called with one keep / delete entry per related data source.
isPendingbooleanfalseDisables the buttons, shows t('ui.common.deleting', 'Deleting...') and blocks dismissal.
classNamestring—Additional classes for the action sheet (native extra).

DataSourceRelation

FieldTypeDescription
dataSourceIdstringUnique identifier of the related data source (key of childActions).
dataSourceNamestringDisplay name of the related data source.
dataSourceSlugstringSlug of the related data source.
appSlugstringApplication slug.
dataSourceTypestringType of the data source.
fieldIdstringID of the linking field.
fieldSlugstringSlug of the linking field.
fieldNamestringDisplay name of the linking field (shown as "via …").
fieldTypestringType of the linking field.

ChildAction

type ChildAction = 'keep' | 'delete';

keep removes the relation and keeps the related records; delete deletes them together with the parent.

Translation keys

KeyEnglish fallback
ui.recordDeleteConfirmDialog.titleOne / titleManyDelete this record? / Delete {count} records?
ui.recordDeleteConfirmDialog.descriptionOne / descriptionManyThis will permanently delete this record. … / This will permanently delete {count} records. …
ui.recordDeleteConfirmDialog.loadingRelationsLoading related data...
ui.recordDeleteConfirmDialog.relatedDataRelated data
ui.recordDeleteConfirmDialog.keepAll / deleteAllKeep all / Delete all
ui.recordDeleteConfirmDialog.keepKeep
ui.recordDeleteConfirmDialog.viavia {field}
ui.common.cancel / ui.common.delete / ui.common.deletingCancel / Delete / Deleting...

Components

ComponentDescription
RecordDeleteConfirmDialogBottom-sheet delete confirmation with per-relation cascade choices.

Type Exports

TypeDescription
RecordDeleteConfirmDialogPropsProps for RecordDeleteConfirmDialog.
DataSourceRelationRelated data source information.
ChildAction'keep' | 'delete'.

Breaking changes

  • Choices now reset to keep every time the dialog opens (previously the last selection was kept).
  • The confirm button is disabled while isLoadingRelations.
  • onConfirm may return a Promise (widening — existing handlers keep working).
  • The single-record title changed from "Delete 1 record?" to "Delete this record?"; all copy is translatable through the keys above.

On this page