RepairShopr/react-native-signature-capture

Encoding image on Android produces a string with new lines

leeferfeefer opened this issue · 0 comments

   ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
   Bitmap resizedBitmap = getResizedBitmap(this.signatureView.getSignature());
   resizedBitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
   byte[] byteArray = byteArrayOutputStream.toByteArray();
   String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);

in RSSignatureCaptureMainView.java needs to be corrected to

    String encoded = Base64.encodeToString(byteArray, Base64.NO_WRAP);

Otherwise, the encoded string will be produced with newline characters (\n).

Another issue found from someone on StackOverflow.

I forked the repo with the fix here