1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import React, { useEffect } from 'react';
- import { StyleSheet, Text, View, TextInput, Pressable } from 'react-native';
- import DepenseForm from './depense_edit/depense_form';
-
-
- export default function DepenseListEntry(props){
- const [editing, toggleEdit] = React.useState(false);
-
-
- return(<View style={depense_list_entry_style.depense_list_entry}>
- <Pressable
- onPress={() => {
- toggleEdit(!editing);
- console.log(props.depense);
- }}
- style={depense_list_entry_style.pressable_depense_list_entry}>
- <Text >{props.depense.description}</Text>
- <Text >{new Date(props.depense.date).toDateString()}</Text>
- <Text >{props.depense.value}</Text>
- </Pressable>
- {editing ?
- <DepenseForm fetchDepenses={props.fetchDepenses} onUpdateDepense={(res) => {toggleEdit(res)}} depense={props.depense}/> :
- <View/>
- }
-
- </View>
- )
- }
-
- const depense_list_entry_style = StyleSheet.create({
- depense_list_entry: {
- borderBottomWidth: 0.5
- },
- pressable_depense_list_entry: {
- display: "flex",
- flexDirection: "row",
- justifyContent: "space-between",
- margin: 2,
-
- }
- });
|