fix qr code web
This commit is contained in:
@@ -46,6 +46,7 @@ const ShareModal = ({ payload }) => {
|
||||
|
||||
const [copied, setCopied] = useState(false);
|
||||
const copyTimeout = useRef(null);
|
||||
const shareQrTimeoutRef = useRef(null);
|
||||
const modalRef = useRef(null);
|
||||
const [webVisible, setWebVisible] = useState(true);
|
||||
const blurProps =
|
||||
@@ -88,6 +89,7 @@ const ShareModal = ({ payload }) => {
|
||||
if (copyTimeout.current) {
|
||||
clearTimeout(copyTimeout.current);
|
||||
}
|
||||
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -191,14 +193,45 @@ const ShareModal = ({ payload }) => {
|
||||
const handleShareOption = useCallback(
|
||||
async (option) => {
|
||||
if (option?.type === "qr") {
|
||||
await closeSheet();
|
||||
setGlobal({
|
||||
shareQrModal: {
|
||||
visible: true,
|
||||
console.log("share.modal.handleShareOption", {
|
||||
key: option?.key,
|
||||
platform: Platform.OS,
|
||||
});
|
||||
|
||||
if (shareQrTimeoutRef.current) {
|
||||
clearTimeout(shareQrTimeoutRef.current);
|
||||
}
|
||||
|
||||
const openQrModal = () => {
|
||||
console.log("share.modal.openQrModal", {
|
||||
platform: Platform.OS,
|
||||
url: qrUrl,
|
||||
title: qrTitle,
|
||||
},
|
||||
});
|
||||
});
|
||||
shareQrTimeoutRef.current = null;
|
||||
setGlobal({
|
||||
shareQrModal: {
|
||||
visible: true,
|
||||
url: qrUrl,
|
||||
title: qrTitle,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (Platform.OS === "web") {
|
||||
console.log("share.modal.scheduleQr", { platform: Platform.OS });
|
||||
const maybePromise = closeSheet();
|
||||
shareQrTimeoutRef.current = setTimeout(openQrModal, 80);
|
||||
if (maybePromise && typeof maybePromise.catch === "function") {
|
||||
maybePromise.catch((error) => {
|
||||
console.error("share.modal.closeSheet.error", error);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
await closeSheet();
|
||||
openQrModal();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user