79509806

Date: 2025-03-14 17:24:03
Score: 0.5
Natty:
Report link

If I understand your problem correctly, you just need to check if the user is logged in when button is pressed.

This uses a ternary operator which basically means:

if this variable is true ? Do this : otherwise do this

<TouchableOpacity
  onPress={
    userLoggedIn ? DoLoggedInStuff : navigation.navigate("LoginScreen")
  }
>
  Click me!
</TouchableOpacity>
Reasons:
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (0.5):
Posted by: Niclas Göransson