UNPKG

6.14 kBTypeScriptView Raw
1import * as React from 'react';
2import { StyleProp, TextStyle, ViewStyle } from 'react-native';
3import TouchableRipple from '../TouchableRipple/TouchableRipple';
4import type { $RemoveChildren, EllipsizeProp } from '../../types';
5declare type Description = React.ReactNode | ((props: {
6 selectable: boolean;
7 ellipsizeMode: EllipsizeProp | undefined;
8 color: string;
9 fontSize: number;
10}) => React.ReactNode);
11declare type Props = $RemoveChildren<typeof TouchableRipple> & {
12 /**
13 * Title text for the list item.
14 */
15 title: React.ReactNode;
16 /**
17 * Description text for the list item or callback which returns a React element to display the description.
18 */
19 description?: Description | null;
20 /**
21 * Callback which returns a React element to display on the left side.
22 */
23 left?: (props: {
24 color: string;
25 style: {
26 marginLeft: number;
27 marginRight: number;
28 marginVertical?: number;
29 };
30 }) => React.ReactNode;
31 /**
32 * Callback which returns a React element to display on the right side.
33 */
34 right?: (props: {
35 color: string;
36 style?: {
37 marginRight: number;
38 marginVertical?: number;
39 };
40 }) => React.ReactNode;
41 /**
42 * Function to execute on press.
43 */
44 onPress?: () => void;
45 /**
46 * @optional
47 */
48 theme: ReactNativePaper.Theme;
49 /**
50 * Style that is passed to the wrapping TouchableRipple element.
51 */
52 style?: StyleProp<ViewStyle>;
53 /**
54 * Style that is passed to Title element.
55 */
56 titleStyle?: StyleProp<TextStyle>;
57 /**
58 * Style that is passed to Description element.
59 */
60 descriptionStyle?: StyleProp<TextStyle>;
61 /**
62 * Truncate Title text such that the total number of lines does not
63 * exceed this number.
64 */
65 titleNumberOfLines?: number;
66 /**
67 * Truncate Description text such that the total number of lines does not
68 * exceed this number.
69 */
70 descriptionNumberOfLines?: number;
71 /**
72 * Ellipsize Mode for the Title. One of `'head'`, `'middle'`, `'tail'`, `'clip'`.
73 *
74 * See [`ellipsizeMode`](https://reactnative.dev/docs/text#ellipsizemode)
75 */
76 titleEllipsizeMode?: EllipsizeProp;
77 /**
78 * Ellipsize Mode for the Description. One of `'head'`, `'middle'`, `'tail'`, `'clip'`.
79 *
80 * See [`ellipsizeMode`](https://reactnative.dev/docs/text#ellipsizemode)
81 */
82 descriptionEllipsizeMode?: EllipsizeProp;
83};
84declare const _default: (React.ComponentClass<Pick<Props, "style" | "title" | "onLayout" | "onPress" | "onLongPress" | "testID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "key" | "hitSlop" | "hasTVPreferredFocus" | "tvParallaxProperties" | "left" | "right" | "delayLongPress" | "delayPressIn" | "delayPressOut" | "disabled" | "onBlur" | "onFocus" | "onPressIn" | "onPressOut" | "pressRetentionOffset" | "touchSoundDisabled" | "background" | "borderless" | "rippleColor" | "underlayColor" | "centered" | "description" | "titleStyle" | "descriptionStyle" | "titleNumberOfLines" | "descriptionNumberOfLines" | "titleEllipsizeMode" | "descriptionEllipsizeMode"> & {
85 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
86}, any> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<Props, any> & {
87 ({ left, right, title, description, onPress, theme, style, titleStyle, titleNumberOfLines, descriptionNumberOfLines, titleEllipsizeMode, descriptionEllipsizeMode, descriptionStyle, ...rest }: Props): JSX.Element;
88 displayName: string;
89}) | (React.FunctionComponent<Props> & {
90 ({ left, right, title, description, onPress, theme, style, titleStyle, titleNumberOfLines, descriptionNumberOfLines, titleEllipsizeMode, descriptionEllipsizeMode, descriptionStyle, ...rest }: Props): JSX.Element;
91 displayName: string;
92}), {}>) | (React.FunctionComponent<Pick<Props, "style" | "title" | "onLayout" | "onPress" | "onLongPress" | "testID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "key" | "hitSlop" | "hasTVPreferredFocus" | "tvParallaxProperties" | "left" | "right" | "delayLongPress" | "delayPressIn" | "delayPressOut" | "disabled" | "onBlur" | "onFocus" | "onPressIn" | "onPressOut" | "pressRetentionOffset" | "touchSoundDisabled" | "background" | "borderless" | "rippleColor" | "underlayColor" | "centered" | "description" | "titleStyle" | "descriptionStyle" | "titleNumberOfLines" | "descriptionNumberOfLines" | "titleEllipsizeMode" | "descriptionEllipsizeMode"> & {
93 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
94}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<Props, any> & {
95 ({ left, right, title, description, onPress, theme, style, titleStyle, titleNumberOfLines, descriptionNumberOfLines, titleEllipsizeMode, descriptionEllipsizeMode, descriptionStyle, ...rest }: Props): JSX.Element;
96 displayName: string;
97}) | (React.FunctionComponent<Props> & {
98 ({ left, right, title, description, onPress, theme, style, titleStyle, titleNumberOfLines, descriptionNumberOfLines, titleEllipsizeMode, descriptionEllipsizeMode, descriptionStyle, ...rest }: Props): JSX.Element;
99 displayName: string;
100}), {}>);
101export default _default;