|
|
@ -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 ( |
|
|
|
<View style={styles.container}> |
|
|
|
<ConfirmationModal |
|
|
|
show={showLogPluv} |
|
|
|
description="Para enviar uma informação pluviométrica cadastre um pluviômetro" |
|
|
|
confirmationLabel="OK" |
|
|
|
onConfirm={() => etShowLogPluv(false)}//{setShowLogPluv(false), navigation.navigate("Perfil")}}
|
|
|
|
onDecline={() => setShowLogPluv(false)} |
|
|
|
/> |
|
|
|
<ConfirmationModal |
|
|
|
show={showLog} |
|
|
|
description="Para enviar uma informação faça o login ou cadastre-se" |
|
|
@ -71,7 +79,7 @@ function SharingDataScreen({ navigation }) { |
|
|
|
onPress={() => navigation.navigate("PluviometerSharingData", { user: currentUser })} |
|
|
|
SvgImage={assets.PluviometricDataIcon} |
|
|
|
active={isRegistered && pluviometer} |
|
|
|
inactiveOnPress={() => setShowLog(true)} |
|
|
|
inactiveOnPress={() => {setShowLog(!isRegistered), setShowLogPluv(!pluviometer && isRegistered)}} |
|
|
|
/> |
|
|
|
|
|
|
|
<SvgLabeledButton |
|
|
|