prscX / react-native-photo-editor

React Native: Native Photo Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

memanoj opened this issue Β· 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