-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
Accordion.d.ts
146 lines (125 loc) · 3.35 KB
/
Accordion.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import * as React from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { EasingMode } from './index';
export interface AccordionProps<T> {
/**
* An array of sections passed to the render methods
*/
sections: T[];
/**
* A function that should return a renderable representing the header
*/
renderHeader(
content: T,
index: number,
isActive: boolean,
sections: T[]
): React.ReactElement<{}>;
/**
* A function that should return a renderable representing the footer
*/
renderFooter?(
content: T,
index: number,
isActive: boolean,
sections: T[]
): React.ReactElement<{}>;
/**
* A function that should return a renderable representing the section title above the touchable
*/
renderSectionTitle?(
content: T,
index: number,
isActive: boolean,
sections: T[]
): React.ReactElement<{}>;
/**
* A function that should return a renderable representing the content
*/
renderContent(
content: T,
index: number,
isActive: boolean,
sections: T[]
): React.ReactElement<{}>;
/**
* A function that is called when the currently active section(s) are updated.
*/
onChange(indexes: number[]): void;
/**
* Used to extract a unique key for a given item at the specified index. Key is used for caching
* and as the react key to track item re-ordering. The default extractor checks `item.key`, then
* falls back to using the index, like React does.
*/
keyExtractor?: (item: T, index: number) => number | string;
/**
* Controls whether user can interact with accordion
*/
disabled?: boolean;
/**
* Expand content from the bottom instead of the top
*
* @default false
*/
expandFromBottom?: boolean;
/**
* Allow more than one section to be expanded at a time. Defaults to false for legacy behavior.
*
* @default false
*/
expandMultiple?: boolean;
/**
* Control which indices from keyEctractor in the sections array are currently
* open. If empty, closes all sections.
*/
activeSections: number[] | string[];
/**
* The color of the underlay that will show through when tapping on headers.
*
* @default black
*/
underlayColor?: string;
/**
* Alignment of the content when transitioning, can be top, center or bottom
*
* @default top
*/
align?: 'top' | 'center' | 'bottom';
/**
* Duration of transition in milliseconds
*
* @default 300
*/
duration?: number;
/**
* Function or function name from Easing (or tween-functions if < RN 0.8). Collapsible will try to combine Easing functions for you if you name them like tween-functions.
*
* @default easeOutCubic
*/
easing?: EasingMode | any;
/**
* Component to use for the Touchable
*
* @default TouchableHighlight
*/
touchableComponent?: React.ComponentType;
/**
* Object of props to pass to the touchable component
*/
touchableProps?: {};
/**
* Optional styling for the section container
*/
sectionContainerStyle?: StyleProp<ViewStyle>;
/**
* Optional styling for the Accordion container
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Render the Accordion as a FlatList. Defaults to false for legacy behavior.
*
* @default false
*/
renderAsFlatList?: boolean;
}
export default class Accordion<T> extends React.Component<AccordionProps<T>> {}