So I have a screen where I want the user to stay. If he want's to leave I want him to go to a specific screen. If I do it like this:
useEffect(() => {
navigation.addListener("beforeRemove", (e) => {
e.preventDefault()
navigation.popToTop()
})
}, [navigation])
I get this error: RangeError: Maximum call stack size exceeded (native stack depth)
Even if I change navigation.popToTop() to something else (e.g. navigation.navigate("Account")) I'll get the same error :/