mirror of
https://github.com/status-im/react-native-camera.git
synced 2026-09-02 14:41:17 +00:00
Emulator crash fix #1234
On the emulator it crashed because the image byte array was incorrect and no cache directory was defined so it could not be written
This commit is contained in:
@@ -203,12 +203,9 @@ public class CameraModule extends ReactContextBaseJavaModule {
|
||||
}
|
||||
} else {
|
||||
Bitmap image = RNCameraViewHelper.generateSimulatorPhoto(cameraView.getWidth(), cameraView.getHeight());
|
||||
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
|
||||
byte[] byteArray = stream.toByteArray();
|
||||
|
||||
new ResolveTakenPictureAsyncTask(byteArray, promise, options, cacheDirectory).execute();
|
||||
new ResolveTakenPictureAsyncTask(stream.toByteArray(), promise, options, cacheDirectory).execute();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
promise.reject("E_CAMERA_BAD_VIEWTAG", "takePictureAsync: Expected a Camera component");
|
||||
|
||||
Reference in New Issue
Block a user