UNPKG

1.99 kBTypeScriptView Raw
1import * as React from 'react';
2export 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};
16export declare type ListAccordionGroupContextType = {
17 expandedId: string | number | undefined;
18 onAccordionPress: (expandedId: string | number) => void;
19} | null;
20export 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 * ## Usage
27 * ```js
28 * import * as React from 'react';
29 * import { View, Text } from 'react-native';
30 * import { List } from 'react-native-paper';
31 *
32 * const MyComponent = () => (
33 * <List.AccordionGroup>
34 * <List.Accordion title="Accordion 1" id="1">
35 * <List.Item title="Item 1" />
36 * </List.Accordion>
37 * <List.Accordion title="Accordion 2" id="2">
38 * <List.Item title="Item 2" />
39 * </List.Accordion>
40 * <View>
41 * <Text>
42 * List.Accordion can be wrapped because implementation uses React.Context.
43 * </Text>
44 * <List.Accordion title="Accordion 3" id="3">
45 * <List.Item title="Item 3" />
46 * </List.Accordion>
47 * </View>
48 * </List.AccordionGroup>
49 * );
50 *
51 * export default MyComponent;
52 *```
53 */
54declare const ListAccordionGroup: {
55 ({ expandedId: expandedIdProp, onAccordionPress, children, }: Props): React.JSX.Element;
56 displayName: string;
57};
58export default ListAccordionGroup;
59//# sourceMappingURL=ListAccordionGroup.d.ts.map
\No newline at end of file