Skip to content

fix(scanner): navigate away before processing EIP-681 URIs#7257

Open
DanielSinclair wants to merge 1 commit intodevelopfrom
@daniel/fix-eip681-qr-scanner-lockup
Open

fix(scanner): navigate away before processing EIP-681 URIs#7257
DanielSinclair wants to merge 1 commit intodevelopfrom
@daniel/fix-eip681-qr-scanner-lockup

Conversation

@DanielSinclair
Copy link
Copy Markdown
Contributor

@DanielSinclair DanielSinclair commented Mar 24, 2026

Fixes APP-3526

What changed (plus any additional context for devs)

Scanning an EIP-681 QR code (ethereum: URI) locked the app completely β€” no crash, just frozen with no recovery path.

QRScannerScreen has a beforeRemove listener (added in #5178) that intercepts every navigation away from the scanner to deactivate the camera first. Every other QR handler (handleScanAddress, handleScanWalletConnect) calls navigate(Routes.WALLET_SCREEN) before opening the destination, so the scanner is already out of the stack and beforeRemove never fires for the deep-navigation step.

handleScanEthereumUrl was the exception β€” it left the scanner mounted and let parseEthereumUrl push SEND_FLOW directly. That triggered beforeRemove, which blocked the navigation, re-dispatched it, which triggered beforeRemove again β€” infinite loop.

Fix: add navigate(Routes.WALLET_SCREEN) at the top of handleScanEthereumUrl, matching every other handler. Remove the onSuccess() call from the EIP-681 branch in onScan (navigating away loses focus, deactivating the camera via isActive).

Screen recordings / screenshots

What to test

EIP-681 (the fix) β€” all should open the send sheet, not freeze

  • Base USDC transfer (exact ticket scenario, wallet holding USDC on Base required):
    ethereum:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913@8453/transfer?address=0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18&uint256=5000000
    β†’ Generate QR
  • ERC-20 transfer, token not in wallet β†’ should show "you don't have this asset" alert, not freeze
  • Native ETH send on mainnet:
    ethereum:0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18?value=1e18
    β†’ Generate QR
  • Native ETH send on an L2 (e.g. Base):
    ethereum:0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18@8453?value=1e18
    β†’ Generate QR
  • pay- prefixed URI (ERC-831):
    ethereum:pay-0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18?value=5e17
    β†’ Generate QR

Regression β€” unmodified flows that share the scanner

  • Plain 0x address β†’ profile sheet opens
    β†’ Generate QR
  • WalletConnect v2 QR β†’ pairing sheet opens (requires live dapp session)
  • POAP QR (poap.xyz link) β†’ mint sheet opens
    β†’ Generate QR
  • Rainbow profile QR β†’ profile sheet opens
    β†’ Generate QR
  • Unrecognised QR β†’ "could not be recognized" alert with OK to re-enable scanner
    β†’ Generate QR

@linear
Copy link
Copy Markdown

linear Bot commented Mar 24, 2026

@DanielSinclair DanielSinclair force-pushed the @daniel/fix-eip681-qr-scanner-lockup branch from 749e58f to 3762e5a Compare March 24, 2026 05:28
Scanning an EIP-681 QR code (ethereum: URI) locked the app completely β€”
no crash, no recovery β€” because parseEthereumUrl navigated to SEND_FLOW
while QRScannerScreen was still mounted, triggering its beforeRemove
listener on every attempt and looping forever.

Every other QR handler calls navigate(Routes.WALLET_SCREEN) before
opening the destination. Add the same call to handleScanEthereumUrl so
the scanner leaves the stack before parseEthereumUrl fires. Remove the
now-redundant onSuccess() from the EIP-681 branch in onScan; navigating
away loses focus and deactivates the camera via isActive automatically.

Bug introduced in #5178 (react-native-vision-camera upgrade, Jan 2024).
@DanielSinclair DanielSinclair force-pushed the @daniel/fix-eip681-qr-scanner-lockup branch from 3762e5a to df12aac Compare April 17, 2026 16:27
@DanielSinclair DanielSinclair marked this pull request as ready for review April 17, 2026 16:28
@DanielSinclair
Copy link
Copy Markdown
Contributor Author

Bitrise build is currently building to properly test this on device

@github-actions
Copy link
Copy Markdown

Launch in simulator or device for f53d7a5

@github-actions
Copy link
Copy Markdown

πŸ§ͺ Flashlight Performance Report (AWS Device Farm)

πŸ”€ Commit: f53d7a5

πŸ“Ž View Artifacts

Metric Current Ξ” vs Baseline
Time to Interactive (TTI) 5575 ms βšͺ -47.5 ms (-0.8%)
Average FPS 56.68 βšͺ -0.0 (-0.0%)
Average RAM 395.2 MB βšͺ -4.0 MB (-1.0%)

@olerass
Copy link
Copy Markdown
Contributor

olerass commented Apr 23, 2026

Bitrise build is currently building to properly test this on device

@DanielSinclair did you get to test this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants