import React, { useEffect, useRef } from 'react'; import { Animated, Keyboard, KeyboardAvoidingView, Modal, Platform, Pressable, ScrollView, StyleSheet, Text, TouchableWithoutFeedback, View, } from 'react-native'; import { useTheme, fontFamily } from '../../theme'; interface BottomSheetProps { visible: boolean; title?: string; onClose: () => void; children: React.ReactNode; } export const BottomSheet = ({ visible, title, onClose, children }: BottomSheetProps) => { const theme = useTheme(); const translateY = useRef(new Animated.Value(320)).current; useEffect(() => { Animated.timing(translateY, { toValue: visible ? 0 : 320, duration: 220, useNativeDriver: true, }).start(); }, [translateY, visible]); const handleBackdropPress = () => { Keyboard.dismiss(); onClose(); }; return ( {}}> {title ? ( {title} ) : null} {children} ); }; const styles = StyleSheet.create({ flex: { flex: 1, }, backdrop: { flex: 1, justifyContent: 'flex-end', }, sheet: { paddingHorizontal: 20, paddingTop: 14, paddingBottom: 28, gap: 12, maxHeight: '80%', }, sheetScroll: { flexGrow: 1, }, handle: { width: 42, height: 4, borderRadius: 999, alignSelf: 'center', }, title: { fontSize: 18, fontFamily: fontFamily.bold, }, });