import React, { useMemo, useRef, useCallback, useEffect } from 'react'; import { View, Text, TouchableOpacity, StyleSheet, Dimensions, // Add this } from 'react-native'; import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet'; import type { BottomSheetBackdropProps } from '@gorhom/bottom-sheet'; import {trigger as hapticFeedback} from "react-native-haptic-feedback"; import { COLORS } from './util/Colors'; const SCREEN_HEIGHT = Dimensions.get('window').height; // Add this export type AddGeofenceType = 'circular' | 'polygon' | 'cancel'; interface Props { visible: boolean; onClose: () => void; onSelect: (type: AddGeofenceType) => void; } const AddGeofenceTypeSheet: React.FC = ({ visible, onClose, onSelect }) => { const bottomSheetRef = useRef(null); const snapPoints = useMemo(() => ['40%'], []); // Try percentage like you originally had useEffect(() => { if (visible) { bottomSheetRef.current?.present(); } else { bottomSheetRef.current?.dismiss(); } }, [visible]); const renderBackdrop = useCallback( (props: BottomSheetBackdropProps) => ( ), [onClose] ); const handleSelect = (type: AddGeofenceType) => { hapticFeedback('impactMedium', {}); onSelect(type); }; if (!visible) return null; return ( Add Geofence handleSelect('circular')} > Circular handleSelect('polygon')} > Polygon handleSelect('cancel')} > Cancel ); }; const styles = StyleSheet.create({ bottomSheetBackground: { backgroundColor: '#F5F5F5', borderTopLeftRadius: 20, borderTopRightRadius: 20, }, contentContainer: { zIndex: 999, paddingBottom: 50, flex: 1 }, handleIndicator: { backgroundColor: '#CCCCCC', width: 40, height: 5, }, header: { paddingHorizontal: 20, paddingTop: 10, paddingBottom: 15, }, title: { fontSize: 24, fontWeight: '700', color: '#000000', }, content: { backgroundColor: '#FFFFFF', marginHorizontal: 16, borderRadius: 12, overflow: 'hidden', }, option: { paddingHorizontal: 16, paddingVertical: 14, }, optionText: { fontSize: 16, color: COLORS.black, }, cancelOption: { borderTopWidth: 1, borderTopColor: '#E6E6E6', }, cancelText: { fontSize: 16, fontWeight: '600', color: COLORS.black, }, }); export default AddGeofenceTypeSheet;