diff --git a/src/components/selectcity/CityStep.tsx b/src/components/selectcity/CityStep.tsx index c2d4d8e2..168642f3 100644 --- a/src/components/selectcity/CityStep.tsx +++ b/src/components/selectcity/CityStep.tsx @@ -1,4 +1,4 @@ -import { useMemo } from 'react' +import { useEffect, useMemo, useRef } from 'react' import Select from '@/components/common/inputbox/select/Select.tsx' import StepQuestion from '@/components/common/stepquestion/StepQuestion.tsx' import TextBox from '@/components/common/textBox/TextBox.tsx' @@ -13,6 +13,7 @@ const CityStep = ({ selectCity = '', onClick }: SelectCityProps) => { + const selectRef = useRef(null) const MainTitle = useMemo(() => { const { DEFAULT_TITLE, @@ -40,6 +41,12 @@ const CityStep = ({ return [PROVINCE_TEXT, CITY_TEXT, TOWN_TEXT] }, []) + useEffect(()=>{ + if(selectRef.current){ + selectRef.current.selectedIndex = 0 + } + },[currentStep]) + return ( <> @@ -85,6 +92,7 @@ const CityStep = ({ options={selectList} placeholder={SelectPlaceHolder[currentStep - 1]} onChange={(e) => onChange(e.target.value)} + ref={selectRef} />