global provider and useAppwrite

This commit is contained in:
dimitar committed 2025-01-05 08:28:09 +01:00
1 parent 962d9c7341
commit 321032ee7b
5 files changed
+157 -9

No files matched your search

+6 -1
View File
@@ -3,6 +3,7 @@ import { useFonts } from "expo-font";
import { useEffect } from "react";
// import * as SplashScreen from "expo-splash-screen";
import "./global.css";
import GlobalProvider from "@/lib/globalProvider";
export default function RootLayout() {
const [fontLoaded] = useFonts({
@@ -19,5 +20,9 @@ export default function RootLayout() {
return null;
}
return <Stack screenOptions={{headerShown: false}}/>;
return(
<GlobalProvider>
<Stack screenOptions={{headerShown: false}}/>;
</GlobalProvider>
)
}
+12 -2
View File
@@ -1,10 +1,20 @@
import {View, Text, SafeAreaView, ScrollView, Image, TouchableOpacity} from "react-native";
import {View, Text, SafeAreaView, ScrollView, Image, TouchableOpacity, Alert} from "react-native";
import React from "react";
import images from "@/constants/images";
import icons from "@/constants/icons";
import {login} from "@/lib/appwrite";
import {useGlobalContext} from "@/lib/globalProvider";
const SignIn = () => {
const handleLogin = () => {}
const {refetch, loading, isLoggedIn} = useGlobalContext();
const handleLogin = async () => {
const result = await login();
if (result) {
console.log('logon successful');
} else {
Alert.alert('Login failed')
}
}
return (
<SafeAreaView className="bg-white h-full">
<ScrollView contentContainerClassName="h-full">