From 0bd6188a20766638989918ad39bc95ef09f2bc2c Mon Sep 17 00:00:00 2001 From: bobmw Date: Mon, 29 Apr 2024 15:43:29 -0300 Subject: [PATCH] feat(RegisterScreen): set institutions filter by UF, City and Type --- src/app/screens/RegisterScreen.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/screens/RegisterScreen.js b/src/app/screens/RegisterScreen.js index cb9d233..89deee8 100644 --- a/src/app/screens/RegisterScreen.js +++ b/src/app/screens/RegisterScreen.js @@ -190,6 +190,7 @@ function CityPicker({ name }) { function InstitutionNamePicker({ name }) { const { values } = useFormikContext(); const state = values["state"]; + const city = values["city"]; const instType = values["institution"]; const [items, setItems] = useState([]); const [institutions, setInstitutions] = useState([]); @@ -205,14 +206,14 @@ function InstitutionNamePicker({ name }) { useEffect(() => { try { - if (state && instType) { - const insts = institutions[state] && institutions[state][instType]; + if (state && city && instType) { + const insts = institutions[state] && institutions[state][city] && institutions[state][city][instType]; insts ? setItems(insts) : setItems([]); } } catch (e) { console.log(e); } - }, [state, instType]); + }, [state,city, instType, institutions]); return ( @@ -384,7 +385,6 @@ export default function RegisterScreen(props) { }; const copnfirmations = (form, actions) => { - console.log(form); var current_mask = form.number.length >= 11 ? "(99) 99999-9999" : "(99) 9999-9999";