From 3e6cf778eed04527907133bbbe1c2aeac3bb1f82 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Fri, 19 Jul 2024 10:04:18 -0400 Subject: [PATCH] Payment: note fetch fallback --- views/Payment.tsx | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/views/Payment.tsx b/views/Payment.tsx index b76d51677..39fb9313b 100644 --- a/views/Payment.tsx +++ b/views/Payment.tsx @@ -59,19 +59,25 @@ export default class PaymentView extends React.Component { if (lnurlpaytx) { this.setState({ lnurlpaytx }); } + this.getNote(); navigation.addListener('focus', () => { - const noteKey = payment.noteKey; - - EncryptedStorage.getItem('note-' + noteKey) - .then((storedNotes) => { - this.setState({ storedNotes }); - }) - .catch((error) => { - console.error('Error retrieving notes:', error); - }); + this.getNote(); }); } + getNote = () => { + const { route } = this.props; + const payment = route.params?.payment; + const noteKey = payment.noteKey; + EncryptedStorage.getItem('note-' + noteKey) + .then((storedNotes) => { + this.setState({ storedNotes }); + }) + .catch((error) => { + console.error('Error retrieving notes:', error); + }); + }; + render() { const { navigation, SettingsStore, NodeInfoStore, route } = this.props; const { storedNotes, lnurlpaytx } = this.state;