Quellcode durchsuchen

Merge pull request #1 from AWDGroup/patch-1

fixed the base64 MIME type when JPG is chosen
Ardavan Kalhori vor 6 Jahren
Ursprung
Commit
0aaee89958
Es ist kein Benutzerkonto mit dieser Commiter-Email verbunden

+ 4
- 0
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java Datei anzeigen

@@ -107,6 +107,10 @@ public class ViewShot implements UIBlock {
107 107
                 captureView(view, os);
108 108
                 byte[] bytes = ((ByteArrayOutputStream) os).toByteArray();
109 109
                 String data = Base64.encodeToString(bytes, Base64.NO_WRAP);
110
+                // correct the extension if JPG
111
+                if ("jpg".equals(extension)) {
112
+                    extension = "jpeg";
113
+                }
110 114
                 data = "data:image/"+extension+";base64," + data;
111 115
                 promise.resolve(data);
112 116
             }