Browse Source

Fixed the compile error

extension is final and cannot be changed.
Ardavan Kalhori 6 years ago
parent
commit
bae74096f0
No account linked to committer's email address

+ 3
- 2
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java View File

104
                 final byte[] bytes = os.toByteArray();
104
                 final byte[] bytes = os.toByteArray();
105
                 String data = Base64.encodeToString(bytes, Base64.NO_WRAP);
105
                 String data = Base64.encodeToString(bytes, Base64.NO_WRAP);
106
                 // correct the extension if JPG
106
                 // correct the extension if JPG
107
+                String imageFormat = extension;
107
                 if ("jpg".equals(extension)) {
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
                 promise.resolve(data);
112
                 promise.resolve(data);
112
             }
113
             }
113
         } catch (Exception e) {
114
         } catch (Exception e) {