Skip to content

[Bug]: Expo react native useSdk hook gives [TypeError: connect is not a function (it is undefined)] #786

@dkoode

Description

@dkoode

SDK

React-Native

Provide environment information

Hello,

I'm trying to connect my Metamask wallet in the Expo application I developed using the Metamask SDK. Despite following all the necessary steps for Expo mentioned in the documentation at https://docs.metamask.io/wallet/how-to/use-sdk/javascript/react-native/, I'm unable to establish the connection. I'm encountering the following error for the connect function coming from the useSdk hook:

Failed to connect wallet: [TypeError: connect is not a function (it is undefined)]

Despite meticulously following the documentation and investigating the issue, I haven't been able to find a solution.

image

MetaMask SDK Version

^0.18.0

MetaMask Mobile app Version

7.18.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

npx expo run:android

Describe the Bug

image

useSdk connect hook is giving this error:

ERROR Failed to connect wallet: [TypeError: connect is not a function (it is undefined)]

Expected Behavior

Connecting the Metamask wallet with an Expo dApp, as specified in the link https://docs.metamask.io/wallet/how-to/use-sdk/javascript/react-native/, involves performing the connect operation.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

After creating an Expo application following the steps outlined in the https://docs.expo.dev/get-started/create-a-project/ link, I proceeded to implement the steps provided in the Metamask React Native SDK documentation (https://docs.metamask.io/wallet/how-to/use-sdk/javascript/react-native/) one by one. However, when attempting to establish a connection, I encountered the error I mentioned earlier. Below are the versions I am using:

"@metamask/sdk-react": "^0.18.0",
"@react-native-async-storage/async-storage": "1.21.0",
"ethers": "5.7.2",
"expo": "~50.0.14",
"expo-crypto": "~12.8.1",
"expo-status-bar": "~1.11.1",
"node-libs-expo": "^0.0.3",
"react": "18.2.0",
"react-native": "0.73.6",
"react-native-background-timer": "^2.4.1",
"react-native-get-random-values": "1.8.0",
"react-native-randombytes": "^3.6.1",
"react-native-url-polyfill": "^2.0.0"

Metadata

Metadata

Labels

Bug TriageIssues to be triaged in the next session

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions