Skip to content

Commit

Permalink
chore: updated types
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanchitv3 committed Jan 9, 2025
1 parent 012c40d commit 75addc0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ImageViewerBasic = ({ ...props }: any) => {
<ImageViewerBackdrop>
<ImageViewerContent
images={Images}
renderImages={({ item }: any) => (
renderImages={({ item }) => (
<ImageViewerImage source={{ uri: item.url }} />
)}
keyExtractor={(item, index) => item.id + '-' + index}
Expand Down
30 changes: 24 additions & 6 deletions packages/unstyled/image-viewer/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
export interface ImageViewerContext {
/**
* Callback invoked when the ImageViewer is closed.
*/
onClose: () => void;
/**
* If true, the ImageViewer will open. Useful for controllable state behavior.
*/
isOpen: boolean | undefined;
/**
* The current scale of the Image.
*/
scale: number | undefined;
/**
* Callback function to set the scale of the Image to be used in backdrop for adjusting the opacity.
*/
setScale: (scale: number) => void;
}

export interface InterfaceImageViewerProps {
/**
* If true, the modal will open. Useful for controllable state behavior.
* If true, the ImageViewer will open. Useful for controllable state behavior.
*/
isOpen: boolean | undefined;
/**
* Callback invoked when the modal is closed.
* Callback invoked when the ImageViewer is closed.
*/
onClose?: any;
}
Expand All @@ -20,13 +32,19 @@ export interface InterfaceImageViewerContentProps {
/**
* The images to display in the ImageViewer.
*/
images: any[];
images: Array<any>;
/**
* The function to render the images.
* Callback React.ReactNode function to render the images.
*/
renderImages: (item: any) => any;
renderImages: ({
item,
index,
}: {
item: any;
index: number;
}) => React.ReactNode;
/**
* The function to extract the key for the images.
* Callback function to extract the key for the images.
*/
keyExtractor: (item: any, index: number) => React.Attributes['key'];
}
Expand Down

0 comments on commit 75addc0

Please sign in to comment.