feat: profile and greetings

This commit is contained in:
Jakob Stornig 2023-12-05 14:48:32 +01:00
parent 83541339e9
commit 498c1d8563
5 changed files with 83 additions and 5 deletions

View file

@ -1,9 +1,9 @@
import { StyleSheet, View, Text, NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
import { StyleSheet, View, Text, NativeSyntheticEvent, NativeScrollEvent, SafeAreaView } from 'react-native';
import { useThemeColor } from "../hooks/hooks";
import { SafeAreaView } from 'react-native-safe-area-context';
import { ExpenseItem, Plus } from '../components';
import { ExpenseItem, Plus, Welcome } from '../components';
import { FlatList } from 'react-native-gesture-handler';
import { useRef, useState } from 'react';
import React from 'react';
export default function Page() {
@ -22,6 +22,8 @@ export default function Page() {
}
});
const profile = require("../assets/images/profile.jpg")
const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>)=>{
const currentOffset = event.nativeEvent.contentOffset.y >= 0 ? event.nativeEvent.contentOffset.y : 0
const isScrollingUp : boolean = currentOffset <= prevOffset.current;
@ -47,8 +49,10 @@ export default function Page() {
return (
<SafeAreaView>
<SafeAreaView style={{flex: 1}}>
{plusShow && <Plus/>}
<Welcome name="My User" image={profile} onPress={()=>console.log("hello")}></Welcome>
<FlatList
data={data}
renderItem = {({item}) => <ExpenseItem category={item.category} color={item.color} date={item.date} title={item.title} value={item.value}/>}
@ -56,6 +60,7 @@ export default function Page() {
ItemSeparatorComponent={()=><View style={{marginVertical: 5}}></View>}
onScroll={handleScroll}
scrollEventThrottle={20}
style={{paddingBottom: 5}}
>
</FlatList>