Basic Navigation

This commit is contained in:
aeroreyna
2022-03-06 21:45:35 -08:00
parent b948927e4c
commit 8b1a52a3af
8 changed files with 329 additions and 48 deletions

View File

@@ -1,10 +1,12 @@
import React, { useState, useEffect } from 'react';
import { Text, View, ScrollView, Button, StyleSheet } from 'react-native';
import API from './../API.js';
import { useNavigation } from '@react-navigation/native';
let UserName = (props) => {
let [profile, setProfile] = useState({});
const navigation = useNavigation();
useEffect(async () => {
let p = await API.getUserProfile(props.profileid).catch(()=>{return {}});
@@ -12,7 +14,7 @@ let UserName = (props) => {
}, [props.profileid]);
return (
<Text>{profile.profile && profile.profile.firstName} {profile.profile && profile.profile.lastName}</Text>
<Text onPress={()=>{navigation.navigate('Feed', {profileid: props.profileid})}} >{profile.profile && profile.profile.firstName} {profile.profile && profile.profile.lastName}</Text>
);
}