Closed d2luu closed 5 years ago
I found why the black screen display on EditorView. It turns out the path of image taken by RNCamera contain 'file://', so I fix my code to:
takePicture = async () => {
if (this.camera.current) {
const options = { quality: 0.8, base64: true };
const data = await this.camera.current.takePictureAsync(options);
const imgPath = data.uri.replace('file://', '');
RNPhotoEditor.Edit({
path: imgPath,
stickers: [
'sticker0',
'sticker1',
'sticker2',
'sticker3',
'sticker4',
],
hiddenControls: [],
colors: undefined,
});
}
};
But I faced another problem. The image now display on Editor View but it was rotated to horizontal:
And, the image still can't save. Error on Logcat same to above. @prscX Do you have any idea on this?
I got the same issue, any solution on this?
I had same problem here. When I click save button on the first time, the permission modal did not display, and then the image can't save.
I created PR to fix save image on Android.
The problem Image was rotated to horizontal on Editor after taken by RNCamera
can be solved by add property fixOrientation: true
into options of RNCamera. So now js code become to:
takePicture = async () => {
if (this.camera.current) {
const options = {
quality: 0.8,
base64: true,
fixOrientation: true, // Add this to prevent image rotated
};
const data = await this.camera.current.takePictureAsync(options);
const imgPath = data.uri.replace('file://', '');
RNPhotoEditor.Edit({
path: imgPath,
stickers: [
'sticker0',
'sticker1',
'sticker2',
'sticker3',
'sticker4',
],
hiddenControls: [],
colors: undefined,
});
}
};
I hope it can help.
how to save the image after editing ??
It automatically updates the edited image to the source path.
I installed my app on Samsung galaxy note FE (real device), with Android 8.0 (API 26), my app get the image taken by react-native-camera but the photo didn't display in Editor View instead of a black screen. I also try press save the image (full black image) but Editor View close without being able to save. So, I try to run project on Android Studio on google pixel with API 27, result still same as my real device. Here is I caught in Logcat:
I use react-native-camera to capture image, my javascript's code:
AndroidManifest.xml:
My app runs properly on iPhone device with ios >= 11.