React Native Expo 应用程序卡在默认屏幕上

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

我的应用程序工作正常,直到我切换到打字稿,我按照博览会文档从

TS
迁移到
JS
然后运行应用程序后,它出现在默认的欢迎来到博览会屏幕上,它还说创建索引。即使我已经在
index.tsx
 处有一个 
./app/

文件,我仍然在应用程序目录中添加了 .js 文件

Package.json

{
  "name": "gymingo",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios"
  },
  "dependencies": {
    "@expo-google-fonts/langar": "^0.2.3",
    "expo": "~51.0.11",
    "expo-location": "^17.0.1",
    "expo-router": "~3.5.15",
    "expo-splash-screen": "^0.27.5",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.2",
    "react-native-google-places-autocomplete": "^2.5.6",
    "react-native-maps": "^1.15.6",
    "react-native-screens": "3.31.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/react": "~18.2.45",
    "metro-react-native-babel-preset": "^0.77.0",
    "react-native-dotenv": "^3.4.11",
    "typescript": "~5.3.3"
  },
  "private": true
}

app.json

{
  "expo": {
    "entryPoint": "./app/index.tsx",
    "name": "gymingo",
    "slug": "gymingo",
    "version": "1.0.0",
    "orientation": "portrait",
    "scheme": "acme",
    "userInterfaceStyle": "automatic",
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.example.app",
      "config": {
        "googleMapsApiKey": ""
      }
    },
  }
}

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      [
        'module:react-native-dotenv',
        {
          moduleName: '@env',
          path: '.env',
        },
      ],
    ],
  };
};
react-native expo expo-router
1个回答
0
投票

这可能与this

重复

尝试删除:

plugins: [
      [
        'module:react-native-dotenv',
        {
          moduleName: '@env',
          path: '.env',
        },
      ],
    ],

来自

babel.config.js

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