fix last issues

This commit is contained in:
Jakob Stornig 2024-01-05 21:33:13 +01:00
parent 497c556a87
commit 7dd17798c4
7 changed files with 20 additions and 17 deletions

View file

@ -1,6 +1,6 @@
import { View, Text, Alert, StyleSheet } from 'react-native'
import React, { useEffect, useState } from 'react'
import { router, useLocalSearchParams } from 'expo-router'
import { router, useLocalSearchParams, useRouter } from 'expo-router'
import useFetch from '../../../../hooks/useFetch';
import { Category, Expense } from '../../../../types/dbItems';
import { CategorySelectorModal, AutoDecimalInput, CategorySelector, TextInputBar, DateSelectorButton, RoundedButton } from '../../../../components';
@ -12,6 +12,7 @@ import { SIZES } from '../../../../constants/theme';
import { useTheme } from '../../../contexts/ThemeContext';
export default function Page() {
const router = useRouter();
const {colors} = useTheme();
const {expense} = useLocalSearchParams();
const {data, isEmptyResult} = useFetch({sql: "SELECT e.guid as e_guid, e.name as e_name, e.datetime as e_datetime, e.amount as e_amount, c.guid as c_guid, c.name as c_name, c.color as c_color FROM expense e INNER JOIN category c on e.category_guid = c.guid WHERE e.guid = ?", args: [expense]});
@ -24,6 +25,8 @@ export default function Page() {
const [datePickerShown, setDatePickerShown] = useState<boolean>(false);
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
console.log(router.canGoBack())
useEffect(()=>{
const entry = data[0];
console.log(entry)

View file

@ -21,11 +21,12 @@ const _layout = () => {
<Stack.Screen name='new'
options={{
title: "New Expense"
}}
/>
<Stack.Screen name="[expense]"
options={{
headerBackButtonMenuEnabled: true,
headerBackVisible: true,
title: "edit Expense"
}}
getId={(params) => String(Date.now())}