merge conflicts fix
This commit is contained in:
		
						commit
						421f56b709
					
				| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
.log/
 | 
					.log/
 | 
				
			||||||
node_modules
 | 
					node_modules
 | 
				
			||||||
 | 
					.DS_Store
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,4 +10,4 @@ npm-debug.*
 | 
				
			||||||
web-build/
 | 
					web-build/
 | 
				
			||||||
.vscode
 | 
					.vscode
 | 
				
			||||||
.DS_Store
 | 
					.DS_Store
 | 
				
			||||||
 | 
					package-lock.json
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import React,{useState} from "react";
 | 
					import React, { useContext, useState } from "react";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  NativeBaseProvider,
 | 
					  NativeBaseProvider,
 | 
				
			||||||
  Icon
 | 
					  Icon
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@ import Reservas from "./components/Reservas";
 | 
				
			||||||
import Profile from "./components/Profile";
 | 
					import Profile from "./components/Profile";
 | 
				
			||||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
 | 
					import { MaterialCommunityIcons } from '@expo/vector-icons';
 | 
				
			||||||
import AreaComun from "./components/AreaComun";
 | 
					import AreaComun from "./components/AreaComun";
 | 
				
			||||||
 | 
					import { UserContext, UserContextProvider } from "./context/UserContext";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Stack = createNativeStackNavigator();
 | 
					const Stack = createNativeStackNavigator();
 | 
				
			||||||
const Tab = createBottomTabNavigator();
 | 
					const Tab = createBottomTabNavigator();
 | 
				
			||||||
