You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
base64 images with newlines will not work in some situations (many? most? all?), e.g. the React Native Share() library won't accept it properly as a url param.
<QRCode
getRef={c => {
if (!c?.toDataURL) return;
c?.toDataURL((base64Image: string) => {
// must strip whitespace due to 'bug' in QR code library
// see https://github.com/react-native-share/react-native-share/issues/1393#issuecomment-1568365217
base64QrCodeRef.current = base64Image.replace(/(\r\n|\n|\r)/gm, '');
});
}}
{...rest}
/>
Proposed fix:
Strip newlines from base64 output, i.e. append .replace(/(\r\n|\n|\r)/gm, '') to the return value of toDataURL().
The text was updated successfully, but these errors were encountered:
base64 images with newlines will not work in some situations (many? most? all?), e.g. the React Native
Share()
library won't accept it properly as aurl
param.FAILURE CASE
SUCCESS CASE
via react-native-share/react-native-share#1393 (comment)
Proposed fix:
Strip newlines from base64 output, i.e. append
.replace(/(\r\n|\n|\r)/gm, '')
to the return value oftoDataURL()
.The text was updated successfully, but these errors were encountered: