How do I solve {ReferenceError: Property 'StackNavigator' doesn't exist} error in react native

75 Views Asked by At
ReferenceError: Property 'StackNavigator' doesn't exist

This error is located at:
    in App (created by withDevTools(App))
    in withDevTools(App)
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in main(RootComponent), js engine: hermes
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\ReactFiberErrorDialog.js:null in showErrorDialog
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in logCapturedError
at http://192.168.1.103:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:nn logCapturedError
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in createRootErrorUpdate
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in resetHasForceUpdateBeforeProcess
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in commitUpdateQueue
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in commitLayoutEffectOnFiber
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in commitLayoutMountEffects_complet
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in commitLayoutEffects_begin
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in commitLayoutEffects
mitRoot
at http://192.168.1.103:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:null in performSyncWorkOnRoot
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in flushSyncCallbacks
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:null in flushSyncCallbacksOnlyInLegacyMode
- ... 12 more stack frames from framework internals

I have run npm install react-navigation/native-stack and also

    import { NavigationContainer } from '@react-navigation/native'
    import { createNativeStackNavigator} from '@react-navigation/native-stack'
1

There are 1 best solutions below

0
Fatma Aydoğdu On
const Stack = createNativeStackNavigator();

Did you forget to add this?

And this document explains it clearly https://reactnavigation.org/docs/hello-react-navigation