6ed3300183
Generated by create-expo-app 3.3.0.
21 lines
499 B
TypeScript
21 lines
499 B
TypeScript
import { useAuth } from "@/utils/AuthProvider";
|
|
import { Redirect, Slot, useSegments } from "expo-router";
|
|
import React from "react";
|
|
import { StyleSheet } from "react-native";
|
|
|
|
const Layout = () => {
|
|
const { isAuthenticated } = useAuth();
|
|
const segments = useSegments();
|
|
const isAuthGroup = segments[1] === "(authenticated)";
|
|
|
|
if (!isAuthenticated && isAuthGroup) {
|
|
return <Redirect href="/" />;
|
|
}
|
|
|
|
return <Slot />;
|
|
};
|
|
|
|
export default Layout;
|
|
|
|
const styles = StyleSheet.create({});
|