Skip to content

[iOS] Fix QR Code being rendered when the "Send" screen is not in focus #726

@tuliomir

Description

@tuliomir

In some situations the iOS app identifies that the user is trying to scan a QR Code for sending a transaction, when it's actually looking at the Dashboard. This may be related to recent upgrades to the React Navigation ( #688 ) that may try to pre-render the QR Code screen and ends up activating the QR Reader.

There is already a component effect dedicated to identifying if the QR component should be rendered or not, but it seems to be obsolete as of now.

useEffect(() => {
/*
* We need to focus/unfocus the QRCode scanner, so that it doesn't freeze
* - When the navigation focuses this screen or app becomes active, we set it to `true`
* - When the navigation moves away or app becomes inactive, we set it to `false`
*/
let appStateEvent;
const focusEvent = navigation.addListener('focus', () => {

Probably this just needs to be adapted.

Steps to reproduce the error

  • Load a wallet
  • Send a transaction of 0.01 HTR using a QR Code
  • When the "Success" modal is being shown, point the camera to the QR Code again
  • Dismiss the modal

Expected behavior: the dashboard screen should be displayed and no action taken
Current behavior: while the dashboard screen is being displayed, the QR Code is read again, and the app navigates to the "Send Tokens" screen with no user input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions