From ec5c738e6b31eb7caa55c7a8a7fc549d66424aa7 Mon Sep 17 00:00:00 2001 From: Maria Sanchez Date: Mon, 22 Aug 2022 00:09:51 -0600 Subject: [PATCH] mobile nav with params --- mobile-ui/App.js | 14 ++++--- mobile-ui/components/LogIn.js | 12 +++--- mobile-ui/components/Profile.js | 5 ++- mobile-ui/components/ProfileGuarda.js | 57 +++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 13 deletions(-) create mode 100644 mobile-ui/components/ProfileGuarda.js diff --git a/mobile-ui/App.js b/mobile-ui/App.js index fd210975..a1ca6178 100644 --- a/mobile-ui/App.js +++ b/mobile-ui/App.js @@ -19,19 +19,23 @@ const Tab = createBottomTabNavigator(); -function HomeTab() { +function HomeTab({route}) { const [selected, setSelected] = useState(0); +const user = route.params; + +console.log(user); return ( - (} color="#D7A86E" size="md" />)}} onclick={() => setSelected(0)} /> - (} color="#D7A86E" size="md" />)}} onclick={() => setSelected(0)} + /> + (} color="#D7A86E" size="md" />)} } onclick={() => setSelected(1)} /> - (} color="#D7A86E" size="md" />)}} onclick={() => setSelected(2)} /> diff --git a/mobile-ui/components/LogIn.js b/mobile-ui/components/LogIn.js index 2978e5fb..5b2089b5 100644 --- a/mobile-ui/components/LogIn.js +++ b/mobile-ui/components/LogIn.js @@ -36,7 +36,7 @@ export default function LogIn({navigation}) { const userData = { email: "lalo@lalo.com", - password: '65bbb27d640914c507e5af778eccf3d1' + password: '12345' } console.log(userData); @@ -64,6 +64,8 @@ export default function LogIn({navigation}) { // inqulino 4 y guarda 63 const user = response.message + + //console.log(user); cookies.set('id',user._id, {path: "/"} ) cookies.set('name',user.name, {path: "/"} ) @@ -71,13 +73,9 @@ export default function LogIn({navigation}) { cookies.set('type',user.user_type, {path: "/"} ) if(user.user_type == '4'){ - - - - - navigation.navigate('Comunicados') + }else if(user.user_type == '3'){ - + navigation.navigate('Comunicados', {user}) } }) diff --git a/mobile-ui/components/Profile.js b/mobile-ui/components/Profile.js index 79e4b9b5..28239557 100644 --- a/mobile-ui/components/Profile.js +++ b/mobile-ui/components/Profile.js @@ -10,8 +10,11 @@ import { Center } from "native-base"; -export default function Profile({navigation}){ +export default function Profile({route, navigation}){ + const user = route.params; + + console.log(user); return (
diff --git a/mobile-ui/components/ProfileGuarda.js b/mobile-ui/components/ProfileGuarda.js new file mode 100644 index 00000000..b481f2c8 --- /dev/null +++ b/mobile-ui/components/ProfileGuarda.js @@ -0,0 +1,57 @@ +import React from "react"; + +import { + Box, + Heading, + VStack, + FormControl, + Input, + Button, + Center + } from "native-base"; + +export default function ProfileGuarda({navigation}){ + + return ( +
+ + + Katoikia + + + Modifique sus datos + + + + Nombre + + + + Correo Electrónico + + + + Teléfono + + + + Contraseña actual + + + + + + + +
+ + ) +} \ No newline at end of file