import { Images } from '@/constants/images'; import React, { forwardRef, useImperativeHandle, useState } from 'react'; import { Image, Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; export interface DollPrizeModalRef { show: (data: any[]) => void; close: () => void; } export const DollPrizeModal = forwardRef((_, ref) => { const [visible, setVisible] = useState(false); const [prizeList, setPrizeList] = useState([]); useImperativeHandle(ref, () => ({ show: (data) => { setPrizeList(data); setVisible(true); }, close: () => setVisible(false), })); if (!visible) return null; return ( setVisible(false)}> setVisible(false)} /> {prizeList.map((item, index) => ( {item.name} ))} setVisible(false)} style={styles.closeBtn}> ); }); const styles = StyleSheet.create({ overlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.6)', justifyContent: 'center', alignItems: 'center', }, mask: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, }, contentContainer: { width: '100%', alignItems: 'center', }, wrapper: { width: 326, // 652rpx height: 452, // 904rpx position: 'relative', alignItems: 'center', }, ruleBg: { width: '100%', height: '100%', position: 'absolute', }, prizeContainer: { position: 'absolute', top: 78.5, // 157rpx left: 27, // 54rpx right: 27, // 54rpx height: 357.5, // 715rpx width: 272, // 544rpx }, scrollContent: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', }, prizeItem: { width: 80, // 160rpx height: 116.5, // 233rpx marginRight: 10, // 20rpx marginTop: 11.5, // 23rpx alignItems: 'center', }, noRightMargin: { marginRight: 0, }, prizeImgBox: { width: 80, // 160rpx height: 100, // 200rpx justifyContent: 'center', alignItems: 'center', }, prizeImg: { width: '100%', height: '100%', }, prizeText: { color: '#B58100', marginTop: 6, textAlign: 'center', fontSize: 12, width: '100%', }, closeBtn: { marginTop: 15, }, closeIcon: { width: 30, // 60rpx height: 30, } });