import { useLocalSearchParams } from 'expo-router'; import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; import { useCreateReservation } from '@/features/reservations/hooks/useCreateReservation'; export default function CreateReservationScreen() { const params = useLocalSearchParams<{ officeId?: string; officeName?: string; }>(); const officeId = typeof params.officeId === 'string' ? params.officeId : undefined; const officeName = typeof params.officeName === 'string' ? params.officeName : undefined; const { date, startTime, endTime, isSubmitting, error, successMessage, setDate, setStartTime, setEndTime, submit, } = useCreateReservation({ officeId, officeName }); return ( Crear reserva Espacio {officeName ?? 'No indicado'} ID oficina {officeId ?? 'No indicado'} {error ? {error} : null} {successMessage ? {successMessage} : null} {isSubmitting ? 'Guardando...' : 'Guardar reserva'} ); } const styles = StyleSheet.create({ container: { flex: 1, padding: 16, gap: 12, }, title: { fontSize: 28, fontWeight: '700', marginBottom: 8, }, infoBox: { borderWidth: 1, borderColor: '#ddd', borderRadius: 12, padding: 12, gap: 6, marginBottom: 8, }, label: { fontSize: 14, fontWeight: '700', color: '#444', }, value: { fontSize: 16, color: '#111', }, input: { borderWidth: 1, borderColor: '#ccc', borderRadius: 10, paddingHorizontal: 14, paddingVertical: 12, }, button: { backgroundColor: '#1f6feb', paddingVertical: 14, borderRadius: 10, alignItems: 'center', marginTop: 8, }, buttonText: { color: '#fff', fontWeight: '600', }, error: { color: 'red', }, success: { color: 'green', }, });