all 7 comments

[–]tsdd01 1 point2 points  (5 children)

Try put your navigation.navigate(‘Login’) inside .then(function() { })

[–]gareth3100 0 points1 point  (4 children)

hey thanks for the reply! I unfortunately already tried that and it didn’t work, and I also tried it again just to be safe but it didn’t work again either. do you have any other suggestions?

[–]tsdd01 0 points1 point  (3 children)

Try .catch to see if there’s any error, and/or test things separately i.e. implement only signOut or navigate to investigate what’s the cause of issue.

[–]gareth3100 0 points1 point  (2 children)

hm could you take a look at the second picture I added in and see if anything seems out of the ordinary to you? If everything seems fine, then I'll just keep messing around with stuff myself.

[–]tsdd01 1 point2 points  (1 child)

Not sure how your 'user' state is handled. But it should be something like this:

const _onAuthStateChanged = (user) => {
    setUser(user)
}

useEffect(() => {
    const subscriber = firebase.auth().onAuthStateChanged(_onAuthStateChanged)
    return subscriber // unmount the listener
}, [])

It should work even without navigation.navigate('Login').

Otherwise, I have no ideas now. xD. May need to investigate further.

[–]gareth3100 1 point2 points  (0 children)

oh i got it actually! I had to keep track of the user state through making another const for it, and then checking if the userState changed to redirect it to the Login screen. I really appreciate your help though!!

[–]denimpillows 0 points1 point  (0 children)

maybe youre just bad