Skip to content

Commit

Permalink
fix bug in display errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vorujack committed Jan 7, 2024
1 parent 60a82bb commit 58b91f8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
32 changes: 21 additions & 11 deletions src/components/qrcode/QrCodeReaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,29 @@ class QrCodeReaderView extends React.Component<
};

renderSubComponent = () => {
const selectedType = Types.filter((item) => item.type === this.state.type);
if (selectedType.length > 0) {
return selectedType[0].render(
this.state.chunks.join(''),
this.props.close,
this.props.completed,
this.props.wallet
try {
const selectedType = Types.filter(
(item) => item.type === this.state.type
);
if (selectedType.length > 0) {
return selectedType[0].render(
this.state.chunks.join(''),
this.props.close,
this.props.completed,
this.props.wallet
);
}
Toast.show({
text: `No Renderer type detected for ${this.state.type}`,
}).then(() => null);
return null;
} catch (e) {
console.warn(e);
Toast.show({
text: `Invalid Data Scanned`,
}).then(() => null);
this.props.fail();
}
Toast.show({
text: `No Renderer type detected for ${this.state.type}`,
}).then(() => null);
return null;
};

render = () => {
Expand Down
16 changes: 9 additions & 7 deletions src/components/qrcode/qrcode-types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,15 @@ const Types = [
close: () => unknown,
completed?: (result: string) => unknown,
wallet?: Wallet
) => (
<TransactionSignRequest
completed={completed}
tx={JsonBI.parse(param)}
closeQrcode={close}
/>
),
) => {
return (
<TransactionSignRequest
completed={completed}
tx={JsonBI.parse(param)}
closeQrcode={close}
/>
);
},
type: TxSignR,
detect: (value: string) => detectPageFromJson(value, TxSignR),
},
Expand Down

0 comments on commit 58b91f8

Please sign in to comment.