-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'patch' of github.com:gluestack/gluestack-ui into develop
- Loading branch information
Showing
22 changed files
with
1,273 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
example/storybook-nativewind/src/components/ImageViewer/ImageViewer.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { ComponentMeta } from '@storybook/react-native'; | ||
import ImageViewer from './ImageViewer'; | ||
|
||
const ImageViewerMeta: ComponentMeta<typeof ImageViewer> = { | ||
title: 'stories/ImageViewer', | ||
component: ImageViewer, | ||
// metaInfo is required for figma generation | ||
// @ts-ignore | ||
metaInfo: { | ||
componentDescription: `The ImageViewer component provides a modal view for displaying and interacting with images, supporting features like pinch-to-zoom, double-tap zoom, and swipe up/down to dismiss.`, | ||
}, | ||
argTypes: {}, | ||
args: { | ||
images: [{ id: 1, url: 'https://picsum.photos/1000/1000' }], | ||
}, | ||
}; | ||
|
||
export default ImageViewerMeta; | ||
|
||
export { ImageViewer }; |
52 changes: 52 additions & 0 deletions
52
example/storybook-nativewind/src/components/ImageViewer/ImageViewer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from 'react'; | ||
import { Image, Pressable } from 'react-native'; | ||
import { | ||
ImageViewer, | ||
ImageViewerBackdrop, | ||
ImageViewerCloseButton, | ||
ImageViewerContent, | ||
ImageViewerImage, | ||
} from '@/components/ui/image-viewer'; | ||
import { Icon, CloseIcon } from '@/components/ui/icon'; | ||
|
||
const ImageViewerBasic = ({ ...props }: any) => { | ||
const Images = [{ id: 1, url: 'https://picsum.photos/1000/1000' }]; | ||
const [visible, setVisible] = useState(false); | ||
return ( | ||
<> | ||
<Pressable onPress={() => setVisible(true)}> | ||
<Image | ||
source={{ uri: Images[0].url }} | ||
className="w-[200px] h-[200px]" | ||
resizeMode="contain" | ||
/> | ||
</Pressable> | ||
|
||
<ImageViewer | ||
isOpen={visible} | ||
onClose={() => setVisible(false)} | ||
{...props} | ||
> | ||
<ImageViewerBackdrop> | ||
<ImageViewerContent | ||
//@ts-ignore | ||
images={Images} | ||
renderImages={(item: any) => ( | ||
<ImageViewerImage key={item.id} source={{ uri: item.url }} /> | ||
)} | ||
> | ||
<ImageViewerCloseButton> | ||
<Icon as={CloseIcon} /> | ||
</ImageViewerCloseButton> | ||
</ImageViewerContent> | ||
</ImageViewerBackdrop> | ||
</ImageViewer> | ||
</> | ||
); | ||
}; | ||
|
||
ImageViewerBasic.description = 'This is a basic ImageViewer component example.'; | ||
|
||
export default ImageViewerBasic; | ||
|
||
export { ImageViewer }; |
Oops, something went wrong.