Accordion
Secciones colapsables. Una o varias abiertas, controlado o no.
Uso
import {Accordion} from 'rn-inkpad';
<Accordion
items={[
{title: 'Shipping', content: 'Free over $50.'},
{title: 'Returns', content: <ReturnsPolicy />},
]}
defaultExpanded={[0]}
/>
// controlled, several open at once
<Accordion items={items} multiple expanded={open} onChange={setOpen} />
Props
| Nombre | Tipo | Por defecto | Descripción |
|---|---|---|---|
| items | {title: string; content: ReactNode; icon?: IconProp; disabled?: boolean}[] | Sections. String content is wrapped in a Text. | |
| multiple | boolean | false | Allow several open sections. |
| defaultExpanded | number[] | [] | Initially open indexes (uncontrolled). |
| expanded | number[] | Open indexes (controlled). | |
| onChange | (expanded: number[]) => void | Called with the new open indexes. | |
| expandIcon | IconProp | chevron down | Icon of closed sections. |
| collapseIcon | IconProp | chevron up | Icon of open sections. |
| color | string | theme text | Title and icon color. |
| borderColor | string | theme border | Border color. |
| style | StyleProp<ViewStyle> | Container style. | |
| titleStyle | StyleProp<TextStyle> | Title style. | |
| contentStyle | StyleProp<ViewStyle> | Content wrapper style. |