Skip to content

Commit

Permalink
Merge pull request #2696 from gluestack/release/ImageViewer@0.0.8
Browse files Browse the repository at this point in the history
Release/image viewer@0.0.8
  • Loading branch information
gluestackadmin authored Jan 9, 2025
2 parents d42ff03 + fa4bb85 commit 30f96fe
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const ImageViewerBasic = ({ ...props }: any) => {
<ImageViewerBackdrop>
<ImageViewerContent
images={Images}
renderImages={({ item }) => (
<ImageViewerImage source={{ uri: item.url }} />
)}
renderImages={({ item }) => {
return <ImageViewerImage source={{ uri: item.url }} />;
}}
keyExtractor={(item, index) => item.id + '-' + index}
>
<ImageViewerCloseButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ This is an illustration of **ImageViewer** component.
<ImageViewerBackdrop>
<ImageViewerContent
images={Images}
renderImages={(item) => (
<ImageViewerImage key={item.id} source={{ uri: item.url }} />
renderImages={({item, index}) => (
<ImageViewerImage source={{ uri: item.url }} />
)}
keyExtractor={(item, index) => item.id + '-' + index}
>
Expand Down Expand Up @@ -300,7 +300,7 @@ The `ImageViewerContent` component is responsible for rendering the images withi
</Table.TText>
</Table.TD>
<Table.TD>
<Table.TText>(item: any) => ReactNode</Table.TText>
<Table.TText>{`({item, index}) => ReactNode`}</Table.TText>
</Table.TD>
<Table.TD>
<Table.TText>-</Table.TText>
Expand Down Expand Up @@ -388,8 +388,8 @@ import { Center } from '@/components/ui/center';
<ImageViewerBackdrop>
<ImageViewerContent
images={Images}
renderImages={(item) => (
<ImageViewerImage key={item.id} source={{ uri: item.url }} />
renderImages={({item, index}) => (
<ImageViewerImage source={{ uri: item.url }} />
)}
keyExtractor={(item, index) => item.id + '-' + index}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,5 @@
"hooks": ["useBreakpointValue"]
}
},
"IgnoredComponents": ["bottomsheet"]
"IgnoredComponents": ["bottomsheet", "image-viewer"]
}
6 changes: 6 additions & 0 deletions packages/unstyled/image-viewer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @gluestack-ui/image-viewer

## 0.0.7

### Patch Changes

- fix: fixed renderImages method and updated example

## 0.0.6

### Patch Changes
Expand Down
30 changes: 17 additions & 13 deletions packages/unstyled/image-viewer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,13 @@ export default () => (
<ImageViewerBackdrop>
<ImageViewerContent
images={images}
renderImages={(item) => (
<ImageViewerImage key={item.id} source={{ uri: item.url }} />
)}
renderImages={({ item, index }) => {
return (
<ImageViewerImage
source={{ uri: item.url }}
/>
);
}}
keyExtractor={(item, index) => `${item.id}-${index}`}
/>
</ImageViewerBackdrop>
Expand All @@ -81,19 +85,19 @@ export default () => (

### ImageViewer

| Prop | Type | Default | Description |
| -------- | --------- | ------- | ------------------------------------------------------ |
| isOpen | boolean | false | If true, the image viewer modal will open |
| onClose | function | - | Callback invoked when the image viewer modal is closed |
| children | ReactNode | - | The content to be rendered inside the image viewer |
| Prop | Type | Default | Description | Required |
| -------- | --------- | ------- | ------------------------------------------------------ | -------- |
| isOpen | boolean | false | If true, the image viewer modal will open | Yes |
| onClose | function | - | Callback invoked when the image viewer modal is closed | Yes |
| children | ReactNode | - | The content to be rendered inside the image viewer | _ |

### ImageViewerContent

| Prop | Type | Default | Description |
| ------------ | ------------------------------------ | ------- | ----------------------------------------------- |
| images | Array<any> | - | Array of image objects to display |
| renderImages | (item: any) => ReactNode | - | Function to render each image item |
| keyExtractor | (item: any, index: number) => string | - | Function to extract the key for each image item |
| Prop | Type | Default | Description | Required |
| ------------ | ----------------------------------------- | ------- | ----------------------------------------------- | -------- |
| images | Array<any> | - | Array of image objects to display | Yes |
| renderImages | ({item: any, index: number}) => ReactNode | - | Function to render each image item | Yes |
| keyExtractor | (item: any, index: number) => string | - | Function to extract the key for each image item | Yes |

More guides on how to get started are available [here](https://ui.gluestack.io/docs/components/media-and-icons/image-viewer).

Expand Down
2 changes: 1 addition & 1 deletion packages/unstyled/image-viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gluestack-ui/image-viewer",
"version": "0.0.6",
"version": "0.0.7",
"main": "lib/index",
"module": "lib/index",
"types": "lib/index.d.ts",
Expand Down

0 comments on commit 30f96fe

Please sign in to comment.