浏览代码

Merge pull request #176 from AWDGroup/patch-1

Fixed the compile error
Gaëtan Renaudeau 6 年前
父节点
当前提交
f32408d7ce
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3
    2
      android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java

+ 3
- 2
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java 查看文件

@@ -104,10 +104,11 @@ public class ViewShot implements UIBlock {
104 104
                 final byte[] bytes = os.toByteArray();
105 105
                 String data = Base64.encodeToString(bytes, Base64.NO_WRAP);
106 106
                 // correct the extension if JPG
107
+                String imageFormat = extension;
107 108
                 if ("jpg".equals(extension)) {
108
-                    extension = "jpeg";
109
+                    imageFormat = "jpeg";
109 110
                 }
110
-                data = "data:image/"+extension+";base64," + data;
111
+                data = "data:image/"+imageFormat+";base64," + data;
111 112
                 promise.resolve(data);
112 113
             }
113 114
         } catch (Exception e) {