react-native-view-shot icon indicating copy to clipboard operation
react-native-view-shot copied to clipboard

Malformed base64 string

Open MichaelKic opened this issue 1 year ago • 1 comments

bug report

Version & Platform

3.6.0 iOS

Expected behavior

To produce a valid base64 image

Actual behavior

Produces a malformed base64 string with line breaks resulting in an error.

Steps to reproduce the behavior

Create a base64 image, and try to render it. We tried passing it to react-native-share and it errored out.

Me and my team were able to fix it by removing the line breaks.

const rawData = await captureRef(photoTileRef, {
          quality: 0.8,
          result: "data-uri",
        });

const imgData = rawData.replace(/(\r\n|\n|\r)/gm, "");

MichaelKic avatar Jun 16 '23 05:06 MichaelKic

Seems to be related to https://github.com/facebook/react-native/issues/36512

desfero avatar Jul 27 '23 21:07 desfero