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