.../node_modules/@react-navigation/stack/lib/typescript/src/index has no exported member StackNavigationProp

Viewed 17

I'm pretty new to react native, and I'm trying to use react navigation in a project that I'm working on. I'm trying to use StackNavigationProp in my AuthStackParams.ts, but I keep getting an error saying:

.../node_modules/@react-navigation/stack/lib/typescript/src/index has no exported member StackNavigationProp

I've tried installing @react-navigation/stack again and I've tried expo start -c, but neither has helped. I would appreciate any help or advice on what could be causing this problem. Thank you!

AuthStackParams.ts

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

{
  "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
}
1 Answers
  1. clear cache
  2. delete node_modules and lock file
  3. upgrade the version of babel-core and babel-runtime
Related