Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add share feature #2728

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix rendering defaultLogo in shared QR on iOS, minor code cleanup
  • Loading branch information
myxmaster committed Feb 3, 2025
commit cf7102b74853d39ccd4a54226879181b92962d86
8 changes: 7 additions & 1 deletion components/CollapsedQR.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import {
Dimensions,
Image,
Platform,
StyleSheet,
Text,
Expand Down Expand Up @@ -50,7 +51,12 @@ const ForwardedQRCode = React.forwardRef<QRCodeElement, ExtendedQRCodeProps>(
getRef={(c) => {
if (c && c.toDataURL && !(ref as any).current) {
(ref as any).current = c;
props.parent?.setState({ qrReady: true });
Image.getSize(
Image.resolveAssetSource(defaultLogo).uri,
() => {
props.parent?.setState({ qrReady: true });
}
);
}
}}
/>
Expand Down
7 changes: 2 additions & 5 deletions components/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ export default class ShareButton extends React.Component<ShareButtonProps> {
shareContent = async () => {
const { value, qrRef, onShareComplete } = this.props;
try {
if (!qrRef?.current) {
return;
}
if (!qrRef?.current) return;

const svgElement = qrRef.current;
const base64Data = await captureRef(svgElement, {
const base64Data = await captureRef(qrRef.current, {
format: 'png',
quality: 1
});
Expand Down