diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx
index 084ecca..5f8ecf6 100644
--- a/app/(tabs)/_layout.tsx
+++ b/app/(tabs)/_layout.tsx
@@ -1,6 +1,6 @@
+import { useAuth } from "@/context/auth-context";
import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons";
-import { Tabs, Redirect } from "expo-router";
-import { useAuth } from ".././context/auth-context";
+import { Redirect, Tabs } from "expo-router";
export default function TabLayout() {
const { isAuthenticated, isLoading } = useAuth();
diff --git a/app/_layout.tsx b/app/_layout.tsx
index a979f52..ce04f52 100644
--- a/app/_layout.tsx
+++ b/app/_layout.tsx
@@ -1,27 +1,27 @@
+import { AuthProvider } from "@/context/auth-context";
import { Stack } from "expo-router";
import { GestureHandlerRootView } from "react-native-gesture-handler";
-import { AuthProvider } from "./context/auth-context";
import "../global.css";
export default function RootLayout() {
return (
-
-
-
-
+
+
+
+
);
diff --git a/app/index.tsx b/app/index.tsx
index 7769c7d..721695a 100644
--- a/app/index.tsx
+++ b/app/index.tsx
@@ -1,7 +1,7 @@
-import React from 'react';
-import { View, ActivityIndicator } from 'react-native';
-import { Redirect } from 'expo-router';
-import { useAuth } from './context/auth-context';
+import { useAuth } from "@/context/auth-context";
+import { Redirect } from "expo-router";
+import React from "react";
+import { ActivityIndicator, View } from "react-native";
export default function Index() {
const { isAuthenticated, isLoading } = useAuth();
@@ -9,7 +9,14 @@ export default function Index() {
// Show loading indicator while checking auth status
if (isLoading) {
return (
-
+
);
@@ -21,4 +28,4 @@ export default function Index() {
} else {
return ;
}
-}
\ No newline at end of file
+}
diff --git a/app/login.tsx b/app/login.tsx
index d87cae0..f6a43b6 100644
--- a/app/login.tsx
+++ b/app/login.tsx
@@ -1,49 +1,57 @@
-import React, { useState } from 'react';
-import { View, Text, TextInput, TouchableOpacity, SafeAreaView, StatusBar, Alert } from 'react-native';
-import { router } from 'expo-router';
-import { Feather } from '@expo/vector-icons';
-import { useAuth } from './context/auth-context';
+import { useAuth } from "@/context/auth-context";
+import { Feather } from "@expo/vector-icons";
+import { router } from "expo-router";
+import React, { useState } from "react";
+import {
+ Alert,
+ SafeAreaView,
+ StatusBar,
+ Text,
+ TextInput,
+ TouchableOpacity,
+ View,
+} from "react-native";
export default function LoginScreen() {
- const [email, setEmail] = useState('');
- const [password, setPassword] = useState('');
+ const [email, setEmail] = useState("");
+ const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
-
+
const { login } = useAuth();
-
+
const handleLogin = async () => {
if (!email || !password) {
- Alert.alert('Error', 'Please fill in all fields');
+ Alert.alert("Error", "Please fill in all fields");
return;
}
-
+
try {
setIsLoading(true);
await login(email, password);
} catch (error) {
- Alert.alert('Error', 'Failed to login. Please try again.');
+ Alert.alert("Error", "Failed to login. Please try again.");
} finally {
setIsLoading(false);
}
};
-
+
return (
-
+
{/* Back Button */}
- router.back()}
>
-
+
{/* Header */}
Login to your account
-
+
{/* Form */}
@@ -57,7 +65,7 @@ export default function LoginScreen() {
autoCapitalize="none"
/>
-
+
Password
@@ -69,38 +77,44 @@ export default function LoginScreen() {
secureTextEntry={!showPassword}
autoCapitalize="none"
/>
- setShowPassword(!showPassword)}
>
-
+
-
+
- Forgot Password?
+
+ Forgot Password?
+
-
-
- {isLoading ? 'Logging in...' : 'Login'}
+ {isLoading ? "Logging in..." : "Login"}
-
+
{/* Sign Up Link */}
- Don't have an account?
- router.push('/signup')}>
+ Don't have an account?
+ router.push("/signup")}>
Sign Up
);
-}
\ No newline at end of file
+}
diff --git a/app/signup.tsx b/app/signup.tsx
index e860e13..a97d50e 100644
--- a/app/signup.tsx
+++ b/app/signup.tsx
@@ -1,57 +1,66 @@
-import React, { useState } from 'react';
-import { View, Text, TextInput, TouchableOpacity, SafeAreaView, StatusBar, Alert, ScrollView } from 'react-native';
-import { router } from 'expo-router';
-import { Feather } from '@expo/vector-icons';
-import { useAuth } from './context/auth-context';
+import { useAuth } from "@/context/auth-context";
+import { Feather } from "@expo/vector-icons";
+import { router } from "expo-router";
+import React, { useState } from "react";
+import {
+ Alert,
+ SafeAreaView,
+ ScrollView,
+ StatusBar,
+ Text,
+ TextInput,
+ TouchableOpacity,
+ View,
+} from "react-native";
export default function SignupScreen() {
- const [name, setName] = useState('');
- const [email, setEmail] = useState('');
- const [password, setPassword] = useState('');
- const [confirmPassword, setConfirmPassword] = useState('');
+ const [name, setName] = useState("");
+ const [email, setEmail] = useState("");
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
-
+
const { signup } = useAuth();
-
+
const handleSignup = async () => {
if (!name || !email || !password || !confirmPassword) {
- Alert.alert('Error', 'Please fill in all fields');
+ Alert.alert("Error", "Please fill in all fields");
return;
}
-
+
if (password !== confirmPassword) {
- Alert.alert('Error', 'Passwords do not match');
+ Alert.alert("Error", "Passwords do not match");
return;
}
-
+
try {
setIsLoading(true);
await signup(name, email, password);
} catch (error) {
- Alert.alert('Error', 'Failed to sign up. Please try again.');
+ Alert.alert("Error", "Failed to sign up. Please try again.");
} finally {
setIsLoading(false);
}
};
-
+
return (
-
+
{/* Back Button */}
- router.back()}
>
-
+
{/* Header */}
Create an account
-
+
{/* Form */}
@@ -63,7 +72,7 @@ export default function SignupScreen() {
onChangeText={setName}
/>
-
+
Email
-
+
Password
@@ -87,17 +96,23 @@ export default function SignupScreen() {
secureTextEntry={!showPassword}
autoCapitalize="none"
/>
- setShowPassword(!showPassword)}
>
-
+
-
+
- Confirm Password
+
+ Confirm Password
+
- setShowPassword(!showPassword)}
>
-
+
-
-
- {isLoading ? 'Signing up...' : 'Sign Up'}
+ {isLoading ? "Signing up..." : "Sign Up"}
-
+
{/* Login Link */}
Already have an account?
- router.push('/login')}>
+ router.push("/login")}>
Login
@@ -138,4 +157,4 @@ export default function SignupScreen() {
);
-}
\ No newline at end of file
+}
diff --git a/app/context/auth-context.tsx b/context/auth-context.tsx
similarity index 100%
rename from app/context/auth-context.tsx
rename to context/auth-context.tsx