import { View, Text } from "react-native"; import React from "react"; import { useTailwind } from "tailwind-rn"; /* 参数格式: { type:"sm"|"lg", 大小 status:"online"|"offline"|"chatting", 状态 position:"absolute"|"relative", 位置(其实就是tailwind属性) } */ export default function UserStatus({ type, status, position }) { const tailwind = useTailwind(); const handleColor = () => { if (status === "online") { return { color: "#a3e635", text: "在线" }; } else if (status === "offline") { return { color: "#facc15", text: "活跃" }; } else { return { color: "#dc2626", text: "在聊" }; } }; const statusPill = handleColor(); return ( <> {type === "lg" ? ( {statusPill.text} ) : ( {statusPill.text} )} ); }