import { TouchableOpacity, View, ViewProps } from "react-native"; import { Text } from "@/components/common/Text"; import { tc } from "@/utils/textTools"; import { useState } from "react"; interface Props extends ViewProps { text?: string | null; } const LIMIT = 140; export const OverviewText: React.FC = ({ text, ...props }) => { const [limit, setLimit] = useState(LIMIT); if (!text) return null; if (text.length > LIMIT) return ( setLimit((prev) => (prev === LIMIT ? text.length : LIMIT)) } > {tc(text, limit)} {limit === LIMIT ? "Show more" : "Show less"} ); return ( {text} ); };