All Projects → meliorence → React Native Image Gallery

meliorence / React Native Image Gallery

Pure JavaScript image gallery component for iOS and Android with high-performance and native feeling in mind

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Image Gallery

Silentbox
A lightbox inspired Vue.js component.
Stars: ✭ 196 (-67.39%)
Mutual labels:  images, component, gallery
react-simple-image-viewer
Simple image viewer component for React
Stars: ✭ 44 (-92.68%)
Mutual labels:  gallery, images
React Grid Gallery
Justified image gallery component for React
Stars: ✭ 571 (-4.99%)
Mutual labels:  images, gallery
hes-gallery
Light, dependency free, responsive gallery script
Stars: ✭ 27 (-95.51%)
Mutual labels:  gallery, images
React Slideshow
A react component for slideshow supporting slide, fade and zoom
Stars: ✭ 201 (-66.56%)
Mutual labels:  images, gallery
React Lazy Images
🖼️ 🛋️ Components and utilities for lazy image loading in React
Stars: ✭ 254 (-57.74%)
Mutual labels:  images, component
Floral
Minimal design gallery app for Android.
Stars: ✭ 23 (-96.17%)
Mutual labels:  gallery, images
React Siema
ReactSiema Demo
Stars: ✭ 90 (-85.02%)
Mutual labels:  component, gallery
Simple React Lightbox
A simple but functional light-box for React.
Stars: ✭ 265 (-55.91%)
Mutual labels:  images, gallery
Perfect Layout
Image layout generator based on linear partitioning
Stars: ✭ 312 (-48.09%)
Mutual labels:  images, gallery
Vue Picture Swipe
🖼 Vue Picture Swipe Gallery (a gallery of image with thumbnails, lazy-load and swipe) backed by photoswipe
Stars: ✭ 322 (-46.42%)
Mutual labels:  component, gallery
Vue Gallery
📷 Responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.
Stars: ✭ 405 (-32.61%)
Mutual labels:  images, gallery
React Intense
A React component for viewing large images up close 🔍
Stars: ✭ 152 (-74.71%)
Mutual labels:  images, component
MediaSliderView
Pure java based, highly customizable media slider gallery supporting both images and videos for android.
Stars: ✭ 85 (-85.86%)
Mutual labels:  gallery, images
Photo view
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.
Stars: ✭ 1,280 (+112.98%)
Mutual labels:  images, gallery
django-content-gallery
A Django application allows to attach a collection of images to objects of any model in any app
Stars: ✭ 18 (-97%)
Mutual labels:  gallery, images
diorama
An image layout algorithm
Stars: ✭ 17 (-97.17%)
Mutual labels:  gallery, images
V Img
Stars: ✭ 400 (-33.44%)
Mutual labels:  images, gallery
Nanogallery2
a modern photo / video gallery and lightbox [JS library]
Stars: ✭ 488 (-18.8%)
Mutual labels:  images, gallery
Vue Img Inputer
🏞 A graceful image type inputer / uploader
Stars: ✭ 548 (-8.82%)
Mutual labels:  component

react-native-image-gallery

Table of contents

This used to be a fork of ldn0x7dc/react-native-gallery but the original repo is no longer maintained, so here's our own repo. Props to ldn0x7dc for his amazing work! 👏👏👏

A pure JavaScript image gallery component for React Native apps with common gestures like pan, pinch and doubleTap, supporting both iOS and Android.

This component aims to be the best image viewer for React Native apps, it is far more elegant than other gallery-like components as it features some of the most useful functionalities found in the iOS photo album app such as:

  • Gesture handling - other than the common pan, pinch and doubleTap gestures, this component also performs efficiently when targeting focus point (also known as pivot) on zoom-in and zoom-out.
  • Responder switch - the gesture responder switch is far more flexible than any other component, that is, the scrollable container and the wrapped image children perform well in acquiring and releasing gesture responder from/to each other.

This component utilizes @ldn0x7dc/react-native-view-pager as the scrollable container and react-native-transformable-image as the wrapped image.

This component works on react-native 0.44+.

You can try this example live in Archriss' showcase app on Android and iOS or check out the demo.

react-native-image-gallery

Install

npm install --save react-native-image-gallery or yarn add react-native-image-gallery

Usage example

import Gallery from 'react-native-image-gallery';

  render() {
    return (
      <Gallery
        style={{ flex: 1, backgroundColor: 'black' }}
        images={[
          { source: require('yourApp/image.png'), dimensions: { width: 150, height: 150 } },
          { source: { uri: 'http://i.imgur.com/XP2BE7q.jpg' } },
          { source: { uri: 'http://i.imgur.com/5nltiUd.jpg' } },
          { source: { uri: 'http://i.imgur.com/6vOahbP.jpg' } },
          { source: { uri: 'http://i.imgur.com/kj5VXtG.jpg' } }
        ]}
      />
    );
  }

Remote and local images

This component supports both remote images by specifying source.uri, and local images where source is the result of require().

Be aware that the width and height must be defined for local images, but is not required for remote images! Although the dimensions could still be provided for remote images to save the gallery from fetching them, which could potentially improve performance.

Props

Prop Description Type Default
images Your array of images array Required
initialPage Image displayed first number 0
imageComponent Custom function to render your images, 1st param is the image props, 2nd is its dimensions function <Image> component
errorComponent Custom function to render the page of an image that couldn't be displayed function A <View> with a stylized error
flatListProps Props to be passed to the underlying FlatList object {windowSize: 3}
pageMargin Blank space to show between images number 0
onPageSelected Fired with the index of page that has been selected function
onPageScrollStateChanged Called when page scrolling state has changed, see scroll state and events function
onPageScroll Scroll event, see scroll state and events function
scrollViewStyle Custom style for the FlatList component object {}
onSingleTapConfirmed Fired after a single tap function
onLongPress Fired after a long press function

Scroll state and events

  • onPageScroll : (event) => {}.

    The event object carries following data:

    • position: index of first page from the left that is currently visible.
    • offset: value from range [0,1) describing stage between page transitions.
    • fraction: means that (1 - x) fraction of the page at "position" index is visible, and x fraction of the next page is visible.
  • onPageScrollStateChanged : (state) => {}.

    Called when the page scrolling state has changed. The page scrolling state can be in 3 states:

    • 'idle': there is no interaction with the page scroller happening at the time.
    • 'dragging': there is currently an interaction with the page scroller.
    • 'settling': there was an interaction with the page scroller, and the page scroller is now finishing its closing or opening animation.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].