Modal
A centred dialog, the native counterpart of the web Modal: title, description, a scrollable body and a footer. dismissible={false} for a question that must be answered.
Examples
Loading examples…
API
From COMPONENTS.md; setup for every native component is on React Native.
| Component | Notes |
|---|---|
Modal |
Centred dialog — native counterpart of web Modal. Title/description/body/footer, scrollable body, dismissible={false} for questions that must be answered. |
Centred dialog for questions and short forms. Square corners, 1.5px ink border, hard stamp shadow, tracing-paper scrim; fades and rises 8px in ≤220ms. The body scrolls when content outgrows the screen.
import { Modal, Button } from 'achery-ui/native'
<Modal
open={open}
onClose={() => setOpen(false)}
title="Rename list"
footer={
<>
<Button variant="ghost" size="sm" onPress={() => setOpen(false)}>Cancel</Button>
<Button variant="accent" size="sm" onPress={save}>Save</Button>
</>
}
>
<Field label="Name"><Input value={name} onChangeText={setName} /></Field>
</Modal>
// A question that must be answered: no scrim/back/✕ dismissal
<Modal open={!answered} dismissible={false} title="Share usage data?" footer={…}>
Usage and crash reports help find bugs.
</Modal>
| Prop | Type | Default |
|---|---|---|
open |
boolean |
required |
onClose |
() => void |
— (called on scrim tap, ✕, Android back) |
title |
ReactNode |
— (strings render in the display face) |
description |
ReactNode |
— |
children |
ReactNode |
— (strings render as body text) |
footer |
ReactNode |
— (right-aligned row with a top rule) |
dismissible |
boolean |
true — false disables scrim, back button and ✕ |
showClose |
boolean |
true (ignored when not dismissible) |
size |
'sm' | 'md' | 'lg' |
'sm' (400 / 560 / 760, capped to the screen) |
style |
ViewStyle |
— |
Differs from web Modal: controlled only (open + onClose rather than onOpenChange / trigger), matching native BottomSheet.