You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo应用卡在Welcome to Expo - index.tsx界面求助

问题描述

在Windows系统的Android模拟器上运行基于Expo Router的React Native应用时,卡在「Welcome to Expo - index.tsx」界面。此前应用运行正常,突然出现该问题,index.tsx位于app/(tabs)路径下。怀疑问题和react-native-dotenv的@env配置结构有关,但整个应用都是基于该结构开发且之前无异常。已尝试删除依赖重装、执行npx expo start -c清理缓存,均未解决。问题始于将某个页面修改为组件之后。

相关配置文件

app.json

{
  "expo": {
    "name": "appname",
    "slug": "appname",
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "scheme": "appname",
    "userInterfaceStyle": "automatic",
    "newArchEnabled": true,
    "splash": {
      "image": "./assets/images/splash-icon.png",
      "resizeMode": "contain",
      "backgroundColor": "#161616"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.appname.app",
      "infoPlist": {
        "ITSAppUsesNonExemptEncryption": false,
        "NSPhotoLibraryAddUsageDescription": "appname needs access to save quick tips to your photo library.",
        "NSPhotoLibraryUsageDescription": "appname needs access to save quick tips to your photo library."
      }
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/adaptive-icon.png",
        "backgroundColor": "#161616"
      },
      "package": "com.appname.app"
    },
    "web": {
      "bundler": "metro",
      "output": "static",
      "favicon": "./assets/images/favicon.png"
    },
    "plugins": [
      "expo-router",
      [
        "expo-splash-screen",
        {
          "image": "./assets/images/splash-icon.png",
          "imageWidth": 200,
          "resizeMode": "contain",
          "backgroundColor": "#161616"
        }
      ],
      "expo-secure-store"
    ],
    "experiments": {
      "typedRoutes": true,
      "tsconfigPaths": true
    },
    "extra": {
      "router": {
        "origin": false
      },
      "eas": {
        "projectId": "******"
      }
    }
  }
}

package.json

{
  "name": "appname",
  "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",
    "test": "jest --watchAll",
    "lint": "expo lint"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo-google-fonts/inter": "^0.2.3",
    "@expo-google-fonts/poppins": "^0.2.3",
    "@expo/vector-icons": "^14.0.4",
    "@react-native-async-storage/async-storage": "^2.1.1",
    "@react-navigation/bottom-tabs": "^7.2.0",
    "@react-navigation/native": "^7.0.14",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.8",
    "@supabase/supabase-js": "^2.48.1",
    "expo": "~52.0.25",
    "expo-application": "~6.0.2",
    "expo-blur": "~14.0.2",
    "expo-clipboard": "~7.0.1",
    "expo-constants": "~17.0.4",
    "expo-dev-client": "~5.0.12",
    "expo-font": "~13.0.3",
    "expo-haptics": "~14.0.1",
    "expo-image-manipulator": "~13.0.6",
    "expo-linear-gradient": "~14.0.2",
    "expo-linking": "~7.0.4",
    "expo-media-library": "~17.0.6",
    "expo-router": "~4.0.16",
    "expo-secure-store": "~14.0.1",
    "expo-sharing": "~13.0.1",
    "expo-splash-screen": "~0.29.20",
    "expo-status-bar": "~2.0.1",
    "expo-symbols": "~0.2.1",
    "expo-system-ui": "~4.0.7",
    "expo-web-browser": "~14.0.2",
    "react": "18.3.1",
    "react-dom": "18.3.1",
    "react-native": "0.76.6",
    "react-native-dotenv": "^3.4.11",
    "react-native-gesture-handler": "~2.20.2",
    "react-native-get-random-values": "~1.11.0",
    "react-native-reanimated": "~3.16.1",
    "react-native-safe-area-context": "4.12.0",
    "react-native-screens": "~4.4.0",
    "react-native-view-shot": "~4.0.3",
    "react-native-web": "~0.19.13",
    "react-native-webview": "13.12.5",
    "replicate": "^1.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@react-native-community/cli": "^15.1.3",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.3.12",
    "@types/react-test-renderer": "^18.3.0",
    "jest": "^29.2.1",
    "jest-expo": "~52.0.3",
    "react-test-renderer": "18.3.1",
    "typescript": "^5.3.3"
  },
  "private": true
}

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      [
        "module:react-native-dotenv",
        {
          moduleName: "@env",
          path: ".env",
          blacklist: null,
          whitelist: null,
          safe: false,
          allowUndefined: true,
        },
      ],
    ],
  };
};

内容的提问来源于stack exchange,提问作者Berk Birge

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 04:25:57