mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-08-31 13:41:08 +00:00
capture returns metadata
This commit is contained in:
@@ -181,10 +181,12 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
|
||||
public void onPictureTaken(byte[] data, Camera camera) {
|
||||
camera.stopPreview();
|
||||
camera.startPreview();
|
||||
Map<String, Object> response = new HashMap();
|
||||
switch (options.getInt("target")) {
|
||||
case RCT_CAMERA_CAPTURE_TARGET_MEMORY:
|
||||
String encoded = Base64.encodeToString(data, Base64.DEFAULT);
|
||||
promise.resolve(encoded);
|
||||
response.put("data", encoded);
|
||||
promise.resolve(response);
|
||||
break;
|
||||
case RCT_CAMERA_CAPTURE_TARGET_CAMERA_ROLL:
|
||||
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
|
||||
@@ -193,7 +195,8 @@ public class RCTCameraModule extends ReactContextBaseJavaModule {
|
||||
_reactContext.getContentResolver(),
|
||||
bitmap, options.getString("title"),
|
||||
options.getString("description"));
|
||||
promise.resolve(url);
|
||||
response.put("path", url);
|
||||
promise.resolve(response);
|
||||
break;
|
||||
case RCT_CAMERA_CAPTURE_TARGET_DISK:
|
||||
File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);
|
||||
|
||||
Reference in New Issue
Block a user