|
| 1 | +import React, { Component } from 'react'; |
| 2 | +import { StyleProp, ViewStyle } from 'react-native'; |
| 3 | +import { TouchableOpacityProps } from '../touchableOpacity'; |
| 4 | +import { ImageProps } from '../image'; |
| 5 | +export interface GridListItemProps { |
| 6 | + /** |
| 7 | + * Image props object for rendering an image item |
| 8 | + */ |
| 9 | + imageProps?: ImageProps; |
| 10 | + /** |
| 11 | + * Custom GridListItem to be rendered in the GridView |
| 12 | + */ |
| 13 | + renderCustomItem?: () => React.ReactElement; |
| 14 | + /** |
| 15 | + * The item size |
| 16 | + */ |
| 17 | + itemSize?: number | ImageSize; |
| 18 | + /** |
| 19 | + * Title content text |
| 20 | + */ |
| 21 | + title?: string | React.ReactElement; |
| 22 | + /** |
| 23 | + * Title content typography |
| 24 | + */ |
| 25 | + titleTypography?: string; |
| 26 | + /** |
| 27 | + * Title content color |
| 28 | + */ |
| 29 | + titleColor?: string; |
| 30 | + /** |
| 31 | + * Title content number of lines |
| 32 | + */ |
| 33 | + titleLines?: number; |
| 34 | + /** |
| 35 | + * Subtitle content text |
| 36 | + */ |
| 37 | + subtitle?: string | React.ReactElement; |
| 38 | + /** |
| 39 | + * Subtitle content typography |
| 40 | + */ |
| 41 | + subtitleTypography?: string; |
| 42 | + /** |
| 43 | + * Subtitle content color |
| 44 | + */ |
| 45 | + subtitleColor?: string; |
| 46 | + /** |
| 47 | + * Subtitle content number of lines |
| 48 | + */ |
| 49 | + subtitleLines?: number; |
| 50 | + /** |
| 51 | + * Description content text |
| 52 | + */ |
| 53 | + description?: string | React.ReactElement; |
| 54 | + /** |
| 55 | + * Description content typography |
| 56 | + */ |
| 57 | + descriptionTypography?: string; |
| 58 | + /** |
| 59 | + * Description content color |
| 60 | + */ |
| 61 | + descriptionColor?: string; |
| 62 | + /** |
| 63 | + * Description content number of lines |
| 64 | + */ |
| 65 | + descriptionLines?: number; |
| 66 | + /** |
| 67 | + * Renders the title, subtitle and description inside the item |
| 68 | + */ |
| 69 | + overlayText?: boolean; |
| 70 | + /** |
| 71 | + * Custom container styling for inline text |
| 72 | + */ |
| 73 | + overlayTextContainerStyle?: StyleProp<ViewStyle>; |
| 74 | + /** |
| 75 | + * Should content be align to start (default is center) |
| 76 | + */ |
| 77 | + alignToStart?: boolean; |
| 78 | + /** |
| 79 | + * Custom container style |
| 80 | + */ |
| 81 | + containerStyle?: StyleProp<ViewStyle>; |
| 82 | + /** |
| 83 | + * The item's action handler |
| 84 | + */ |
| 85 | + onPress?: TouchableOpacityProps['onPress']; |
| 86 | + /** |
| 87 | + * Renders an overlay on top of the image |
| 88 | + */ |
| 89 | + renderOverlay?: () => React.ReactElement; |
| 90 | + /** |
| 91 | + * Test ID for component |
| 92 | + */ |
| 93 | + testID?: string; |
| 94 | +} |
| 95 | +interface RenderContentType { |
| 96 | + text?: string | React.ReactElement; |
| 97 | + typography?: string; |
| 98 | + color?: string; |
| 99 | + numberOfLines?: number; |
| 100 | + style?: StyleProp<ViewStyle>; |
| 101 | + testID?: string; |
| 102 | +} |
| 103 | +/** |
| 104 | + * @description: A single grid view/list item component |
| 105 | + * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx |
| 106 | + */ |
| 107 | +declare class GridListItem extends Component<GridListItemProps> { |
| 108 | + static displayName: string; |
| 109 | + static defaultProps: { |
| 110 | + itemSize: number; |
| 111 | + }; |
| 112 | + state: {}; |
| 113 | + onItemPress: () => void; |
| 114 | + getItemSizeObj(): ImageSize; |
| 115 | + renderContent({ text, typography, color, numberOfLines, style, testID }: RenderContentType): JSX.Element | undefined; |
| 116 | + render(): JSX.Element; |
| 117 | +} |
| 118 | +export default GridListItem; |
| 119 | +interface ImageSize { |
| 120 | + width?: number; |
| 121 | + height?: number; |
| 122 | +} |
0 commit comments