NewbieActivityModal.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { Image } from "expo-image";
  2. import React from "react";
  3. import {
  4. Modal,
  5. Pressable,
  6. StyleSheet,
  7. TouchableOpacity,
  8. View,
  9. } from "react-native";
  10. const POSTER_URI =
  11. "https://cdn.acetoys.cn/kai_xin_ma_te/resource/magic/award/activity_new.webp";
  12. interface Props {
  13. visible: boolean;
  14. onClose: () => void;
  15. }
  16. export function NewbieActivityModal({ visible, onClose }: Props) {
  17. return (
  18. <Modal visible={visible} transparent animationType="fade" onRequestClose={onClose}>
  19. <Pressable style={styles.overlay} onPress={onClose}>
  20. <View style={styles.wrapper}>
  21. <Image
  22. source={{ uri: POSTER_URI }}
  23. style={styles.poster}
  24. contentFit="contain"
  25. />
  26. <TouchableOpacity
  27. style={styles.closeBtn}
  28. onPress={onClose}
  29. activeOpacity={0.8}
  30. hitSlop={16}
  31. >
  32. <View style={styles.closeCircle}>
  33. <View style={[styles.closeLine, styles.closeLineA]} />
  34. <View style={[styles.closeLine, styles.closeLineB]} />
  35. </View>
  36. </TouchableOpacity>
  37. </View>
  38. </Pressable>
  39. </Modal>
  40. );
  41. }
  42. const styles = StyleSheet.create({
  43. overlay: {
  44. flex: 1,
  45. backgroundColor: "rgba(0,0,0,0.6)",
  46. justifyContent: "center",
  47. alignItems: "center",
  48. },
  49. wrapper: {
  50. alignItems: "center",
  51. },
  52. poster: {
  53. width: 275,
  54. height: 300,
  55. },
  56. closeBtn: {
  57. marginTop: 16,
  58. },
  59. closeCircle: {
  60. width: 30,
  61. height: 30,
  62. borderRadius: 15,
  63. borderWidth: 1.5,
  64. borderColor: "#fff",
  65. justifyContent: "center",
  66. alignItems: "center",
  67. },
  68. closeLine: {
  69. position: "absolute",
  70. width: 14,
  71. height: 1.5,
  72. backgroundColor: "#fff",
  73. },
  74. closeLineA: {
  75. transform: [{ rotate: "45deg" }],
  76. },
  77. closeLineB: {
  78. transform: [{ rotate: "-45deg" }],
  79. },
  80. });