import React from "react"; import { View, Text, TouchableOpacity, StyleSheet, Modal, Linking } from "react-native"; import { useTranslation } from "react-i18next"; import pxToDp from "../helper/pxToDp"; interface UpdateModalProps { visible: boolean; updateInfo: { latestVersion: string; downloadUrl: string; updateLogs: string[]; } | null; currentVersion: string; onClose: () => void; } export default function UpdateModal({ visible, updateInfo, currentVersion, onClose }: UpdateModalProps) { const { t } = useTranslation(); const handleUpdatePress = () => { if (updateInfo?.downloadUrl) { Linking.openURL(updateInfo.downloadUrl); } }; if (!updateInfo) return null; return ( {t("home.updateTitle")} {t("home.latestVersion")}: {updateInfo.latestVersion} {t("home.currentVersion")}: {currentVersion} {t("home.updateLogs")} {updateInfo.updateLogs.map((log, index) => ( • {log} ))} {t("home.updateNow")} {/* {t("home.updateLater")} */} ); } const styles = StyleSheet.create({ modalOverlay: { flex: 1, backgroundColor: "rgba(0, 0, 0, 0.5)", justifyContent: "center", alignItems: "center", }, modalContent: { width: pxToDp(600), backgroundColor: "#fff", borderRadius: pxToDp(20), padding: pxToDp(40), alignItems: "center", }, modalTitle: { fontSize: pxToDp(36), fontWeight: "bold", color: "#333", marginBottom: pxToDp(20), }, modalVersion: { fontSize: pxToDp(28), color: "#666", marginBottom: pxToDp(10), }, updateLogsContainer: { width: "100%", marginTop: pxToDp(20), marginBottom: pxToDp(20), paddingHorizontal: pxToDp(10), maxHeight: pxToDp(300), }, updateLogsTitle: { fontSize: pxToDp(28), fontWeight: "bold", color: "#333", marginBottom: pxToDp(10), }, updateLogItem: { fontSize: pxToDp(24), color: "#666", lineHeight: pxToDp(40), }, updateButton: { width: "100%", backgroundColor: "#E7141E", borderRadius: pxToDp(12), padding: pxToDp(24), alignItems: "center", // marginBottom: pxToDp(20), }, updateButtonText: { fontSize: pxToDp(32), fontWeight: "bold", color: "#fff", }, laterButton: { padding: pxToDp(20), }, laterButtonText: { fontSize: pxToDp(28), color: "#999", }, });