Skip to content

ReferenceError: Can't find variable: document #420

Open
@Kushagra-002

Description

@Kushagra-002

Describe the bug

I'm encountering a runtime error when using Reown AppKit in a React Native project:

ReferenceError: Can't find variable: document
This appears to be caused by a dependency or internal implementation that assumes a web environment, where the document global exists. However, in React Native, document is not defined as it is not a browser environment.

Steps to Reproduce:

Install and import components from @reown/appkit in a React Native app.

Run the app on iOS

The app crashes with the ReferenceError.

Expected Behavior:

The Reown AppKit should work in a React Native environment or handle browser-specific APIs gracefully to avoid crashes.

Actual Behavior:

The app crashes on startup or component render with:

ReferenceError: Can't find variable: document
Environment:

React Native version:0.79.2

reown/appkit-wagmi-react-native: 1.2.3

Platform: iOS

Expo (if used): Yes

Additional libraries: no

this is my package.json

{
"name": "test-expo",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"lint": "expo lint"
},
"dependencies": {
"@expo/vector-icons": "^14.1.0",
"@react-native-async-storage/async-storage": "2.1.2",
"@react-native-community/netinfo": "11.4.1",
"@react-navigation/bottom-tabs": "^7.3.10",
"@react-navigation/elements": "^2.3.8",
"@react-navigation/native": "^7.1.6",
"@reown/appkit-wagmi-react-native": "^1.2.3",
"@tanstack/react-query": "^5.76.1",
"@walletconnect/react-native-compat": "^2.20.2",
"expo": "~53.0.9",
"expo-application": "~6.1.4",
"expo-blur": "~14.1.4",
"expo-constants": "~17.1.6",
"expo-font": "~13.3.1",
"expo-haptics": "~14.1.4",
"expo-image": "~2.1.7",
"expo-linking": "~7.1.5",
"expo-router": "~5.0.6",
"expo-splash-screen": "~0.30.8",
"expo-status-bar": "~2.2.3",
"expo-symbols": "~0.4.4",
"expo-system-ui": "~5.0.7",
"expo-web-browser": "~14.1.6",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-native": "0.79.2",
"react-native-gesture-handler": "~2.24.0",
"react-native-get-random-values": "~1.11.0",
"react-native-modal": "^13.0.1",
"react-native-reanimated": "~3.17.4",
"react-native-safe-area-context": "5.4.0",
"react-native-screens": "~4.10.0",
"react-native-svg": "15.11.2",
"react-native-web": "~0.20.0",
"react-native-webview": "13.13.5",
"viem": "^2.29.3",
"wagmi": "^2.15.3",
"expo-dev-client": "~5.1.8"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@types/react": "~19.0.10",
"eslint": "^9.25.0",
"eslint-config-expo": "~9.2.0",
"typescript": "~5.8.3"
},
"private": true
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions