CatchRuleModal.tsx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { Images } from '@/constants/images';
  2. import { ImageBackground } from 'expo-image';
  3. import React, { forwardRef, useImperativeHandle, useState } from 'react';
  4. import { Image, Modal, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
  5. export interface CatchRuleModalRef {
  6. show: () => void;
  7. close: () => void;
  8. }
  9. export const CatchRuleModal = forwardRef<CatchRuleModalRef>((_, ref) => {
  10. const [visible, setVisible] = useState(false);
  11. useImperativeHandle(ref, () => ({
  12. show: () => setVisible(true),
  13. close: () => setVisible(false),
  14. }));
  15. if (!visible) return null;
  16. return (
  17. <Modal visible={visible} transparent animationType="fade" onRequestClose={() => setVisible(false)}>
  18. <View style={styles.overlay}>
  19. <View style={styles.contentContainer}>
  20. <ImageBackground
  21. source={{ uri: Images.welfare.qijiWelfareDollRule }}
  22. style={styles.bgContainer}
  23. resizeMode="stretch"
  24. >
  25. <View style={styles.titleContainer}>
  26. <Text style={styles.title}>扭蛋机 玩法规则</Text>
  27. </View>
  28. <View style={styles.textContent}>
  29. <Text style={styles.textTitle}>扭蛋机规则</Text>
  30. <Text style={styles.text}>一个源力币可以扭动一次旋钮,按照需求可选择“扭一次”或“扭五次”,扭动后随机掉落捣蛋机内物品。</Text>
  31. <Text style={styles.textTitle}>源力币获取途径</Text>
  32. <Text style={styles.text}>在宝箱中购买超神或欧皇款后,系统自动发放源力市。</Text>
  33. <Text style={styles.text}>(超神款2个,欧皇款1个)</Text>
  34. <Text style={[styles.text, { marginTop: 10, color: '#999', fontSize: 10 }]}>特别声明:扭蛋机及相关福利活动由艾斯潮盒官方发起,与苹果公司(Apple Inc.)无关。苹果不是赞助商,也没有以任何形式参与。</Text>
  35. </View>
  36. </ImageBackground>
  37. <TouchableOpacity onPress={() => setVisible(false)} style={styles.closeBtn}>
  38. <Image source={{ uri: Images.mine.dialogClose }} style={styles.closeIcon} />
  39. </TouchableOpacity>
  40. </View>
  41. </View>
  42. </Modal>
  43. );
  44. });
  45. const styles = StyleSheet.create({
  46. overlay: {
  47. flex: 1,
  48. backgroundColor: 'rgba(0,0,0,0.6)',
  49. justifyContent: 'center',
  50. alignItems: 'center',
  51. },
  52. contentContainer: {
  53. width: '100%',
  54. alignItems: 'center',
  55. },
  56. bgContainer: {
  57. width: 357, // 714rpx
  58. height: 290, // adjusted for disclaimer
  59. paddingTop: 32, // 64rpx
  60. alignItems: 'center',
  61. },
  62. titleContainer: {
  63. alignItems: 'center',
  64. marginBottom: 10,
  65. },
  66. title: {
  67. fontSize: 18,
  68. fontWeight: 'bold',
  69. color: 'rgba(255,255,255,0.68)',
  70. textShadowColor: '#07004A',
  71. textShadowOffset: { width: 1, height: 1 },
  72. textShadowRadius: 1,
  73. },
  74. textContent: {
  75. paddingHorizontal: 15,
  76. marginTop: 10,
  77. width: '100%',
  78. },
  79. textTitle: {
  80. textAlign: 'center',
  81. fontSize: 16,
  82. fontWeight: 'bold',
  83. color: '#000',
  84. marginVertical: 5,
  85. },
  86. text: {
  87. fontSize: 12,
  88. color: '#000',
  89. lineHeight: 18,
  90. marginBottom: 4,
  91. },
  92. closeBtn: {
  93. marginTop: 20,
  94. },
  95. closeIcon: {
  96. width: 30,
  97. height: 30,
  98. }
  99. });