public class CameraRollManager extends ReactContextBaseJavaModule
NativeModule
that allows JS to interact with the photos and videos on the device (i.e.
MediaStore.Images
).NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
CameraRollManager(ReactApplicationContext reactContext) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
void |
getPhotos(ReadableMap params,
Promise promise)
Get photos from
MediaStore.Images , most recent first. |
void |
saveToCameraRoll(java.lang.String uri,
java.lang.String type,
Promise promise)
Save an image to the gallery (i.e.
|
getCurrentActivity, getReactApplicationContext
canOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroy
public static final java.lang.String NAME
public CameraRollManager(ReactApplicationContext reactContext)
public java.lang.String getName()
require()
this module
from javascript.public void saveToCameraRoll(java.lang.String uri, java.lang.String type, Promise promise)
MediaStore.Images
). This copies the original file
from wherever it may be to the external storage pictures directory, so that it can be scanned
by the MediaScanner.uri
- the file:// URI of the image to savepromise
- to be resolved or rejectedpublic void getPhotos(ReadableMap params, Promise promise)
MediaStore.Images
, most recent first.params
- a map containing the following keys:
getPhotos(com.facebook.react.bridge.ReadableMap, com.facebook.react.bridge.Promise)
promise
- the Promise to be resolved when the photos are loaded; for a format of the
parameters passed to this callback, see getPhotosReturnChecker
in CameraRoll.js