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:
Wouter van den Broek
2018-03-29 13:49:03 +02:00
parent 3eb09933fb
commit d0e0d26138
@@ -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");