Delete Account Button
A secure delete account component that provides user account deletion functionality with confirmation modal and proper error handling.
Getting Started
Basic Usage
The simplest way to implement account deletion:
import { DeleteAccountButton } from "@ovok/native";
import React from "react";
const BasicDeleteAccount = () => {
return <DeleteAccountButton />;
};
export default BasicDeleteAccount;
Features
- Confirmation Modal: Built-in confirmation dialog to prevent accidental deletion
- Secure Deletion: Integrates with backend API for proper account deletion
- Error Handling: Comprehensive error handling with callback support
- Theme Integration: Consistent styling with your app theme
- Icon Integration: Uses profile delete icon with error color
- Auto Logout: Automatically clears active login session after deletion
- TypeScript: Full type safety throughout
Props
Extends all SettingListItemProps with additional delete-specific functionality.
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "settings.delete-account" translation | Custom button title |
onSuccess | () => void | undefined | Called when account deletion succeeds |
onError | (error: Error) => void | undefined | Called when account deletion fails |
onPress | () => void | undefined | Called when button is pressed (before modal) |
Inherited Props
All props from SettingListItem are supported:
style- Custom stylingtestID- Test identifierdisabled- Disable the buttonsubtitle- Additional description text- And all other
SettingListItemProps
Localization
The component uses these translation keys:
{
"settings": {
"delete-account": "Delete Account",
"delete-account-confirmation": "Are you sure you want to delete your account? This action cannot be undone."
},
"common": {
"cancel": "Cancel",
"delete": "Delete"
}
}
Related Components
- Logout Button - Simple session termination without account deletion
- Profile Form - User account management and editing
- Sign-In - User authentication (needed after account recovery)