fix: toDataUrl line breaks (#2272)

# Summary

This PR removes the flag to include custom line breaks on `toDataUrl`
method. Some software could not read base64 with additional line break
characters, so it could lead to corrupting the image (like in
react-native-share). Fixes #1986.

## Test Plan

`TestsExample` -> `Test1986`

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |         |
| Android |         |
This commit is contained in:
Jakub Grzywacz
2024-05-15 12:01:33 +02:00
committed by GitHub
parent 38a8dbca39
commit 118a20c0fd
4 changed files with 34 additions and 4 deletions
@@ -339,7 +339,7 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
bitmap.recycle();
byte[] bitmapBytes = stream.toByteArray();
return Base64.encodeToString(bitmapBytes, Base64.DEFAULT);
return Base64.encodeToString(bitmapBytes, Base64.NO_WRAP);
}
String toDataURL(int width, int height) {
@@ -353,7 +353,7 @@ public class SvgView extends ReactViewGroup implements ReactCompoundView, ReactC
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
bitmap.recycle();
byte[] bitmapBytes = stream.toByteArray();
return Base64.encodeToString(bitmapBytes, Base64.DEFAULT);
return Base64.encodeToString(bitmapBytes, Base64.NO_WRAP);
}
void enableTouchEvents() {