Account settings
Edit the profile with a live username check, see the subscription, and delete the account with a hold.
npx @swipeui/cli add settings-accountWhen to use it
- An account page reached from settings: name, username, email, plan and deletion.
- Any delete-account flow that needs a deliberate hold.
When not to use it
- Sign-up or sign-in. Use the auth screens when they ship.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add settings-account- Adds
components/swipeui/settings/settings-account.tsx,components/swipeui/settings/use-settings-account.tsand 41 shared helpers. - Installs react-native-reanimated, react-native-safe-area-context, clsx, tailwind-merge, react-native-svg, uniwind, react-native-worklets, expo-haptics, class-variance-authority, react-native-gesture-handler, @expo/ui, @gorhom/bottom-sheet, expo-blur, react-native-keyboard-controller. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { router } from 'expo-router';
import { SettingsAccount } from '@/components/swipeui/settings/settings-account';
export default function AccountScreen() {
return (
<SettingsAccount
onBack={router.back}
onManageSubscription={() => router.push('/billing')}
onDeleted={() => router.replace('/sign-in')}
/>
);
}The screen reads account from the schema. Fields stay above the keyboard through Form Scroll View, so wrap your app in FormProvider once.
The adapter
import type { SettingsAdapter } from '@/components/swipeui/settings/settings-core';
export const settingsAdapter: SettingsAdapter = {
action: async (id) => {
if (id === 'sign-out') await auth.signOut();
},
checkUsername: async (username, signal) => {
const response = await fetch(`/api/usernames/${encodeURIComponent(username)}`, { signal });
return response.json(); // { available: boolean, suggestion?: string }
},
saveProfile: (profile, signal) => api.updateProfile(profile, { signal }),
deleteAccount: (signal) => api.deleteAccount({ signal }),
};Checks wait for typing to pause (usernameCheckDelay) and cancel the previous request through its AbortSignal. Any method may reject: Save shows the failure in its button and the hold offers a retry.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
data? | | | The schema; this screen reads its |
adapter? | | | Checks usernames, saves the profile and deletes the account. |
onBack? | | — | Go back. Shows a back button in the drawn header. |
onSaved? | | — | The profile was saved. |
onDeleted? | | — | The account was deleted. Sign the person out and leave the screen here. |
onManageSubscription? | | — | The subscription row was pressed. Without it the row is plain. |
checkUsername? | | | Check new usernames through the adapter as people type. |
usernameCheckDelay? | | | Pause after typing before a check, in milliseconds. |
showSubscription? | | | The subscription section with its usage meter. |
allowDelete? | | | The delete-account flow at the bottom. |
deleteHoldDuration? | | | How long to hold before the account is deleted, in milliseconds. |
header? | | |
|
headerTrailing? | | — | Content after the title in the drawn header. |
haptics? | | | Haptics for saving, the check result and the hold. |
motion? | | | Local motion feel or spring override. |
messages? | | | Built-in words. |
className? | | — | Root classes. |
style? | | — | Root style. |
testID? | | — | Root identifier. Parts append |
Composition and behavior
- A username is checked only when it changes and fits the rule (3 to 20 letters, numbers, dots or underscores). A taken name shows the adapter's suggestion.
- Save turns on only when something changed and everything is valid, and shows Saved when the adapter succeeds.
- Delete account lists what goes (
account.deletes), then a hold to confirm runsadapter.deleteAccount. Keep my account closes it.
Behavior and gestures
- A new username is checked through adapter.checkUsername after typing pauses; a taken name offers the adapter's suggestion.
- Save sends the edits through adapter.saveProfile and shows Saved in the button.
- Delete account opens the consequences, then a hold to confirm runs adapter.deleteAccount.
Accessibility
- Field messages are read with their fields; the check result is announced as it changes.
- The hold has a named confirm action for screen readers.
Motion
- Uses the
layoutandpressmotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The delete confirmation fades in; Reduce Motion shows it at once.
Performance
- Username checks wait for a pause and cancel the previous request.
Notes for AI
- Implement checkUsername, saveProfile and deleteAccount in your adapter; they may reject.
- Sign the person out in onDeleted.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.