Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-photo-browser

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-photo-browser

Local and remote photo browser with captions, selections and grid view support for react native.

  • 0.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49
decreased by-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

React Native Photo Browser

Information

A full screen image gallery with captions, selections and grid view support for react-native. Layout and API design are inspired by great MWPhotoBrowser library.

The component has both iOS and Android support.

Installation

npm install react-native-photo-browser --save

Properties

PropTypeDescriptionDefault
styleStyleOverrides default container style.null
mediaListArray<Media>List of media objects to display.[]
initialIndexNumberSets the visible photo initially.0
alwaysShowControlsBooleanAllows to control whether the bars and controls are always visible or whether they fade away to show the photo full.false
displayActionButtonBooleanShow action button to allow sharing, copying, etc.false
displayNavArrowsBooleanWhether to display left and right nav arrows on bottom toolbar.false
alwaysDisplayStatusBarBooleanWhether to display the OS Status Bar.false
displayTopBarBooleanWhether to display top bar.true
enableGridBooleanWhether to allow the viewing of all the photo thumbnails on a grid.true
startOnGridBooleanWhether to start on the grid of thumbnails instead of the first photo.false
displaySelectionButtonsBooleanWhether selection buttons are shown on each image.false
useCircleProgressiOSBooleanDisplays Progress.Circle instead of default Progress.Bar for full screen photos. Check Progress section for more info.false
onSelectionChangedFunctionCalled when a media item is selected or unselected.(media, index, isSelected) => {}
onActionButtonFunctionCalled when action button is pressed for a photo. Your application should handle sharing process, please see Sharing section for more information. If you don't provide this method, action button tap event will simply be ignored.(media, index) => {}
onBackFunctionCalled when back button is tapped.() => {}
itemPerRowNumberSets images amount in grid row.3
onPhotoLongPressFunctionCalled when a long press trigged on a photo.() => {}
delayPhotoLongPressNumberThe long press delay in ms.1000
squareBooleanDisplays the thumbnails as squares(same width, height).false
gridOffsetNumberOffset the width of the grid from the screen width.0
customTitleFunctionCustom title in full screen mode.(index, rowCount) => { return '' }
customBottomBarButtonComponentUse a custom component in the bottom bar to the left of the Share button. The visibility of the Share button can still be controlled with displayActionButton.null

Media Object

const media = {
  thumb: '', // thumbnail version of the photo to be displayed in grid view. actual photo is used if thumb is not provided
  photo: '', // a remote photo or local media url
  id: 1, // unique identifer for the photo; can be omitted if the `thumb`/`photo` will always be unique
  caption: '', // photo caption to be displayed
  selected: true, // set the photo selected initially(default is false)
};

Progress Component

Android

Built-in ActivityIndicator component is used for Android. Any additional configuration is not needed.

iOS

react-native-progress component is used as progress indicator. The default progress component is Progress.Bar. You can also use Progress.Circle component by simply using useCircleProgress prop, and adding ReactART library to your Xcode project. For more information please check out react-native-progress repo and React Native documentation.

Sharing

I tried delivering sharing photo feature but it was complicated to provide for iOS and android out of the box. I now believe it's a better idea to separate sharing logic into another module. Please check out Example project to see a basic ActionSheetIOS implementation for iOS. You may also use available sharing libraries such as react-native-activity-view and react-native-share.

Examples

See PhotoBrowserExample.js file.

Follow those steps to run the example:

  1. Clone the repo git clone https://github.com/halilb/react-native-photo-browser && cd react-native-photo-browser/Example
  2. Install dependencies npm install
  3. Follow official instructions to run the example project in a simulator or device.

Roadmap

  • Android support
  • Improve performance for bigger collections
  • Video support
  • Photo zoom
  • Zooming photos to fill the screen

Licence

MIT

Keywords

FAQs

Package last updated on 04 Jun 2020

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