feat: introduced Authentification Context

This commit is contained in:
Jakob Stornig 2023-12-08 14:51:05 +01:00
parent 7c9fdad01f
commit 6592864bc4
9 changed files with 215 additions and 16 deletions

View file

@ -6,10 +6,11 @@ import { FlatList, TextInput} from 'react-native-gesture-handler';
import { useRef, useState, useEffect } from 'react';
import React from 'react';
import { useRouter } from "expo-router"
import { useAuth } from '../../contexts/AuthContext';
export default function Page() {
const router = useRouter()
const {onLogout} = useAuth();
const [plusShow, setPlusShow] = useState(true);
const prevOffset = useRef(0);
const styles = StyleSheet.create({
@ -52,7 +53,7 @@ export default function Page() {
return (
<View style={{flex: 1}}>
<SafeAreaView style={{flex: 1}}>
{plusShow && <Plus onPress={()=>{
router.push("/(tabs)/home/addItem")
}}/>}
@ -61,7 +62,7 @@ export default function Page() {
data={data}
ListHeaderComponent={
<>
<Welcome name="My Dude" image={profile} onPress={()=>console.log("hello")}></Welcome>
<Welcome name="My Dude" image={profile} onPress={onLogout!}></Welcome>
<SearchBar placeholder='Type to Search...'></SearchBar>
</>
}
@ -72,7 +73,7 @@ export default function Page() {
scrollEventThrottle={20}
>
</FlatList>
</View>
</SafeAreaView>
);
}