You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

depense_list_entry.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { useEffect } from 'react';
  2. import { StyleSheet, Text, View, TextInput, Pressable } from 'react-native';
  3. import DepenseForm from './depense_edit/depense_form';
  4. export default function DepenseListEntry(props){
  5. const [editing, toggleEdit] = React.useState(false);
  6. return(<View style={depense_list_entry_style.depense_list_entry}>
  7. <Pressable
  8. onPress={() => {
  9. toggleEdit(!editing);
  10. }}
  11. style={depense_list_entry_style.pressable_depense_list_entry}>
  12. <Text style={depense_list_entry_style.depense_info}>{props.depense.description}</Text>
  13. {/* <Text >{new Date(props.depense.date).toDateString()}</Text> */}
  14. <Text style={depense_list_entry_style.depense_info}>{props.depense.value}</Text>
  15. </Pressable>
  16. {editing ?
  17. <DepenseForm fetchDepenses={props.fetchDepenses} onUpdateDepense={(res) => {toggleEdit(res)}} depense={props.depense}/> :
  18. <View/>
  19. }
  20. </View>
  21. )
  22. }
  23. const depense_list_entry_style = StyleSheet.create({
  24. depense_list_entry: {
  25. borderBottomWidth: 0.5
  26. },
  27. pressable_depense_list_entry: {
  28. display: "flex",
  29. flexDirection: "row",
  30. justifyContent: "space-evenly",
  31. margin: 2,
  32. },
  33. depense_info: {
  34. paddingLeft: 50,
  35. paddingRight: 50,
  36. width: 200,
  37. }
  38. });