您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

depenses_list.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { useEffect } from 'react';
  2. import { StyleSheet, Text, View, TextInput } from 'react-native';
  3. import { sqlite_exec_query } from '../db/query';
  4. function DepensesList(props)
  5. {
  6. const [depenses, onGetDepenses] = React.useState([]);
  7. useEffect( () => {
  8. sqlite_exec_query("select * from expense", (res) => {
  9. onGetDepenses(res.rows._array);
  10. })
  11. });
  12. let content = []
  13. depenses
  14. .sort((a,b) => (a.date > b.date) ? -1 : (b.date > a.date) ? 1 : 0)
  15. .forEach( function(depense){
  16. content.push(
  17. <View key={"depense_list_depense"+depense.id} style={depense_list_style.depense_list_entry}>
  18. <Text >{depense.description}</Text>
  19. <Text >{depense.value}</Text>
  20. </View>
  21. )
  22. });
  23. return(
  24. <View>
  25. {content}
  26. </View>
  27. )
  28. }
  29. const depense_list_style = StyleSheet.create({
  30. depense_list_entry: {
  31. display: "flex",
  32. flexDirection: "row",
  33. justifyContent: "space-between",
  34. // flex: 1,
  35. // backgroundColor: '#00FF00',
  36. // alignItems: 'center',
  37. // justifyContent: 'center',
  38. }
  39. });
  40. export default DepensesList