import { SymbolView } from 'expo-symbols'; import { PropsWithChildren, useState } from 'react'; import { Pressable, StyleSheet } from 'react-native'; import Animated, { FadeIn } from 'react-native-reanimated'; import { ThemedText } from '@/components/themed-text'; import { ThemedView } from '@/components/themed-view'; import { Spacing } from '@/constants/theme'; import { useTheme } from '@/hooks/use-theme'; export function Collapsible({ children, title }: PropsWithChildren & { title: string }) { const [isOpen, setIsOpen] = useState(false); const theme = useTheme(); return ( [styles.heading, pressed && styles.pressedHeading]} onPress={() => setIsOpen((value) => !value)}> {title} {isOpen && ( {children} )} ); } const styles = StyleSheet.create({ heading: { flexDirection: 'row', alignItems: 'center', gap: Spacing.two, }, pressedHeading: { opacity: 0.7, }, button: { width: Spacing.four, height: Spacing.four, borderRadius: 12, justifyContent: 'center', alignItems: 'center', }, content: { marginTop: Spacing.three, borderRadius: Spacing.three, marginLeft: Spacing.four, padding: Spacing.four, }, });