import React, { useContext, useState } from "react";
import { Text, Image, View, StyleSheet, ScrollView } from "react-native";
import Screen from "../components/Screen";
import { AuthContext } from "../auth/context";
import authStorage from "../auth/storage";
import { TouchableOpacity } from "react-native-gesture-handler";
import assets from "../config/assets";
import { MaterialCommunityIcons, FontAwesome } from "@expo/vector-icons";
import colors from "../config/colors";
import ConfirmationModal from "../components/ConfirmationModal";
function UserHeader({ name, fone }) {
return (
{name}
{fone}
);
}
function ProfileItensList({ icon, IconProvider, title, onPress }) {
return (
{title}
);
}
function AccountScreen(props) {
const { user, setUser } = useContext(AuthContext);
const [ showLog, setShowLog ] = useState(false);
const logout = () => {
setUser(null);
authStorage.removeToken();
};
const profileItems = [
{
icon: "account",
IconProvider: MaterialCommunityIcons,
title: "Cadastrar pluviômetro",
onPress: () => {
props.navigation.navigate("PluviometerRegister");
},
},
{
icon: "institution",
IconProvider: FontAwesome,
title: "ATIVAR INSTITUIÇÃO",
onPress: () => {
props.navigation.navigate("ActivateInstitutionCode");
},
},
{
icon: "information-outline",
IconProvider: MaterialCommunityIcons,
title: "SOBRE O PROJETO",
onPress: () => {
props.navigation.navigate("Abbout");
},
},
{
icon: "logout",
IconProvider: MaterialCommunityIcons,
title: "sair",
onPress: () => {
setShowLog(true)
},
},
// {
// icon: "trash-can",
// IconProvider: MaterialCommunityIcons,
// title: "DESATIVAR CONTA",
// onPress: () => {
// console.log("7");
// },
// },
];
return (
{profileItems.map(({ icon, IconProvider, title, onPress }) => (
))}
setShowLog(false)}
/>
);
}
const styles = StyleSheet.create({
text: {
fontSize: 16,
},
});
export default AccountScreen;