prscX/react-native-photo-editor

This patch fill fix the issue for Crop option is working only one time (Android)

memanoj opened this issue ยท 2 comments

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch react-native-photo-editor@1.0.13 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-photo-editor/android/src/main/java/com/ahmedadeltito/photoeditor/PhotoEditorActivity.java b/node_modules/react-native-photo-editor/android/src/main/java/com/ahmedadeltito/photoeditor/PhotoEditorActivity.java
index 9bf2eb7..b248fdb 100755
--- a/node_modules/react-native-photo-editor/android/src/main/java/com/ahmedadeltito/photoeditor/PhotoEditorActivity.java
+++ b/node_modules/react-native-photo-editor/android/src/main/java/com/ahmedadeltito/photoeditor/PhotoEditorActivity.java
@@ -736,7 +736,14 @@ public class PhotoEditorActivity extends AppCompatActivity implements View.OnCli
     }
 
     private void startCropping() {
+
         System.out.println(selectedImagePath);
+        
+        if (selectedImagePath.contains("file://")||selectedImagePath.contains("content://")) {
+        
+        selectedImagePath = getPath(Uri.parse(selectedImagePath));
+        
+        }
         Uri uri = Uri.fromFile(new File(selectedImagePath));
         UCrop.Options options = new UCrop.Options();
         options.setCompressionFormat(Bitmap.CompressFormat.JPEG);

This issue body was partially generated by patch-package.

Thank you!! :)

Thank you , it's working