SettingScreen.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import { StackScreenProps } from '@react-navigation/stack';
  2. import * as React from 'react';
  3. import { Div, Button, Image, Text, Avatar, Icon } from 'react-native-magnus';
  4. import { ScrollView } from 'react-native-gesture-handler';
  5. import { useTranslation } from 'react-i18next';
  6. import useModel from 'flooks';
  7. import User from '../stores/User';
  8. import { alert } from '../utils/SystemUtils';
  9. export default function SettingScreen({ navigation }: StackScreenProps) {
  10. const { t } = useTranslation();
  11. const { logout } = useModel(User, []);
  12. return (
  13. <Div bg="gray100">
  14. <ScrollView
  15. contentContainerStyle={{
  16. flexGrow: 1,
  17. backgroundColor: '#f2f2f2',
  18. }}
  19. >
  20. <Button
  21. bg="white"
  22. px={12}
  23. h={52}
  24. py={0}
  25. block
  26. mt={10}
  27. rounded="none"
  28. onPress={() => {
  29. navigation.navigate('SettingSys');
  30. }}
  31. >
  32. <Div row justifyContent="space-between" flex={1}>
  33. <Text fontSize="sm">{t('tong-zhi-he-ti-shi-yin-she-zhi')}</Text>
  34. <Icon name="right" />
  35. </Div>
  36. </Button>
  37. <Button bg="white" px={12} h={52} py={0} block mt={10} rounded="none">
  38. <Div row justifyContent="space-between" flex={1}>
  39. <Text fontSize="sm">
  40. {t('ding-dong-wai-mai-qi-shou-zhu-ce-xie-yi')}
  41. </Text>
  42. <Icon name="right" />
  43. </Div>
  44. </Button>
  45. <Button bg="white" px={12} h={52} py={0} block mt={10} rounded="none">
  46. <Div row justifyContent="space-between" flex={1}>
  47. <Text fontSize="sm">
  48. {t('ding-dong-wai-mai-qi-shou-yin-si-zheng-ce')}
  49. </Text>
  50. <Icon name="right" />
  51. </Div>
  52. </Button>
  53. <Button bg="white" px={12} h={52} py={0} block mt={10} rounded="none">
  54. <Div row justifyContent="space-between" flex={1}>
  55. <Text fontSize="sm">{t('qi-shou-fu-wu-he-zuo-xie-yi')}</Text>
  56. <Icon name="right" />
  57. </Div>
  58. </Button>
  59. <Button
  60. w={112}
  61. bg="white"
  62. color="black"
  63. borderWidth={1}
  64. borderColor="yellow500"
  65. fontSize="sm"
  66. alignSelf="center"
  67. my={30}
  68. onPress={() => {
  69. alert(navigation, {
  70. msg: '确认要退出当前账号吗?',
  71. hasCancel: true,
  72. submitEvent: () => logout(),
  73. });
  74. }}
  75. >
  76. 退出当前账户
  77. </Button>
  78. </ScrollView>
  79. </Div>
  80. );
  81. }