2.0.3 • Published 4 months ago

react-native-lightbox-gallery v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

react-native-lightbox-gallery

React Native modal component for viewing images as a sliding gallery. Forked from react-native-image-viewing

npm version styled with prettier

  • 🔥Pinch zoom for both iOS and Android
  • 🔥Double tap to zoom for both iOS and Android
  • 🔥Supports swipe-to-close animation
  • 🔥Custom header and footer components
  • 🔥Uses VirtualizedList to optimize image loading and rendering

Expo

Try react-native-image-viewing with Expo: https://expo.io/@antonkalinin/react-native-image-viewing

Installation

yarn add react-native-lightbox-gallery

or

npm install --save react-native-lightbox-gallery

Usage

import ImageView from 'react-native-lightbox-gallery';

const images = [
    {
        uri: 'https://images.unsplash.com/photo-1571501679680-de32f1e7aad4',
    },
    {
        uri: 'https://images.unsplash.com/photo-1573273787173-0eb81a833b34',
    },
    {
        uri: 'https://images.unsplash.com/photo-1569569970363-df7b6160d111',
    },
];

const [visible, setIsVisible] = useState(false);

<ImageView
    images={images}
    imageIndex={0}
    visible={visible}
    onRequestClose={() => setIsVisible(false)}
/>;

Props

Prop nameDescriptionTypeRequired
imagesArray of images to displayImageSource[]true
keyExtractorUniqely identifying each image(imageSrc: ImageSource, index: number) => stringfalse
imageIndexCurrent index of image to displaynumbertrue
visibleIs modal shown or notbooleantrue
onRequestCloseFunction called to close the modalfunctiontrue
onImageIndexChangeFunction called when image index has been changedfunctionfalse
onLongPressFunction called when image long pressedfunction (event: GestureResponderEvent, image: ImageSource)false
delayLongPressDelay in ms, before onLongPress is called: default 800numberfalse
animationTypeAnimation modal presented with: default fadenone, fade, slidefalse
presentationStyleModal presentation style: default: fullScreen Android: Use overFullScreen to hide StatusBarfullScreen, pageSheet, formSheet, overFullScreenfalse
backgroundColorBackground color of the modal in HEX (#000000EE)stringfalse
swipeToCloseEnabledClose modal with swipe up or down: default truebooleanfalse
doubleTapToZoomEnabledZoom image by double tap on it: default truebooleanfalse
HeaderComponentHeader component, gets current imageIndex as a propcomponent, functionfalse
FooterComponentFooter component, gets current imageIndex as a propcomponent, functionfalse
  • type ImageSource = ImageURISource | ImageRequireSource

License

MIT

2.0.3

4 months ago

2.0.2

4 months ago

2.0.1

4 months ago

2.0.0

4 months ago

1.0.0

4 months ago