AlertModalScreen.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { StackScreenProps } from '@react-navigation/stack';
  2. import * as React from 'react';
  3. import * as Animatable from 'react-native-animatable';
  4. import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
  5. import { ScrollView } from 'react-native-gesture-handler';
  6. import { useTranslation } from 'react-i18next';
  7. import { RootStackParamList } from '../types';
  8. export default function AlertModalScreen({
  9. navigation,
  10. route,
  11. }: StackScreenProps<RootStackParamList, 'AlertModal'>) {
  12. const { params } = route;
  13. const { title, msg, hasCancel, submitText, submitEvent } = params;
  14. const { t } = useTranslation();
  15. return (
  16. <Div flex={1} bg="black600" alignItems="center" justifyContent="center">
  17. <Animatable.View animation="slideInUp" duration={300}>
  18. <Div bg="white" p={10} rounded="sm" minW={287}>
  19. <Text fontSize="lg" textAlign="center">
  20. {title || t('ti-shi')}
  21. </Text>
  22. <Text fontSize="md" p={10} textAlign="center">
  23. {msg}
  24. </Text>
  25. <Div row py={10} mt={10}>
  26. <Button
  27. flex={1}
  28. mx={3}
  29. rounded="xs"
  30. bg="white"
  31. color="black"
  32. borderWidth={1}
  33. borderColor="yellow500"
  34. fontSize="sm"
  35. onPress={() => navigation.goBack()}
  36. >
  37. {hasCancel ? t('qu-xiao') : submitText || t('que-ren')}
  38. </Button>
  39. <Button
  40. flex={1}
  41. mx={3}
  42. rounded="xs"
  43. bg="yellow500"
  44. fontSize="sm"
  45. onPress={() => {
  46. if (submitEvent) {
  47. submitEvent();
  48. }
  49. navigation.goBack();
  50. }}
  51. >
  52. {submitText || t('que-ren')}
  53. </Button>
  54. </Div>
  55. </Div>
  56. </Animatable.View>
  57. </Div>
  58. );
  59. }