1 | import * as React from 'react';
|
2 | declare type Props = {
|
3 | /**
|
4 | * Function to execute on selection change.
|
5 | */
|
6 | onAccordionPress?: (expandedId: string | number) => void;
|
7 | /**
|
8 | * Id of the currently expanded list accordion
|
9 | */
|
10 | expandedId?: string | number;
|
11 | /**
|
12 | * React elements containing list accordions
|
13 | */
|
14 | children: React.ReactNode;
|
15 | };
|
16 | export declare type ListAccordionGroupContextType = {
|
17 | expandedId: string | number | undefined;
|
18 | onAccordionPress: (expandedId: string | number) => void;
|
19 | } | null;
|
20 | export declare const ListAccordionGroupContext: React.Context<ListAccordionGroupContextType>;
|
21 | /**
|
22 | * List.AccordionGroup allows to control a group of List Accordions. `id` prop for List.Accordion is required in order for group to work.
|
23 | * List.AccordionGroup can be a controlled or uncontrolled component. The example shows the uncontrolled version.
|
24 | * At most one Accordion can be expanded at a given time.
|
25 | *
|
26 | * <div class="screenshots">
|
27 | * <img class="medium" src="screenshots/list-accordion-group.png" />
|
28 | * </div>
|
29 | *
|
30 | * ## Usage
|
31 | * ```js
|
32 | * import * as React from 'react';
|
33 | * import { View, Text } from 'react-native';
|
34 | * import { List } from 'react-native-paper';
|
35 | *
|
36 | * const MyComponent = () => (
|
37 | * <List.AccordionGroup>
|
38 | * <List.Accordion title="Accordion 1" id="1">
|
39 | * <List.Item title="Item 1" />
|
40 | * </List.Accordion>
|
41 | * <List.Accordion title="Accordion 2" id="2">
|
42 | * <List.Item title="Item 2" />
|
43 | * </List.Accordion>
|
44 | * <View>
|
45 | * <Text>
|
46 | * List.Accordion can be wrapped because implementation uses React.Context.
|
47 | * </Text>
|
48 | * <List.Accordion title="Accordion 3" id="3">
|
49 | * <List.Item title="Item 3" />
|
50 | * </List.Accordion>
|
51 | * </View>
|
52 | * </List.AccordionGroup>
|
53 | * );
|
54 | *
|
55 | * export default MyComponent;
|
56 | *```
|
57 | */
|
58 | declare const ListAccordionGroup: {
|
59 | ({ expandedId: expandedIdProp, onAccordionPress, children, }: Props): JSX.Element;
|
60 | displayName: string;
|
61 | };
|
62 | export default ListAccordionGroup;
|