UNPKG

4.31 kBTypeScriptView Raw
1import * as React from 'react';
2import { ViewStyle, StyleProp, TextStyle } from 'react-native';
3declare type Props = {
4 /**
5 * Title text for the list accordion.
6 */
7 title: React.ReactNode;
8 /**
9 * Description text for the list accordion.
10 */
11 description?: React.ReactNode;
12 /**
13 * Callback which returns a React element to display on the left side.
14 */
15 left?: (props: {
16 color: string;
17 }) => React.ReactNode;
18 /**
19 * Callback which returns a React element to display on the right side.
20 */
21 right?: (props: {
22 isExpanded: boolean;
23 }) => React.ReactNode;
24 /**
25 * Whether the accordion is expanded
26 * If this prop is provided, the accordion will behave as a "controlled component".
27 * You'll need to update this prop when you want to toggle the component or on `onPress`.
28 */
29 expanded?: boolean;
30 /**
31 * Function to execute on press.
32 */
33 onPress?: () => void;
34 /**
35 * Function to execute on long press.
36 */
37 onLongPress?: () => void;
38 /**
39 * Content of the section.
40 */
41 children: React.ReactNode;
42 /**
43 * @optional
44 */
45 theme: ReactNativePaper.Theme;
46 /**
47 * Style that is passed to the wrapping TouchableRipple element.
48 */
49 style?: StyleProp<ViewStyle>;
50 /**
51 * Style that is passed to Title element.
52 */
53 titleStyle?: StyleProp<TextStyle>;
54 /**
55 * Style that is passed to Description element.
56 */
57 descriptionStyle?: StyleProp<TextStyle>;
58 /**
59 * Truncate Title text such that the total number of lines does not
60 * exceed this number.
61 */
62 titleNumberOfLines?: number;
63 /**
64 * Truncate Description text such that the total number of lines does not
65 * exceed this number.
66 */
67 descriptionNumberOfLines?: number;
68 /**
69 * Id is used for distinguishing specific accordion when using List.AccordionGroup. Property is required when using List.AccordionGroup and has no impact on behavior when using standalone List.Accordion.
70 */
71 id?: string | number;
72 /**
73 * TestID used for testing purposes
74 */
75 testID?: string;
76};
77declare const _default: (React.ComponentClass<Pick<Props, "style" | "title" | "children" | "onPress" | "onLongPress" | "testID" | "left" | "right" | "description" | "titleStyle" | "descriptionStyle" | "titleNumberOfLines" | "descriptionNumberOfLines" | "id" | "expanded"> & {
78 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
79}, any> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<Props, any> & {
80 ({ left, right, title, description, children, theme, titleStyle, descriptionStyle, titleNumberOfLines, descriptionNumberOfLines, style, id, testID, onPress, onLongPress, expanded: expandedProp, }: Props): JSX.Element;
81 displayName: string;
82}) | (React.FunctionComponent<Props> & {
83 ({ left, right, title, description, children, theme, titleStyle, descriptionStyle, titleNumberOfLines, descriptionNumberOfLines, style, id, testID, onPress, onLongPress, expanded: expandedProp, }: Props): JSX.Element;
84 displayName: string;
85}), {}>) | (React.FunctionComponent<Pick<Props, "style" | "title" | "children" | "onPress" | "onLongPress" | "testID" | "left" | "right" | "description" | "titleStyle" | "descriptionStyle" | "titleNumberOfLines" | "descriptionNumberOfLines" | "id" | "expanded"> & {
86 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
87}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<Props, any> & {
88 ({ left, right, title, description, children, theme, titleStyle, descriptionStyle, titleNumberOfLines, descriptionNumberOfLines, style, id, testID, onPress, onLongPress, expanded: expandedProp, }: Props): JSX.Element;
89 displayName: string;
90}) | (React.FunctionComponent<Props> & {
91 ({ left, right, title, description, children, theme, titleStyle, descriptionStyle, titleNumberOfLines, descriptionNumberOfLines, style, id, testID, onPress, onLongPress, expanded: expandedProp, }: Props): JSX.Element;
92 displayName: string;
93}), {}>);
94export default _default;