|
@ -1,15 +1,27 @@ |
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
|
|
|
|
|
import React, { useEffect, useState, useContext } from "react"; |
|
|
import { StyleSheet, View } from "react-native"; |
|
|
import { StyleSheet, View } from "react-native"; |
|
|
|
|
|
|
|
|
|
|
|
import ConfirmationModal from "../components/ConfirmationModal"; |
|
|
import { ScrollView } from "react-native"; |
|
|
import { ScrollView } from "react-native"; |
|
|
import assets from "../config/assets"; |
|
|
import assets from "../config/assets"; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
import SvgLabeledButton from "../components/SvgLabeledButton"; |
|
|
import SvgLabeledButton from "../components/SvgLabeledButton"; |
|
|
|
|
|
import { AuthContext } from "../auth/context"; |
|
|
|
|
|
|
|
|
function SharingDataScreen({ navigation }) { |
|
|
function SharingDataScreen({ navigation }) { |
|
|
|
|
|
const authContext = useContext(AuthContext); |
|
|
|
|
|
const [showLog, setShowLog] = useState(false); |
|
|
|
|
|
|
|
|
|
|
|
const isRegistered = authContext.user?.username != null; |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<View style={styles.container}> |
|
|
<View style={styles.container}> |
|
|
|
|
|
<ConfirmationModal |
|
|
|
|
|
show={showLog} |
|
|
|
|
|
description="Para enviar uma informação faça o login ou cadastre-se" |
|
|
|
|
|
confirmationLabel="LOGIN" |
|
|
|
|
|
onConfirm={() => authContext.setUser(false)} |
|
|
|
|
|
onDecline={() => setShowLog(false)} |
|
|
|
|
|
/> |
|
|
<ScrollView> |
|
|
<ScrollView> |
|
|
<View |
|
|
<View |
|
|
style={{ |
|
|
style={{ |
|
@ -21,16 +33,19 @@ function SharingDataScreen({ navigation }) { |
|
|
> |
|
|
> |
|
|
<SvgLabeledButton |
|
|
<SvgLabeledButton |
|
|
label={"ÁREA DE \nALAGAMENTO"} |
|
|
label={"ÁREA DE \nALAGAMENTO"} |
|
|
style={{ marginRight: 24, }} |
|
|
|
|
|
|
|
|
style={{ marginRight: 24 }} |
|
|
SvgImage={assets.floodZones.FloodZonesIcon} |
|
|
SvgImage={assets.floodZones.FloodZonesIcon} |
|
|
onPress={() => navigation.navigate("FloodSharingData")} |
|
|
onPress={() => navigation.navigate("FloodSharingData")} |
|
|
|
|
|
active={isRegistered} |
|
|
|
|
|
inactiveOnPress={() => setShowLog(true)} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<SvgLabeledButton |
|
|
<SvgLabeledButton |
|
|
label={"CHUVA"} |
|
|
label={"CHUVA"} |
|
|
onPress={() => navigation.navigate("RainSharingData")} |
|
|
onPress={() => navigation.navigate("RainSharingData")} |
|
|
SvgImage={assets.rainLevel.Rain_1_5} |
|
|
SvgImage={assets.rainLevel.Rain_1_5} |
|
|
|
|
|
active={isRegistered} |
|
|
|
|
|
inactiveOnPress={() => setShowLog(true)} |
|
|
/> |
|
|
/> |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
|
|
@ -42,17 +57,22 @@ function SharingDataScreen({ navigation }) { |
|
|
marginVertical: 24, |
|
|
marginVertical: 24, |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
|
|
|
|
|
|
<SvgLabeledButton |
|
|
<SvgLabeledButton |
|
|
style={{ marginRight: 24, }} |
|
|
|
|
|
|
|
|
style={{ marginRight: 24 }} |
|
|
label={"DIÁRIO DO\nPLUVIÔMETRO"} |
|
|
label={"DIÁRIO DO\nPLUVIÔMETRO"} |
|
|
onPress={() => navigation.navigate("PluviometerSharingData")} |
|
|
onPress={() => navigation.navigate("PluviometerSharingData")} |
|
|
SvgImage={assets.PluviometerIcon}/> |
|
|
|
|
|
|
|
|
SvgImage={assets.PluviometerIcon} |
|
|
|
|
|
active={isRegistered} |
|
|
|
|
|
inactiveOnPress={() => setShowLog(true)} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<SvgLabeledButton |
|
|
<SvgLabeledButton |
|
|
label={"NÍVEL ÁGUA\nNO RIO"} |
|
|
label={"NÍVEL ÁGUA\nNO RIO"} |
|
|
onPress={() => navigation.navigate("RiverFloodData")} |
|
|
onPress={() => navigation.navigate("RiverFloodData")} |
|
|
SvgImage={assets.riverLevel.RiverIcon}/> |
|
|
|
|
|
|
|
|
SvgImage={assets.riverLevel.RiverIcon} |
|
|
|
|
|
active={isRegistered} |
|
|
|
|
|
inactiveOnPress={() => setShowLog(true)} |
|
|
|
|
|
/> |
|
|
</View> |
|
|
</View> |
|
|
</ScrollView> |
|
|
</ScrollView> |
|
|
</View> |
|
|
</View> |
|
|