MobileWalletProtocol / wallet-mobile-sdk

An open protocol for mobile web3 apps to interact with wallets

Home Page:https://mobilewalletprotocol.github.io/wallet-mobile-sdk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: handleResponse with deeplink crashes the app on iOS

upacyxou opened this issue · comments

Describe the bug

When using the handleResponse function from @coinbase/wallet-mobile-sdk inside a React Native component with a Linking url listener in a useEffect hook, the app crashes upon opening a deeplink (e.g., app://email?domain=domain&token=very-long-token).

Steps

  1. Create a React Native component with a Linking url listener in a useEffect hook.
  2. Add the handleResponse function from @coinbase/wallet-mobile-sdk as the listener.
  3. Open the app's deeplink (e.g., app://email?domain=domain&token=very-long-token).
  4. Notice that the app crashes.

Expected behavior

The app should not crash when handling the deeplink with the handleResponse function.

Version

1.0.6

Additional info

Screenshot 2023-06-15 at 18 32 40
import { Linking } from 'react-native'
import { handleResponse } from '@coinbase/wallet-mobile-sdk'
import { useEffect } from 'react'

function App() {
  useEffect(() => {
    const sub = Linking.addEventListener('url', ({ url }) => {
      handleResponse(url)
    })
    return () => sub?.remove()
  }, [])

  return <></>
}

const WrapperApp = App

export default WrapperApp

Desktop

No response

Smartphone

No response

Having the same problem.

Same for me, the app crashes on iOS if you open a deeplink with listener

Year, iOS deeplinks...
Do you have any ideas on how to fix this?

It's strange because I have the same issue on iOS, but Android is fine. Good workaround, but it's better to have a fix in the package

hey all. thanks for reporting the bug.
seems the code you shared looks pretty much the same as our example, which doesn't crash btw.
can you share the error message you are getting?
image

hey all. thanks for reporting the bug. seems the code you shared looks pretty much the same as our example, which doesn't crash btw. can you share the error message you are getting? image

Screenshot 2023-06-16 at 10 53 42 Screenshot 2023-06-16 at 10 53 49