From 369fc066288143f97aa709fcbfe61c99351745ca Mon Sep 17 00:00:00 2001 From: analuizaff Date: Tue, 23 Nov 2021 21:43:39 -0300 Subject: [PATCH] disabling users from sending pluviometer form information when there is no registered pluviometer station --- src/app/screens/SharingDataScreen.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/screens/SharingDataScreen.js b/src/app/screens/SharingDataScreen.js index 4d7f371..55b9b30 100644 --- a/src/app/screens/SharingDataScreen.js +++ b/src/app/screens/SharingDataScreen.js @@ -10,17 +10,25 @@ import colors from "../config/colors"; function SharingDataScreen({ navigation }) { const authContext = useContext(AuthContext); - const [showLog, setShowLog] = useState(false); + const [showLog, setShowLog] = useState(false); + const [showLogPluv, setShowLogPluv] = useState(false); const isRegistered = authContext.user?.username != null; - const pluviometer = authContext.user?.pluviometer; - console.log(pluviometer) + const pluviometer = authContext.user?.pluviometer ? true : false; + console.log(authContext.user?.pluviometer); const currentUser = authContext.user; return ( + etShowLogPluv(false)}//{setShowLogPluv(false), navigation.navigate("Perfil")}} + onDecline={() => setShowLogPluv(false)} + /> navigation.navigate("PluviometerSharingData", { user: currentUser })} SvgImage={assets.PluviometricDataIcon} active={isRegistered && pluviometer} - inactiveOnPress={() => setShowLog(true)} + inactiveOnPress={() => {setShowLog(!isRegistered), setShowLogPluv(!pluviometer && isRegistered)}} />