Getting "Invalid Hook Call" Error when trying to us Logout Button in Drawer.Navigator with useContext and useCallback

Solution 1:

From apollo docs: Note that you cannot use the useNavigation hook inside the drawerContent since useNavigation is only available inside screens. You get a navigation prop for your drawerContent which you can use instead

Try props.navigation.replace("Login"); instead

Same issue you are facing on Github here as well: https://github.com/react-navigation/react-navigation/issues/7725