首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.../node_modules/@react-navigation/stack/lib/typescript/src/index没有导出成员StackNavigationProp

.../node_modules/@react-navigation/stack/lib/typescript/src/index没有导出成员StackNavigationProp
EN

Stack Overflow用户
提问于 2022-09-17 07:14:32
回答 1查看 45关注 0票数 1

我对反应本机非常陌生,我正尝试在我正在进行的项目中使用react导航。我试图在我的AuthStackParams.ts中使用AuthStackParams.ts,但是我一直收到一个错误:

代码语言:javascript
复制
.../node_modules/@react-navigation/stack/lib/typescript/src/index has no exported member StackNavigationProp

我已经尝试过再次安装@react-navigation/stack,我也尝试过expo start -c,但两者都没有帮助。我希望能就造成这一问题的原因提供任何帮助或建议。谢谢!

AuthStackParams.ts

代码语言:javascript
复制
import { StackNavigationProp } from '@react-navigation/stack';
import { RouteProp } from '@react-navigation/native';

export type AuthStackParams = {
  Login: undefined;
};

export type AuthNavProps<T extends keyof AuthStackParams> = {
  navigation: StackNavigationProp<AuthStackParams, T>;
  route: RouteProp<AuthStackParams, T>;
};

package.json

代码语言:javascript
复制
{
  "name": "mobile",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "test": "jest --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@apollo/client": "^3.6.9",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-masked-view/masked-view": "0.2.7",
    "@react-navigation/bottom-tabs": "^6.0.5",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.1.0",
    "@react-navigation/stack": "^6.3.0",
    "apollo-client": "^2.6.10",
    "expo": "~46.0.9",
    "expo-asset": "~8.6.1",
    "expo-constants": "~13.2.4",
    "expo-font": "~10.2.0",
    "expo-linking": "~3.2.2",
    "expo-permissions": "^13.2.0",
    "expo-splash-screen": "^0.16.2",
    "expo-status-bar": "~1.4.0",
    "expo-system-ui": "~1.3.0",
    "expo-web-browser": "~11.0.0",
    "graphql": "^15.8.0",
    "graphql-ws": "^5.10.1",
    "moment": "^2.29.4",
    "react": "^18.0.0",
    "react-dom": "18.0.0",
    "react-native": "^0.69.5",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-keyboard-accessory": "^0.1.16",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-web": "~0.18.7",
    "uuid-random": "^1.3.2",
    "ws": "^7.5.9"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "~18.0.0",
    "@types/react-native": "~0.69.1",
    "jest": "^26.6.3",
    "jest-expo": "~44.0.1",
    "react-test-renderer": "18.0.0",
    "typescript": "~4.3.5"
  },
  "private": true
}
EN

回答 1

Stack Overflow用户

发布于 2022-09-17 07:22:25

  1. 清除缓存
  2. 删除node_modules和锁文件
  3. 升级babel-core和babel-运行时

版本

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73752928

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档