Expo/Web 中的 AsyncStorage 找不到“窗口”

问题描述 投票:0回答:1

尝试重现 supabase/native 示例:

https://supabase.com/docs/guides/getting-started/tutorials/with-expo-react-native

当我在 Web 模式下启动 expo 应用程序时,出现以下错误:

% npm run web

> [email protected] web
> expo start --web

...

› Web is waiting on http://localhost:8081

› Using Expo Go
› Press s │ switch to development build

.... › 按 o │ 在编辑器中打开项目代码

› Press ? │ show all commands

Logs for your project will appear below. Press Ctrl+C to exit.
Server Bundling complete 5419ms (node_modules/expo-router/node/render.js)
Server Bundling complete 1748ms (node_modules/expo-router/node/render.js)
Web Bundling complete 5628ms (node_modules/expo-router/entry.js)
Web Bundling complete 1967ms (node_modules/expo-router/entry.js)
"shadow*" style props are deprecated. Use "boxShadow".
selectable prop is deprecated. Use styles.userSelect.
editable is deprecated. Use readOnly.
TouchableOpacity is deprecated. Please use Pressable.
accessibilityDisabled is deprecated.
accessibilityRole is deprecated. Use role.
focusable is deprecated.
ReferenceError: window is not defined
    at getValue (/Users/dave/Documents/repos/eatyourfriend/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js:63:26)
    at /Users/dave/Documents/repos/eatyourfriend/node_modules/@react-native-async-storage/async-storage/lib/commonjs/AsyncStorage.js:39:21
react-native expo asyncstorage
1个回答
0
投票

你成功了吗?我也面临同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.