AlertModalScreen.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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, dangers } = 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
  23. fontSize="md"
  24. color={dangers ? 'red500' : 'black'}
  25. p={10}
  26. textAlign="center"
  27. >
  28. {msg}
  29. </Text>
  30. <Div row py={10} mt={10}>
  31. <Button
  32. flex={1}
  33. mx={3}
  34. rounded="xs"
  35. bg="white"
  36. color="black"
  37. borderWidth={1}
  38. borderColor="yellow500"
  39. fontSize="sm"
  40. onPress={() => navigation.goBack()}
  41. >
  42. {hasCancel ? t('qu-xiao') : submitText || t('que-ren')}
  43. </Button>
  44. <Button
  45. flex={1}
  46. mx={3}
  47. rounded="xs"
  48. bg="yellow500"
  49. fontSize="sm"
  50. onPress={() => {
  51. if (submitEvent) {
  52. submitEvent();
  53. }
  54. navigation.goBack();
  55. }}
  56. >
  57. {submitText || t('que-ren')}
  58. </Button>
  59. </Div>
  60. </Div>
  61. </Animatable.View>
  62. </Div>
  63. );
  64. }