feat: amountField

This commit is contained in:
Jakob Stornig 2024-01-02 18:23:57 +01:00
parent 0ea9acde38
commit 93d16fc08a
6 changed files with 134 additions and 17 deletions

View file

@ -25,6 +25,7 @@ export default function Layout() {
tabBarInactiveTintColor: colors.tabIconDefault,
headerShown: false,
tabBarStyle: styles.tabBar,
tabBarHideOnKeyboard: true
}
if(!authState?.authenticated){

View file

@ -24,7 +24,9 @@ export default function _Layout() {
title: "test",
headerShown: false,
}}/>
<Stack.Screen name="addItem"/>
<Stack.Screen name="addItem" options={{
title: "new Expense",
}}/>
<Stack.Screen name="userSettings" options={{
animation: "slide_from_left",
title: "User Settings",

View file

@ -1,10 +1,26 @@
import { View, Text } from 'react-native'
import React from 'react'
import { View, Text, StyleSheet, TextInput, NativeSyntheticEvent, TextInputKeyPressEventData, TouchableOpacity } from 'react-native'
import React, { useRef, useState } from 'react'
import { SIZES } from '../../../constants/theme'
import { useTheme } from '../../contexts/ThemeContext'
import { AutoDecimalInput } from '../../../components'
export default function addItem() {
export default function AddItem() {
const value = useRef<string>("");
const [formatedValue, setFormatedValue] = useState<string>("");
const handleValueChange = (formatedValue: string) => {
setFormatedValue(formatedValue);
}
console.log(formatedValue)
return (
<View>
<Text>addItem</Text>
<View style={styles.container}>
<AutoDecimalInput onValueChange={handleValueChange} label='Amount'></AutoDecimalInput>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
margin: SIZES.normal,
}
})

View file

@ -74,15 +74,15 @@ export default function Page() {
return (
<SafeAreaView edges={["left", "right", "top"]} style={[styles.safeAreaViewStyle, {backgroundColor: colors.containerColor}]}>
{plusShow && <Plus onPress={()=>{
// router.push("/(tabs)/home/addItem");
router.push("/(tabs)/home/addItem");
executeQuery({sql: "SELECT guid FROM category", args: []}).then((result) => {
if("rows" in result[0]) {
newExpense("Test Title", result[0]["rows"][0]["guid"], "69.69.1234", 100).then(() => {
reFetch();
});
}
})
// executeQuery({sql: "SELECT guid FROM category", args: []}).then((result) => {
// if("rows" in result[0]) {
// newExpense("Test Title", result[0]["rows"][0]["guid"], "69.69.1234", 100).then(() => {
// reFetch();
// });
// }
// })
}}/>}
{isLoading && <LoadingSymbol/>}