| 
						 | 
					@ -20,13 +21,11 @@ const Tab = createBottomTabNavigator();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function HomeTab({ route }) {
 | 
					function HomeTab({ route }) {
 | 
				
			||||||
 | 
					  const { user } = useContext(UserContext);
 | 
				
			||||||
  const [selected, setSelected] = useState(0);
 | 
					  const [selected, setSelected] = useState(0);
 | 
				
			||||||
const user = route.params;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// console.log(user);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <Tab.Navigator initialParams={user} initialRouteName="Comunicados" > 
 | 
					    <Tab.Navigator initialParams={user} initialRouteName="Comunicados" > 
 | 
				
			||||||
    <Tab.Screen  name="Comunicados" component={Home}  initialParams={user} options={{headerStyle: {
 | 
					    <Tab.Screen  name="Comunicados" component={Home}  initialParams={user} options={{headerStyle: {
 | 
				
			||||||
      backgroundColor: "#D7A86E"
 | 
					      backgroundColor: "#D7A86E"
 | 
				
			||||||
| 
						 | 
					@ -39,26 +38,30 @@ const user = route.params;
 | 
				
			||||||
      backgroundColor: "#D7A86E"
 | 
					      backgroundColor: "#D7A86E"
 | 
				
			||||||
    }, tabBarIcon: () => (<Icon mb="2" as={<MaterialCommunityIcons name={selected === 2 ? 'account' : 'account-outline'} />} color="#D7A86E" size="md" />)}} onclick={() => setSelected(2)} /> 
 | 
					    }, tabBarIcon: () => (<Icon mb="2" as={<MaterialCommunityIcons name={selected === 2 ? 'account' : 'account-outline'} />} color="#D7A86E" size="md" />)}} onclick={() => setSelected(2)} /> 
 | 
				
			||||||
  </Tab.Navigator>
 | 
					  </Tab.Navigator>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export default function App() {
 | 
					export default function App() {
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <NativeBaseProvider>
 | 
					    <NativeBaseProvider>
 | 
				
			||||||
 | 
					      <UserContextProvider>
 | 
				
			||||||
        <NavigationContainer>
 | 
					        <NavigationContainer>
 | 
				
			||||||
          <Stack.Navigator initialRouteName="LogIn">
 | 
					          <Stack.Navigator initialRouteName="LogIn">
 | 
				
			||||||
        <Stack.Screen name="Inicio" component={LogIn} options={{headerStyle: {
 | 
					            <Stack.Screen name="Inicio" component={LogIn} options={{
 | 
				
			||||||
 | 
					              headerStyle: {
 | 
				
			||||||
                backgroundColor: "#D7A86E"
 | 
					                backgroundColor: "#D7A86E"
 | 
				
			||||||
    }}} />
 | 
					              }
 | 
				
			||||||
 | 
					            }} />
 | 
				
			||||||
            <Stack.Screen name="Comunicados" component={HomeTab} options={{ headerShown: false }} />
 | 
					            <Stack.Screen name="Comunicados" component={HomeTab} options={{ headerShown: false }} />
 | 
				
			||||||
            <Stack.Screen name="Password" component={RecoverPassword} />
 | 
					            <Stack.Screen name="Password" component={RecoverPassword} />
 | 
				
			||||||
        <Stack.Screen name="area" component={AreaComun} options={{headerStyle: {
 | 
					            <Stack.Screen name="area" component={AreaComun} options={{
 | 
				
			||||||
 | 
					              headerStyle: {
 | 
				
			||||||
                backgroundColor: "#D7A86E"
 | 
					                backgroundColor: "#D7A86E"
 | 
				
			||||||
    }}} />
 | 
					              }
 | 
				
			||||||
 | 
					            }} />
 | 
				
			||||||
          </Stack.Navigator>
 | 
					          </Stack.Navigator>
 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
        </NavigationContainer>
 | 
					        </NavigationContainer>
 | 
				
			||||||
 | 
					      </UserContextProvider>
 | 
				
			||||||
    </NativeBaseProvider>
 | 
					    </NativeBaseProvider>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,51 @@
 | 
				
			||||||
 | 
					import { format } from "date-fns";
 | 
				
			||||||
 | 
					import {
 | 
				
			||||||
 | 
					    Badge,
 | 
				
			||||||
 | 
					    Box, HStack, Pressable,
 | 
				
			||||||
 | 
					    Spacer, Text
 | 
				
			||||||
 | 
					} from "native-base";
 | 
				
			||||||
 | 
					import PropTypes from 'prop-types';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const CommentCard = ({ date, comment }) => {
 | 
				
			||||||
 | 
					    const dateFormated = format(new Date(date), "dd LL yyyy")
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <Pressable
 | 
				
			||||||
 | 
					            rounded="8"
 | 
				
			||||||
 | 
					            overflow="hidden"
 | 
				
			||||||
 | 
					            borderWidth="1"
 | 
				
			||||||
 | 
					            borderColor="coolGray.300"
 | 
				
			||||||
 | 
					            maxW="96"
 | 
				
			||||||
 | 
					            shadow="3"
 | 
				
			||||||
 | 
					            bg="coolGray.100"
 | 
				
			||||||
 | 
					            p="5"
 | 
				
			||||||
 | 
					            marginTop="4"
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					            <Box>
 | 
				
			||||||
 | 
					                <HStack alignItems="center">
 | 
				
			||||||
 | 
					                    <Badge colorScheme="darkBlue" _text={{
 | 
				
			||||||
 | 
					                        color: "white"
 | 
				
			||||||
 | 
					                    }} variant="solid" rounded="4">
 | 
				
			||||||
 | 
					                        Comunicado
 | 
				
			||||||
 | 
					                    </Badge>
 | 
				
			||||||
 | 
					                    <Spacer />
 | 
				
			||||||
 | 
					                    <Text fontSize={10} color="coolGray.800">
 | 
				
			||||||
 | 
					                        {dateFormated}
 | 
				
			||||||
 | 
					                    </Text>
 | 
				
			||||||
 | 
					                </HStack>
 | 
				
			||||||
 | 
					                <Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
 | 
				
			||||||
 | 
					                    Administrador de Comunidad
 | 
				
			||||||
 | 
					                </Text>
 | 
				
			||||||
 | 
					                <Text mt="2" fontSize="sm" color="coolGray.700">
 | 
				
			||||||
 | 
					                    {comment}
 | 
				
			||||||
 | 
					                </Text>
 | 
				
			||||||
 | 
					            </Box>
 | 
				
			||||||
 | 
					        </Pressable>
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CommentCard.propTypes = {
 | 
				
			||||||
 | 
					    date: PropTypes.string.isRequired,
 | 
				
			||||||
 | 
					    comment: PropTypes.string.isRequired,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,17 +1,43 @@
 | 
				
			||||||
import React from "react";
 | 
					import{Box, ScrollView} from "native-base";
 | 
				
			||||||
import {
 | 
					import React, { useContext, useEffect, useState } from "react";
 | 
				
			||||||
    Text,
 | 
					import { UserContext } from "../context/UserContext";
 | 
				
			||||||
    HStack,
 | 
					import { API } from "../environment/api";
 | 
				
			||||||
    Badge,
 | 
					import { CommentCard } from "./CommentCard";
 | 
				
			||||||
    Box,
 | 
					
 | 
				
			||||||
Pressable,
 | 
					export default function Home() {
 | 
				
			||||||
    Spacer, 
 | 
					  const { user } = useContext(UserContext)
 | 
				
			||||||
    ScrollView
 | 
					  const [isRequesting, setIsRequesting] = useState(false);
 | 
				
			||||||
  } from "native-base";
 | 
					  const [comments, setComments] = useState([]);
 | 
				
			||||||
  import { MaterialCommunityIcons } from '@expo/vector-icons'; 
 | 
					
 | 
				
			||||||
export default function Home({route}){
 | 
					  useEffect(() => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const onRequestCommentsData = async () => {
 | 
				
			||||||
 | 
					      setIsRequesting(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      try {
 | 
				
			||||||
 | 
					        const jsonResponse = await fetch(`${API.BASE_URL}/post/allComments`, {
 | 
				
			||||||
 | 
					          method: "GET",
 | 
				
			||||||
 | 
					          headers: {
 | 
				
			||||||
 | 
					            'Content-Type': 'application/json'
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const response = await jsonResponse.json();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        setComments(response.message);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      } catch (error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      setIsRequesting(false)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    onRequestCommentsData()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }, [user])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [selected, setSelected] = React.useState(0);
 | 
					 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <Box alignItems="center">
 | 
					    <Box alignItems="center">
 | 
				
			||||||
| 
						 | 
					@ -21,68 +47,18 @@ export default function Home({route}){
 | 
				
			||||||
        mb: "4",
 | 
					        mb: "4",
 | 
				
			||||||
        minW: "72"
 | 
					        minW: "72"
 | 
				
			||||||
      }}>
 | 
					      }}>
 | 
				
			||||||
      <Pressable onPress={() => console.log("I'm Pressed")} rounded="8" overflow="hidden" borderWidth="1" borderColor="coolGray.300" maxW="96" shadow="3" bg="coolGray.100" p="5" marginTop="4">
 | 
					 | 
				
			||||||
        <Box>
 | 
					 | 
				
			||||||
          <HStack alignItems="center">
 | 
					 | 
				
			||||||
            <Badge colorScheme="darkBlue" _text={{
 | 
					 | 
				
			||||||
            color: "white"
 | 
					 | 
				
			||||||
          }} variant="solid" rounded="4">
 | 
					 | 
				
			||||||
              Comunicado
 | 
					 | 
				
			||||||
            </Badge>
 | 
					 | 
				
			||||||
            <Spacer />
 | 
					 | 
				
			||||||
            <Text fontSize={10} color="coolGray.800">
 | 
					 | 
				
			||||||
              1 month ago
 | 
					 | 
				
			||||||
            </Text>
 | 
					 | 
				
			||||||
          </HStack>
 | 
					 | 
				
			||||||
          <Text color="coolGray.800" mt="3" fontWeight="medium" fontSize="xl">
 | 
					 | 
				
			||||||
            Administrador de Comunidad
 | 
					 | 
				
			||||||
          </Text>
 | 
					 | 
				
			||||||
          <Text mt="2" fontSize="sm" color="coolGray.700">
 | 
					 | 
				
			||||||
            Notificacion sobre la aplicacion
 | 
					 | 
				
			||||||
          </Text>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        </Box>
 | 
					        {
 | 
				
			||||||
      </Pressable>
 | 
					          comments.map(item => (
 | 
				
			||||||
 | 
					            <CommentCard
 | 
				
			||||||
 | 
					              key={item._id}
 | 
				
			||||||
 | 
					              comment={item.comment}
 | 
				
			||||||
 | 
					              date={item.date_entry}
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
 | 
					          ))
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      </ScrollView>
 | 
					      </ScrollView>
 | 
				
			||||||
    </Box>
 | 
					    </Box>
 | 
				
			||||||
      //   <Center width={"100%"} marginTop={"auto"}>
 | 
					 | 
				
			||||||
           
 | 
					 | 
				
			||||||
      // <Box safeAreaTop bg="#D7A86E" flex={1} />
 | 
					 | 
				
			||||||
      // <HStack bg="#D7A86E" px="2" py="4" justifyContent="space-between" alignItems="center" w="100%" maxW="100%">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      //   <Pressable opacity={selected === 0 ? 1 : 0.5} py="3" flex={1} onPress={() => setSelected(0) && navigation.navigate('Home')}>
 | 
					 | 
				
			||||||
      //       <Center>
 | 
					 | 
				
			||||||
      //         <Icon mb="2" as={<MaterialCommunityIcons name={selected === 0 ? 'home' : 'home-outline'} />} color="white" size="md" />
 | 
					 | 
				
			||||||
      //         <Text color="white" fontSize="15">
 | 
					 | 
				
			||||||
      //           Inicio
 | 
					 | 
				
			||||||
      //         </Text>
 | 
					 | 
				
			||||||
      //       </Center>
 | 
					 | 
				
			||||||
      //     </Pressable>
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
      //   <Pressable opacity={selected === 1 ? 1 : 0.5} py="3" flex={1} onPress={() => setSelected(1) && ( () => navigation.navigate('Reservas'))}>
 | 
					 | 
				
			||||||
      //       <Center>
 | 
					 | 
				
			||||||
      //         <Icon mb="2" as={<MaterialCommunityIcons name={selected === 1 ? 'tree' : 'tree-outline'} />} color="white" size="md" />
 | 
					 | 
				
			||||||
      //         <Text color="white" fontSize="15">
 | 
					 | 
				
			||||||
      //           Reservas
 | 
					 | 
				
			||||||
      //         </Text>
 | 
					 | 
				
			||||||
      //       </Center>
 | 
					 | 
				
			||||||
      //     </Pressable>
 | 
					 | 
				
			||||||
      
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
      //   <Pressable opacity={selected === 2 ? 1 : 0.5} py="3" flex={1} onPress={() => setSelected(2)}>
 | 
					 | 
				
			||||||
      //       <Center>
 | 
					 | 
				
			||||||
      //         <Icon mb="2" as={<MaterialCommunityIcons name={selected === 2 ? 'account' : 'account-outline'} />} color="white" size="md" />
 | 
					 | 
				
			||||||
      //         <Text color="white" fontSize="15">
 | 
					 | 
				
			||||||
      //           Perfil
 | 
					 | 
				
			||||||
      //         </Text>
 | 
					 | 
				
			||||||
      //       </Center>
 | 
					 | 
				
			||||||
      //     </Pressable>
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
      // </HStack>
 | 
					 | 
				
			||||||
      // </Center>
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import React, {useState} from "react";
 | 
					import React, { useContext, useState } from "react";
 | 
				
			||||||
import Cookies from 'universal-cookie';
 | 
					import Cookies from 'universal-cookie';
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  Text,
 | 
					  Text,
 | 
				
			||||||
| 
						 | 
					@ -15,40 +15,30 @@ import logo from "../assets/logo-katoikia.png";
 | 
				
			||||||
import { Entypo } from '@expo/vector-icons';
 | 
					import { Entypo } from '@expo/vector-icons';
 | 
				
			||||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
 | 
					import { MaterialCommunityIcons } from '@expo/vector-icons';
 | 
				
			||||||
import { View, TextInput, StyleSheet } from "react-native";
 | 
					import { View, TextInput, StyleSheet } from "react-native";
 | 
				
			||||||
 | 
					import { UserContext } from "../context/UserContext";
 | 
				
			||||||
 | 
					import { API } from "../environment/api";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const baseURL = "http://localhost:4000/user/loginUser"; 
 | 
					const baseURL = `${API.BASE_URL}/user/loginUser`;
 | 
				
			||||||
const cookies = new Cookies(); 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// const handleChange = (value) => {
 | 
					 | 
				
			||||||
// console.log(value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function LogIn({ navigation }) {
 | 
					export default function LogIn({ navigation }) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const [email, setEmail] = useState(); 
 | 
					  const { addUser } = useContext(UserContext);
 | 
				
			||||||
  const [password, setPassword] = useState();
 | 
					
 | 
				
			||||||
  // const [inputs, setInputs] = useState();
 | 
					  const [credentials, setCredentials] = useState({
 | 
				
			||||||
 | 
					    email: "",
 | 
				
			||||||
 | 
					    password: ""
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const onHandleChange = (name) => (value) => setCredentials(prev => ({ ...prev, [name]: value }))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const iniciarSesion = async () => {
 | 
					  const iniciarSesion = async () => {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    console.log(email);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const userData = {
 | 
					 | 
				
			||||||
      email: "lalo@lalo.com", 
 | 
					 | 
				
			||||||
      password: '12345'
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
    console.log(userData);
 | 
					 | 
				
			||||||
    // const userData = JSON.stringify(FormControl.toString);
 | 
					 | 
				
			||||||
    // console.log(userData);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
      await fetch(baseURL, {
 | 
					      await fetch(baseURL, {
 | 
				
			||||||
        cache: 'no-cache', 
 | 
					        cache: 'no-cache', 
 | 
				
			||||||
        method: 'POST', 
 | 
					        method: 'POST', 
 | 
				
			||||||
        body: JSON.stringify(userData), 
 | 
					        body: JSON.stringify(credentials), 
 | 
				
			||||||
        headers: {
 | 
					        headers: {
 | 
				
			||||||
          'Content-Type': 'application/json'
 | 
					          'Content-Type': 'application/json'
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -64,18 +54,12 @@ export default function LogIn({navigation}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // inqulino 4 y guarda 63
 | 
					        // inqulino 4 y guarda 63
 | 
				
			||||||
         const user = response.message
 | 
					         const user = response.message
 | 
				
			||||||
 | 
					 | 
				
			||||||
         //console.log(user);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
         cookies.set('id',user._id, {path: "/"} )
 | 
					 | 
				
			||||||
         cookies.set('name',user.name, {path: "/"} )
 | 
					 | 
				
			||||||
         cookies.set('email',user.email, {path: "/"} )
 | 
					 | 
				
			||||||
         cookies.set('type',user.user_type, {path: "/"} )
 | 
					 | 
				
			||||||
          if(user.user_type == '4'){
 | 
					          if(user.user_type == '4'){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            navigation.navigate('Comunicados', {user})
 | 
					            navigation.navigate('Comunicados', {user})
 | 
				
			||||||
          }else if(user.user_type == '3'){
 | 
					          }else if(user.user_type == '3'){
 | 
				
			||||||
            navigation.navigate('Comunicados', {user})
 | 
					            addUser(user);
 | 
				
			||||||
 | 
					            navigation.navigate('Comunicados')
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
| 
						 | 
					@ -83,7 +67,6 @@ export default function LogIn({navigation}) {
 | 
				
			||||||
      console.log("ERROR: " +error);
 | 
					      console.log("ERROR: " +error);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
| 
						 | 
					@ -129,7 +112,13 @@ export default function LogIn({navigation}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              <View style={styles.viewSection}>
 | 
					              <View style={styles.viewSection}>
 | 
				
			||||||
                <Entypo name="email" size={20} color="grey" style={styles.iconStyle} />
 | 
					                <Entypo name="email" size={20} color="grey" style={styles.iconStyle} />
 | 
				
			||||||
              <TextInput name='email' type="text" style={styles.input} placeholder='Correo electrónico' onChangeText={(value) => setEmail(value) } />
 | 
					                <TextInput
 | 
				
			||||||
 | 
					                  name='email'
 | 
				
			||||||
 | 
					                  type="text"
 | 
				
			||||||
 | 
					                  style={styles.input}
 | 
				
			||||||
 | 
					                  value={credentials.email}
 | 
				
			||||||
 | 
					                  placeholder='Correo electrónico'
 | 
				
			||||||
 | 
					                  onChangeText={onHandleChange("email")} />
 | 
				
			||||||
              </View>
 | 
					              </View>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            </FormControl>
 | 
					            </FormControl>
 | 
				
			||||||
| 
						 | 
					@ -137,7 +126,13 @@ export default function LogIn({navigation}) {
 | 
				
			||||||
              <FormControl.Label Text='bold'> Contraseña </FormControl.Label>
 | 
					              <FormControl.Label Text='bold'> Contraseña </FormControl.Label>
 | 
				
			||||||
              <View style={styles.viewSection}>
 | 
					              <View style={styles.viewSection}>
 | 
				
			||||||
                <MaterialCommunityIcons name="form-textbox-password" size={20} color="grey" style={styles.iconStyle} />
 | 
					                <MaterialCommunityIcons name="form-textbox-password" size={20} color="grey" style={styles.iconStyle} />
 | 
				
			||||||
                <TextInput name='password' type="password" style={styles.input} placeholder='Contraseña' onChangeText={(value) => setPassword(value)} />
 | 
					                <TextInput
 | 
				
			||||||
 | 
					                  name='password'
 | 
				
			||||||
 | 
					                  type="password"
 | 
				
			||||||
 | 
					                  style={styles.input}
 | 
				
			||||||
 | 
					                  value={credentials.password}
 | 
				
			||||||
 | 
					                  placeholder='Contraseña'
 | 
				
			||||||
 | 
					                  onChangeText={onHandleChange("password")} />
 | 
				
			||||||
              </View>
 | 
					              </View>
 | 
				
			||||||
              <Link
 | 
					              <Link
 | 
				
			||||||
                _text={{
 | 
					                _text={{
 | 
				
			||||||
| 
						 | 
					@ -156,7 +151,7 @@ export default function LogIn({navigation}) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              </Link>
 | 
					              </Link>
 | 
				
			||||||
            </FormControl>
 | 
					            </FormControl>
 | 
				
			||||||
            <Button  mt="2" backgroundColor="#D7A86E" onPress={() => iniciarSesion()}
 | 
					            <Button mt="2" backgroundColor="#D7A86E" onPress={iniciarSesion}
 | 
				
			||||||
            >
 | 
					            >
 | 
				
			||||||
              <Text>Continuar</Text>
 | 
					              <Text>Continuar</Text>
 | 
				
			||||||
            </Button>
 | 
					            </Button>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,23 +1,19 @@
 | 
				
			||||||
import React, { useState } from "react";
 | 
					
 | 
				
			||||||
 | 
					import React, { useContext, useState } from "react";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    Box, 
 | 
					  Box, Button,
 | 
				
			||||||
    Heading, 
 | 
					  Center, FormControl, Heading, ScrollView, VStack
 | 
				
			||||||
    VStack, 
 | 
					 | 
				
			||||||
    FormControl,  
 | 
					 | 
				
			||||||
    Button,
 | 
					 | 
				
			||||||
    Center,
 | 
					 | 
				
			||||||
    ScrollView
 | 
					 | 
				
			||||||
} from "native-base";
 | 
					} from "native-base";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  import { View, TextInput, StyleSheet } from "react-native";
 | 
					import { StyleSheet, TextInput } from "react-native";
 | 
				
			||||||
 | 
					import { UserContext } from "../context/UserContext";
 | 
				
			||||||
export default function Profile({route, navigation}){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default function Profile({ navigation }) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const baseURL = 'http://localhost:4000/user/updateUser'
 | 
					  const baseURL = 'http://localhost:4000/user/updateUser'
 | 
				
			||||||
  const userData = JSON.parse(JSON.stringify(route.params));
 | 
					  //const userData = JSON.parse(JSON.stringify(route.params));
 | 
				
			||||||
  const [name, setName] = useState(); 
 | 
					  const [name, setName] = useState(); 
 | 
				
			||||||
  const [apellido, setApellido] =useState(); 
 | 
					  const [apellido, setApellido] =useState(); 
 | 
				
			||||||
  const [email, setEmail] = useState(); 
 | 
					  const [email, setEmail] = useState(); 
 | 
				
			||||||
| 
						 | 
					@ -26,6 +22,8 @@ export default function Profile({route, navigation}){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  console.log(userData.user);
 | 
					  console.log(userData.user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const userData = useContext(UserContext)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const updateInfo = async() => {
 | 
					  const updateInfo = async() => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					import React, { createContext, useState } from 'react'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const UserContext = createContext({});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const UserContextProvider = ({ children }) => {
 | 
				
			||||||
 | 
					    const [user, setUser] = useState(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const addUser = (user) => setUser(user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const removeUser = () => setUser(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const value = {
 | 
				
			||||||
 | 
					        user,
 | 
				
			||||||
 | 
					        addUser,
 | 
				
			||||||
 | 
					        removeUser
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <UserContext.Provider value={value}>
 | 
				
			||||||
 | 
					            {children}
 | 
				
			||||||
 | 
					        </UserContext.Provider>
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export class API {
 | 
				
			||||||
 | 
					    static BASE_URL = "http://10.0.2.2:4000"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -22,9 +22,11 @@
 | 
				
			||||||
    "@react-navigation/native": "^6.0.11",
 | 
					    "@react-navigation/native": "^6.0.11",
 | 
				
			||||||
    "@react-navigation/native-stack": "^6.7.0",
 | 
					    "@react-navigation/native-stack": "^6.7.0",
 | 
				
			||||||
    "@react-navigation/stack": "^6.2.2",
 | 
					    "@react-navigation/stack": "^6.2.2",
 | 
				
			||||||
 | 
					    "date-fns": "^2.29.2",
 | 
				
			||||||
    "expo": "^44.0.0",
 | 
					    "expo": "^44.0.0",
 | 
				
			||||||
    "expo-status-bar": "~1.2.0",
 | 
					    "expo-status-bar": "~1.2.0",
 | 
				
			||||||
    "native-base": "3.4.0",
 | 
					    "native-base": "3.4.0",
 | 
				
			||||||
 | 
					    "prop-types": "^15.8.1",
 | 
				
			||||||
    "react": "17.0.1",
 | 
					    "react": "17.0.1",
 | 
				
			||||||
    "react-dom": "17.0.1",
 | 
					    "react-dom": "17.0.1",
 | 
				
			||||||
    "react-native": "0.64.3",
 | 
					    "react-native": "0.64.3",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue