I made a login screen for my app, and a homepage. My goal is to store if the users is logged in, and if he is, to not send him through the login page, but directly to the mainpage. I found a way online, using this method shown in the code. But even though the function works (it logs "logged in" or "not logged in" correctly. It still always sends me directly to the homepage... What am I doing wrong?
import React from "react";
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from "../screens/HomeScreen";
import Login from "../screens/Login";
import * as SecureStore from 'expo-secure-store';
const AuthStack = () => {
const AuthStack = createNativeStackNavigator();
async function isLoggedIn(key) {
let result = await SecureStore.getItemAsync(key);
if (result !== null) {
alert("