|
@ -89,12 +89,20 @@ function MaterialCommunityIconsCustom({ |
|
|
|
|
|
|
|
|
function CityPicker({ name }) { |
|
|
function CityPicker({ name }) { |
|
|
const [items, setItems] = useState([]); |
|
|
const [items, setItems] = useState([]); |
|
|
|
|
|
const [isInitialRender, setIsInitialRender] = useState(true); |
|
|
|
|
|
|
|
|
const { values, setValues } = useFormikContext(); |
|
|
const { values, setValues } = useFormikContext(); |
|
|
|
|
|
|
|
|
const state = values["state"]; |
|
|
const state = values["state"]; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
|
|
|
if (isInitialRender) { |
|
|
|
|
|
state && setItems(statesToCities[state].cities); |
|
|
|
|
|
setIsInitialRender(false); |
|
|
|
|
|
} else { |
|
|
state && setItems(statesToCities[state].cities); |
|
|
state && setItems(statesToCities[state].cities); |
|
|
setValues({ ...values, city: "" }); |
|
|
setValues({ ...values, city: "" }); |
|
|
|
|
|
} |
|
|
}, [state]); |
|
|
}, [state]); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|