Skip to content

Commit

Permalink
add early return on qr signing modal
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistevam committed Jun 23, 2023
1 parent 0f5b223 commit 16eb734
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions app/components/Nav/Main/RootRPCMethodsUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,27 +378,18 @@ const RootRPCMethodsUI = (props) => {
],
);

const onQRSigningApproval = () => {
setShowPendingApproval(false);
};

const onQRSigningRejected = () => {
setShowPendingApproval(false);
};

const renderQRSigningModal = () => {
const { isSigningQRObject, QRState } = props;
return (
!transactionModalType &&
isSigningQRObject && (
<QRSigningModal
isVisible={showPendingApproval?.type === ApprovalTypes.TRANSACTION}
QRState={QRState}
onSuccess={onQRSigningApproval}
onCancel={onQRSigningRejected}
/>
)
);

if (
!isSigningQRObject ||
transactionModalType ||
showPendingApproval?.type !== ApprovalTypes.TRANSACTION
) {
return null;
}

return <QRSigningModal isVisible QRState={QRState} />;
};

const onWalletConnectSessionApproval = () => {
Expand Down Expand Up @@ -844,7 +835,9 @@ RootRPCMethodsUI.propTypes = {
* Chain id
*/
chainId: PropTypes.string,
// eslint-disable-next-line react/no-unused-prop-types
isSigningQRObject: PropTypes.bool,
// eslint-disable-next-line react/no-unused-prop-types
QRState: PropTypes.object,
/**
* updates redux when network is switched
Expand Down

0 comments on commit 16eb734

Please sign in to comment.