Socket
Socket
Sign inDemoInstall

rn-photo-picker

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rn-photo-picker

Plug and play React Native photo picker component for picking photos from camera roll.


Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Install size
303 kB
Created
Weekly downloads
 

Readme

Source

React Native photo picker 📷⚛📱

Plug and play React Native photo picker component for picking photos from camera roll.

How it looks

Picker screen shot

Installation

yarn add rn-photo-picker

npm install rn-photo-picker

Linking library on ios

You need to link RCTCameraRoll from node-modules/react-native/Libraries !

Permissions

(copied from React Native documentation)

The user's permission is required in order to access the Camera Roll on devices running iOS 10 or later. Add the NSPhotoLibraryUsageDescription key in your Info.plist with a string that describes how your app will use this data. This key will appear as Privacy - Photo Library Usage Description in Xcode.

Usage

import PhotoPicker from "rn-photo-picker";

const pickedPhotos = [];
const App = () => (
  <PhotoPicker
    color="blue"
    scale={1}
    limit={3}
    onLimitReach={() => Alert.alert("You can't pick more than 3 photos!")}
    onChange={photos => {
      pickedPhotos = photos;
    }}
  />
);

How single photo object looks?

{
  filename: "IMG_0005.JPG",
  height: 2002,
  isStored: true,
  playableDuration: 0,
  uri:
    "assets-library://asset/asset.JPG?id=ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED&ext=JPG",
  width: 3000
}

Props

proptypedescriptionexample
scalenumberalllows You to make tiles and margins bigger or smaller1.5
limitnumberYou can define how many photos user can pick5
colorstringcolor of the picked photos"#eee"
onLimitReachedfunctionwhat happens when user tries to pick more than he/she can() => console.warn("limit reached")
onChangefunctioncalled when array of picked photos changes(photos) => console.warn("picked photos:", photos)

Tip: default spacing between tiles is 15, if you need ie. 30 set scale to 2

Keywords

FAQs

Last updated on 29 Dec 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc