Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
48 lines (46 loc) · 1.84 KB
/
Copy pathtypes.ts
File metadata and controls
48 lines (46 loc) · 1.84 KB
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
import type { ColorValue, StyleProp, TextStyle, ViewStyle } from 'react-native';
export interface WheelPickerItem<T> {
label: string;
value: T;
}
export interface WheelPickerProps<T> {
items: readonly WheelPickerItem<T>[];
/**
* Selected item's value. An unknown value selects the first row. Leave it out
* and the wheel is uncontrolled: it starts on the first row and keeps the user's pick.
*/
value?: T;
onValueChange: (value: T, index: number) => void;
/**
* Returns a value's identity. `value` selects the item whose key is the same, compared with
* `Object.is`. Without it values are compared directly, so an object `value` must be the same
* reference as an item's.
*
* @example
* // `user` may come from a refetch, so it is a different object than the items'.
* <WheelPicker
* items={users.map((u) => ({ label: u.name, value: u }))}
* value={user}
* keyExtractor={(u) => u.id}
* onValueChange={setUser}
* />
*/
keyExtractor?: (value: T) => string | number;
/** Style of the view around the wheel. The wheel itself is `itemStyle.height` tall. */
style?: StyleProp<ViewStyle>;
/**
* Row text and wheel height, as on iOS: `fontSize` (default 21), `color`,
* `fontFamily`, `fontWeight`, `fontStyle`, and `height` (default 216).
* Rows are the font's line height plus 20 tall.
*/
itemStyle?: StyleProp<TextStyle>;
/** Fill of the band behind the selected row. Defaults to the system's (quaternarySystemFill). */
selectionColor?: ColorValue;
/** Forces light or dark default colors. Defaults to the system appearance. */
colorScheme?: 'light' | 'dark';
testID?: string;
/** What the wheel picks, read by screen readers before the value, e.g. "Hour". */
accessibilityLabel?: string;
/** Scroll endlessly: the first row follows the last. Default `false`. */
loop?: boolean;
}