From 9ec5755f96ab18c58da5b16bca878fe2e5ccf371 Mon Sep 17 00:00:00 2001 From: Jakob Stornig Date: Thu, 7 Dec 2023 16:54:17 +0100 Subject: [PATCH] feat: new expense navigation --- .../Windows/UUS/State/_active.uusver | 1 + app/{ => (tabs)}/_layout.tsx | 10 ++++---- app/{budget.tsx => (tabs)/budget/index.tsx} | 0 app/(tabs)/home/_layout.tsx | 16 ++++++++++++ app/(tabs)/home/addItem.tsx | 10 ++++++++ app/{ => (tabs)/home}/index.tsx | 25 +++++++++++-------- app/{stats.tsx => (tabs)/stats/index.tsx} | 0 app/index.jsx | 9 +++++++ components/common/plus/plus.tsx | 18 ++++++++----- components/common/searchBar/SearchBar.tsx | 3 +-- 10 files changed, 68 insertions(+), 24 deletions(-) create mode 100644 %ProgramData%/Microsoft/Windows/UUS/State/_active.uusver rename app/{ => (tabs)}/_layout.tsx (84%) rename app/{budget.tsx => (tabs)/budget/index.tsx} (100%) create mode 100644 app/(tabs)/home/_layout.tsx create mode 100644 app/(tabs)/home/addItem.tsx rename app/{ => (tabs)/home}/index.tsx (81%) rename app/{stats.tsx => (tabs)/stats/index.tsx} (100%) create mode 100644 app/index.jsx diff --git a/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver b/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver new file mode 100644 index 0000000..2b9ef92 --- /dev/null +++ b/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver @@ -0,0 +1 @@ +1212.2309.20012.0 \ No newline at end of file diff --git a/app/_layout.tsx b/app/(tabs)/_layout.tsx similarity index 84% rename from app/_layout.tsx rename to app/(tabs)/_layout.tsx index d6672d1..fb022e3 100644 --- a/app/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -2,7 +2,7 @@ import { Tabs } from "expo-router/tabs"; import {StyleSheet, View} from "react-native" import { FontAwesome } from "@expo/vector-icons"; -import {useThemeColor} from "../hooks/hooks"; +import {useThemeColor} from "../../hooks/hooks"; import React from "react"; export default function Layout() { @@ -28,22 +28,22 @@ export default function Layout() { } return ( - - + ( ), } }/> - ( ), } }/> - ( diff --git a/app/budget.tsx b/app/(tabs)/budget/index.tsx similarity index 100% rename from app/budget.tsx rename to app/(tabs)/budget/index.tsx diff --git a/app/(tabs)/home/_layout.tsx b/app/(tabs)/home/_layout.tsx new file mode 100644 index 0000000..a1911e5 --- /dev/null +++ b/app/(tabs)/home/_layout.tsx @@ -0,0 +1,16 @@ +import { Stack } from "expo-router"; + +import { View, Text } from 'react-native' +import React from 'react' + +export default function _Layout() { + return ( + + + + + ) +} \ No newline at end of file diff --git a/app/(tabs)/home/addItem.tsx b/app/(tabs)/home/addItem.tsx new file mode 100644 index 0000000..e9edc0b --- /dev/null +++ b/app/(tabs)/home/addItem.tsx @@ -0,0 +1,10 @@ +import { View, Text } from 'react-native' +import React from 'react' + +export default function addItem() { + return ( + + addItem + + ) +} \ No newline at end of file diff --git a/app/index.tsx b/app/(tabs)/home/index.tsx similarity index 81% rename from app/index.tsx rename to app/(tabs)/home/index.tsx index c9d4450..60a07bc 100644 --- a/app/index.tsx +++ b/app/(tabs)/home/index.tsx @@ -1,12 +1,14 @@ import { StyleSheet, View, Text, NativeSyntheticEvent, NativeScrollEvent } from 'react-native'; -import { useThemeColor } from "../hooks/hooks"; +import { useThemeColor } from "../../../hooks/hooks"; import { SafeAreaView } from 'react-native-safe-area-context' -import { ExpenseItem, Plus, Welcome, SearchBar } from '../components'; -import { FlatList, TextInput } from 'react-native-gesture-handler'; -import { useRef, useState } from 'react'; +import { ExpenseItem, Plus, Welcome, SearchBar } from '../../../components'; +import { FlatList, TextInput} from 'react-native-gesture-handler'; +import { useRef, useState, useEffect } from 'react'; import React from 'react'; +import { useRouter } from "expo-router" export default function Page() { + const router = useRouter() const [plusShow, setPlusShow] = useState(true); const prevOffset = useRef(0); @@ -23,7 +25,7 @@ export default function Page() { } }); - const profile = require("../assets/images/profile.jpg") + const profile = require("../../../assets/images/profile.jpg") const handleScroll = (event: NativeSyntheticEvent)=>{ const currentOffset = event.nativeEvent.contentOffset.y >= 0 ? event.nativeEvent.contentOffset.y : 0 @@ -50,16 +52,17 @@ export default function Page() { return ( - - {plusShow && } - {/* console.log("hello")}> */} + + {plusShow && { + router.push("/(tabs)/home/addItem") + }}/>} - console.log("hello")}> - + console.log("hello")}> + } renderItem = {({item}) => } @@ -69,7 +72,7 @@ export default function Page() { scrollEventThrottle={20} > - + ); } \ No newline at end of file diff --git a/app/stats.tsx b/app/(tabs)/stats/index.tsx similarity index 100% rename from app/stats.tsx rename to app/(tabs)/stats/index.tsx diff --git a/app/index.jsx b/app/index.jsx new file mode 100644 index 0000000..05e453f --- /dev/null +++ b/app/index.jsx @@ -0,0 +1,9 @@ +import { View, Text } from 'react-native' +import React from 'react' +import { Redirect } from 'expo-router' + +export default function index() { + return ( + + ) +} \ No newline at end of file diff --git a/components/common/plus/plus.tsx b/components/common/plus/plus.tsx index 5121ffa..27667af 100644 --- a/components/common/plus/plus.tsx +++ b/components/common/plus/plus.tsx @@ -1,13 +1,18 @@ -import { View, Text, ViewProps, StyleSheet } from 'react-native' +import { View, Text, ViewProps, StyleSheet, TouchableOpacity } from 'react-native' import { AntDesign } from '@expo/vector-icons' import React from 'react' -const Plus = (props : ViewProps) => { +type PlusProps = ViewProps & {onPress? : ()=> void | undefined} + +const Plus = (props : PlusProps) => { return ( - + + {props.children} - - + + + + ) } const style = StyleSheet.create({ @@ -22,7 +27,8 @@ const style = StyleSheet.create({ height: 60, width: 60, alignItems: 'center', - justifyContent: "center" + justifyContent: "center", + flex:1 } }) export default Plus \ No newline at end of file diff --git a/components/common/searchBar/SearchBar.tsx b/components/common/searchBar/SearchBar.tsx index 23c61cf..fa2ca15 100644 --- a/components/common/searchBar/SearchBar.tsx +++ b/components/common/searchBar/SearchBar.tsx @@ -1,6 +1,5 @@ -import { View, Text, ViewProps, StyleSheet, Button } from 'react-native' +import { View, Text, ViewProps, StyleSheet, Button, TouchableOpacity, TextInput } from 'react-native' import React from 'react' -import { TextInput, TouchableOpacity } from 'react-native-gesture-handler' import { AntDesign } from '@expo/vector-icons'; import { useThemeColor } from '../../../hooks/hooks'; import { SIZES } from '../../../constants/theme';