Ver código fonte

Merge pull request #175 from AWDGroup/master

fixed the base64 MIME type when JPG is chosen (iOS)
Gaëtan Renaudeau 6 anos atrás
pai
commit
d026193dc4
Nenhuma conta vinculada ao e-mail do autor do commit
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2
    1
      ios/RNViewShot.m

+ 2
- 1
ios/RNViewShot.m Ver arquivo

148
       else if ([result isEqualToString:@"data-uri"]) {
148
       else if ([result isEqualToString:@"data-uri"]) {
149
         // Return as a base64 data uri string
149
         // Return as a base64 data uri string
150
         NSString *base64 = [data base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength];
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
       else {
154
       else {
154
         // Save to a temp file
155
         // Save to a temp file