|
| 1 | +import type { |
| 2 | + ImageStyle, |
| 3 | + ImageSourcePropType, |
| 4 | + ViewStyle, |
| 5 | + FlatListProps, |
| 6 | +} from 'react-native'; |
| 7 | +import type { SharedValue } from 'react-native-reanimated'; |
| 8 | + |
| 9 | +/** |
| 10 | + * Props for the ImageViewer component |
| 11 | + */ |
| 12 | +export interface ImageViewerProps { |
| 13 | + /** The image source to display */ |
| 14 | + source: ImageSourcePropType; |
| 15 | + /** Optional styles to apply to the image */ |
| 16 | + imageStyle?: ImageStyle; |
| 17 | + /** Whether to enable pan down to close gesture */ |
| 18 | + enablePanDownToClose?: boolean; |
| 19 | + /** Shared value for layout translation on Y axis */ |
| 20 | + layoutTranslateY: SharedValue<number>; |
| 21 | + /** Callback function when the viewer is closed */ |
| 22 | + onClose?: () => void; |
| 23 | +} |
| 24 | + |
| 25 | +/** |
| 26 | + * Props for the Gallery component |
| 27 | + */ |
| 28 | +export interface GalleryProps |
| 29 | + extends Omit<FlatListProps<ImageSourcePropType>, 'data' | 'renderItem'> { |
| 30 | + /** Array of image sources to display in the gallery */ |
| 31 | + data: ImageSourcePropType[]; |
| 32 | + /** Optional styles to apply to the gallery container */ |
| 33 | + style?: ViewStyle; |
| 34 | + /** Optional styles to apply to each image */ |
| 35 | + imageStyle?: ImageStyle; |
| 36 | + /** Optional styles to apply to the gallery container */ |
| 37 | + containerStyle?: ViewStyle; |
| 38 | + /** Optional styles to apply to the content container */ |
| 39 | + contentContainerStyle?: ViewStyle; |
| 40 | + /** Color of the backdrop (default: 'black') */ |
| 41 | + backdropColor?: string; |
| 42 | + /** Initial index to display (default: 0) */ |
| 43 | + initialIndex?: number; |
| 44 | + /** Whether to enable pan down to close gesture */ |
| 45 | + enablePanDownToClose?: boolean; |
| 46 | + /** Function to render header content */ |
| 47 | + renderHeader?: () => React.ReactNode; |
| 48 | + /** Function to render footer content */ |
| 49 | + renderFooter?: () => React.ReactNode; |
| 50 | +} |
| 51 | + |
| 52 | +/** |
| 53 | + * Reference methods for the Gallery component |
| 54 | + */ |
| 55 | +export interface GalleryRef { |
| 56 | + /** Show the gallery at the specified index */ |
| 57 | + show: (index?: number) => void; |
| 58 | + /** Hide the gallery */ |
| 59 | + hide: () => void; |
| 60 | + /** Whether the gallery is currently visible */ |
| 61 | + isVisible: boolean; |
| 62 | +} |
0 commit comments