New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-awesome-gallery

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-awesome-gallery

Awesome gallery with Reanimated v2

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
increased by2.58%
Maintainers
1
Weekly downloads
 
Created
Source

npm version Rate on Openbase

Example usage of gallery

Installation

First you have to follow installation instructions of Reanimated v2 and react-native-gesture-handler

yarn add react-native-awesome-gallery

Expo is supported since SDK 40. More information here

Usage

Check out an example folder for example with Shared transition + FastImage

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

// ...

const images = ['https://image1', 'https://image2'];

return (
  <Gallery
    data={images}
    onIndexChange={(newIndex) => {
      console.log(newIndex);
    }}
  />
);

Props

PropDescriptionTypeDefault
dataArray of items to renderT[]undefined
renderItem?Callback func which can be used to render custom image component, e.g FastImage. NOTE: You have to call setImageDimensions({width, height}) parameter after image is loaded(renderItemInfo: {item: T, index: number, setImageDimensions: Function}) => React.ReactElementundefined
keyExtractor?Callback func which provides unique keys for items(item: T, index: number) => string or numberTakes id or key or _id from Item, otherwise puts Item as key
initialIndex?The initial image indexnumber0
onIndexChange?Is called when index of active item is changed(newIndex: number) => voidundefined
numToRender?Amount of items rendered in gallery simultaneouslynumber5
emptySpaceWidth?Width of empty space between itemsnumber30
doubleTapScale?Image scale when double tap is firednumber3
maxScale?Maximum scale user can set with gesturenumber6
disableTransitionOnScaledImage?Disables transition to next/previous image when scale > 1booleanfalse
disableVerticalSwipe?Disables vertical swipe when scale == 1booleanfalse
onScaleChange?Is called when scale is changed(scale: number) => voidundefined
onScaleChangeRange?Shows range of scale in which onScaleChange is called{start: number, end: number}undefined
containerDimensions?Dimensions object for the View that wraps gallery.{width: number, height: number}value returned from useWindowDimensions() hook.
style?Style of containerViewStyleundefined

Events

PropDescriptionType
onSwipeToCloseFired when user swiped to top/bottomFunction
onTapFired when user tap on imageFunction
onDoubleTapFired when user double tap on imageFunction
onScaleStartFired when pinch gesture startsFunction
onPanStartFired when pan gesture startsFunction

Methods

import Gallery, { GalleryRef } from 'react-native-awesome-gallery';

// ...

const ref = useRef<GalleryRef>(null);
PropDescriptionType
setIndexSets active index(newIndex: number) => void

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Package last updated on 09 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc