Render error while implementing Navigation in ReactNative

I am new to React Native and have been learning this from the courses posted by Mosh. While I was trying to implement navigation, getting this Render error in my android simulator “require native component rnsscreenstackheaderconfig was not found in the uimanager”. Tried the options suggested here requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager when running android app

Kindly help, so that I can continue my remaining lectures from this course.

Thanks in advance!

With multiple tries, following steps worked for me.

Restart your machine
Turn off metro bundler
yarn add @react-navigation/native
yarn add react-native-screens
npx react-native rn-android

Also make sure before doing these steps close android simulator or ios simulator