瀏覽代碼

Merge pull request #175 from AWDGroup/master

fixed the base64 MIME type when JPG is chosen (iOS)
Gaëtan Renaudeau 6 年之前
父節點
當前提交
d026193dc4
No account linked to committer's email address
共有 1 個檔案被更改,包括 2 行新增1 行删除
  1. 2
    1
      ios/RNViewShot.m

+ 2
- 1
ios/RNViewShot.m 查看文件

@@ -148,7 +148,8 @@ RCT_EXPORT_METHOD(captureRef:(nonnull NSNumber *)target
148 148
       else if ([result isEqualToString:@"data-uri"]) {
149 149
         // Return as a base64 data uri string
150 150
         NSString *base64 = [data base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength];
151
-        res = [NSString stringWithFormat:@"data:image/%@;base64,%@", format, base64];
151
+        NSString *imageFormat = ([format isEqualToString:@"jpg"]) ? @"jpeg" : format;
152
+        res = [NSString stringWithFormat:@"data:image/%@;base64,%@", imageFormat, base64];
152 153
       }
153 154
       else {
154 155
         // Save to a temp file