react-native-cameraroll

A replacement camera roll module for React Native

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
react-native-cameraroll
1211.0.0-alpha27 years ago7 years agoMinified + gzip package size for react-native-cameraroll in KB

Readme

React Native Camera Roll
npm version License
RNCameraRoll is a replacement CameraRoll module for React Native that offers consistent behaviour across iOS and Android

Install

npm i react-native-cameraroll --save

Platform specific setup guides:

ios android

Usage

import RNCameraRoll from 'react-native-cameraroll';

getAssets(params: Object): Promise<Object>

Retrieve image and/or video assets from the device's Camera Roll.
RNCameraRoll.getAssets({ assetType: 'image', limit: 20 })
  .then(response => console.log(response))
  .catch(err => console.error(err));

params takes the following shape:
{
  assetType: 'image' | 'video' | 'all';
  limit: number; // How many assets to return
  start?: string | number; // The start cursor (use end_cursor from previous request)
}

The response takes the following shape:
{
  assets: [{
    filename: string;
    height: number;
    location: {
      altitude?: number;
      heading?: number;
      latitude: number;
      longitude: number;
      speed?: number;
    };
    timestamp: number;
    type: 'image' | 'video';
    uri: string;
    width: number;
  }],
  page_info: {
    end_cursor: string | number;
    has_next_page: boolean;
    start_cursor: string | number;
  };
}


Contributing

We welcome any contribution to the repository. Please ensure your changes to the JavaScript code follow the styling guides controlled by ESlint. Changes to native code should be kept clean and follow the standard of existing code.

License

  • MIT