Installations
npm install rn-camera-roll
Developer Guide
Typescript
No
Module System
N/A
Node Version
4.4.0
NPM Version
2.14.20
Score
30.2
Supply Chain
45
Quality
65.8
Maintenance
50
Vulnerability
94.1
License
Releases
Contributors
Unable to fetch Contributors
Languages
Java (52.7%)
Objective-C (26.2%)
JavaScript (21.1%)
Developer
bamlab
Download Statistics
Total Downloads
13,177
Last Day
2
Last Week
17
Last Month
67
Last Year
588
GitHub Statistics
111 Stars
32 Commits
20 Forks
6 Watching
1 Branches
9 Contributors
Package Meta Information
Latest Version
0.0.5
Package Id
rn-camera-roll@0.0.5
Size
5.57 kB
NPM Version
2.14.20
Node Version
4.4.0
Total Downloads
Cumulative downloads
Total Downloads
13,177
Last day
0%
2
Compared to previous day
Last week
0%
17
Compared to previous week
Last month
157.7%
67
Compared to previous month
Last year
35.2%
588
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
React Native Camera Roll
UPDATE:
As of react-native 0.19
, the CameraRoll module is now available on Android too!
Table of contents
Example
Checkout this example of a basic gallery app with infinite scroll:
https://github.com/bamlab/rn-camera-roll/tree/master/example
<img width=300 src=https://raw.githubusercontent.com/bamlab/rn-camera-roll/master/example/screenshot.png />
Setup
First, install the package:
npm install rn-camera-roll
Then, follow those instructions:
iOS
The Camera Roll iOS API is part of react-native
.
You have to import node_modules/react-native/Libraries/CameraRoll/RCTCameraRoll.xcodeproj
by following the libraries linking instructions.
Android
Update your gradle files
For react-native >= v0.15, this command will do it automatically:
react-native link rn-camera-roll
For react-native = v0.14 You will have to update them manually:
In android/settings.gradle
, add:
include ':rn-camera-roll'
project(':rn-camera-roll').projectDir = new File(settingsDir, '../node_modules/rn-camera-roll/android')
In android/app/build.gradle
add:
dependencies {
...
compile project(':rn-camera-roll')
}
Register the package into your MainActivity
1package com.example; 2 3import android.app.Activity; 4import android.os.Bundle; 5import android.view.KeyEvent; 6 7import com.facebook.react.LifecycleState; 8import com.facebook.react.ReactInstanceManager; 9import com.facebook.react.ReactRootView; 10import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; 11import com.facebook.react.shell.MainReactPackage; 12import com.facebook.soloader.SoLoader; 13 14// IMPORT HERE 15import fr.bamlab.rncameraroll.CameraRollPackage; 16// --- 17 18public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler { 19 20 private ReactInstanceManager mReactInstanceManager; 21 private ReactRootView mReactRootView; 22 23 @Override 24 protected void onCreate(Bundle savedInstanceState) { 25 super.onCreate(savedInstanceState); 26 mReactRootView = new ReactRootView(this); 27 28 mReactInstanceManager = ReactInstanceManager.builder() 29 .setApplication(getApplication()) 30 .setBundleAssetName("index.android.bundle") 31 .setJSMainModuleName("index.android") 32 .addPackage(new MainReactPackage()) 33 34 // REGISTER PACKAGE HERE 35 .addPackage(new CameraRollPackage()) 36 // --- 37 .setUseDeveloperSupport(BuildConfig.DEBUG) 38 .setInitialLifecycleState(LifecycleState.RESUMED) 39 .build(); 40 41 mReactRootView.startReactApplication(mReactInstanceManager, "example", null); 42 43 setContentView(mReactRootView); 44 } 45 46 ...
Usage
You can use the getPhotos
API as you would with the iOS API with the after
and the first
params.
You can use both the promise
syntax or the callback
syntax.
1import CameraRoll from 'rn-camera-roll'; 2 3onPhotosFetchedSuccess(data) { 4 const photos = data.edges.map((asset) => { 5 return asset.node.image; 6 }); 7 console.log(photos); 8 /** 9 On Android, this should log something like: 10 [ 11 { 12 "uri": "file:/storage/emulated/0/DCIM/Camera/IMG_20160120_172426830.jpg", 13 "width":3006, 14 "height":5344, 15 "orientation": 90 16 }, 17 { 18 "uri": "file:/storage/emulated/0/DCIM/Camera/IMG_20160116_153526816_TOP.jpg", 19 "width": 5344, 20 "height": 3006, 21 "orientation": 0 22 } 23 ... 24 ] 25 **/ 26} 27 28onPhotosFetchError(err) { 29 // Handle error here 30} 31 32fetchPhotos(count = 10, after) { 33 CameraRoll.getPhotos({ 34 // take the first n photos after given photo uri 35 first: count, 36 // after 37 after: "file:/storage/emulated/0/DCIM/Camera/IMG_20151126_115520477.jpg", 38 }, this.onPhotosFetchedSuccess.bind(this), this.onPhotosFetchError.bind(this)); 39}
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
binaries present in source code
Details
- Warn: binary detected: example/android/gradle/wrapper/gradle-wrapper.jar:1
Reason
Found 4/25 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 11 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to rn-camera-roll
@shovelandsandbox/rn-camera-roll-picker
A camera-roll picker component for react-native
@0610studio/rn-gallery
``` @react-native-camera-roll/camera-roll ```
rn-photo-picker
Plug and play React Native photo picker component for picking photos from camera roll.
@vforvasile/react-native-photos-framework
Fork from https://github.com/olofd/react-native-photos-framework with RN 0.59 issue, removed Android script, lib for IOS only