"use client" /* * File: HospitalSelectionScreen.tsx * Description: Hospital selection screen with dropdown using react-native-element-dropdown. * Design & Developed by Tech4Biz Solutions * Copyright (c) Spurrin Innovations. All rights reserved. */ import type React from "react" import { useState } from "react" import { View, Text, StyleSheet, TouchableWithoutFeedback, Keyboard } from "react-native" import { Dropdown } from "react-native-element-dropdown" import { Button } from "../../../../shared/src/components/Button" import { Colors, Spacing, Typography } from "../../../../shared/src/theme" import { showError } from "../../../../shared/src/utils/helpers/Toast" import Icon from "react-native-vector-icons/Feather" import OnboardingContainer from "./OnboardingContainer" import { selectHospitals } from "../redux" import { useSelector } from "react-redux" interface HospitalSelectionScreenProps { onContinue: (hospitalId: string) => void onBack: () => void } const hospitalData = [ { label: "City General Hospital", value: "city_general" }, { label: "St. Mary's Medical Center", value: "st_marys" }, { label: "University Hospital", value: "university" }, { label: "Regional Medical Center", value: "regional" }, { label: "Metropolitan Hospital", value: "metropolitan" }, { label: "Community Health Center", value: "community" }, { label: "Children's Hospital", value: "childrens" }, { label: "Veterans Medical Center", value: "veterans" }, ] const HospitalSelectionScreen: React.FC = ({ onContinue, onBack }) => { const [selectedHospital, setSelectedHospital] = useState(null) const [loading, setLoading] = useState(false) const [isFocus, setIsFocus] = useState(false) const hospitals :any=useSelector(selectHospitals) const handleContinue = () => { if (!selectedHospital) { showError("Validation Error", "Please select a hospital to continue.") return } setLoading(true) setTimeout(() => { setLoading(false) onContinue(selectedHospital) }, 1000) } const renderLabel = () => { if (selectedHospital || isFocus) { return Select Hospital } return null } return ( {/* */} Select Hospital Choose the hospital you're affiliated with. {renderLabel()} setIsFocus(true)} onBlur={() => setIsFocus(false)} onChange={(item) => { console.log('item',item) setSelectedHospital(item.hospital_id) setIsFocus(false) }} renderLeftIcon={() => ( )} />