ReacordCom.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import * as React from 'react';
  2. import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
  3. import { useTranslation } from 'react-i18next';
  4. import { FinancialType } from '../utils/MoneyUtils';
  5. export default function ReacordCom({ info }) {
  6. const { t } = useTranslation();
  7. const { name, amount, avatar, num, type, time } = info;
  8. const typeInfo = FinancialType.get(type);
  9. return (
  10. <Div
  11. bg="white"
  12. row
  13. alignItems="center"
  14. py={10}
  15. borderColor="gray100"
  16. borderBottomWidth={1}
  17. >
  18. {avatar ? (
  19. <Image w={33} h={33} rounded="circle" source={{ uri: avatar }} />
  20. ) : (
  21. <Icon
  22. w={33}
  23. h={33}
  24. name="creditcard"
  25. bg="yellow500"
  26. color="white"
  27. rounded="circle"
  28. />
  29. )}
  30. <Div flex={1} ml={5}>
  31. <Div row>
  32. <Text flex={1}>{name}</Text>
  33. <Text>
  34. {typeInfo.backMoney ? typeInfo.backMoney(amount) : amount}
  35. </Text>
  36. </Div>
  37. <Text>{time}</Text>
  38. <Text>{t(typeInfo.name)}</Text>
  39. </Div>
  40. </Div>
  41. );
  42. }