gre / react-native-view-shot

Snapshot a React Native view and save it to an image

Home Page:https://github.com/gre/react-native-view-shot-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Malformed base64 string

MichaelKic opened this issue · 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, "");

Seems to be related to facebook/react-native#36512