import { Steps } from '@/app/(tabs)/user-message'; import { ThemedText } from '@/components/ThemedText'; import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Image, Modal, SafeAreaView, StyleSheet, TouchableOpacity, TouchableWithoutFeedback, View } from 'react-native'; import { SafeAreaProvider } from 'react-native-safe-area-context'; import FileUploader, { FileStatus } from '../file-upload/file-uploader'; interface Props { setSteps?: (steps: Steps) => void; fileData: FileStatus[]; setFileData: (fileData: FileStatus[]) => void; isLoading: boolean; handleUser: () => void; avatar: string; } export default function Look({ fileData, setFileData, isLoading, handleUser, avatar }: Props) { const [isModalVisible, setIsModalVisible] = useState(false); const { t } = useTranslation(); return ( {t('auth.userMessage.look', { ns: 'login' })} {t('auth.userMessage.avatarText', { ns: 'login' })}
{t('auth.userMessage.avatorText2', { ns: 'login' })}
{ fileData?.[0]?.thumbnailUrl ? : avatar ? : } { setIsModalVisible(true) }} > {t('auth.userMessage.choosePhoto', { ns: 'login' })} {/* 上传弹窗 */} { setIsModalVisible(false); }} > setIsModalVisible(false)}> {t('auth.userMessage.choosePhoto', { ns: 'login' })} { setFileData(file); setIsModalVisible(false); }} allowedFileTypes={["image/png", "image/jpeg", "image/webp"]} maxFileSize={1024 * 1024 * 10} className="w-full" />
{/* Continue Button */} {t('auth.userMessage.next', { ns: 'login' })}
); } const styles = StyleSheet.create({ image: { width: 215, height: 215, borderRadius: 107.5, }, centeredView: { flex: 1, }, modalOverlay: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'rgba(0, 0, 0, 0.5)', }, modalOverlayTouchable: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, }, modalContent: { width: '90%', maxWidth: 400, backgroundColor: 'white', borderRadius: 12, padding: 20, shadowColor: '#000', shadowOffset: { width: 0, height: 2, }, shadowOpacity: 0.25, shadowRadius: 4, elevation: 5, }, modalTitle: { fontSize: 18, fontWeight: 'bold', marginBottom: 15, textAlign: 'center', }, // ... 其他样式保持不变 });