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,35 +0,0 @@
import { StatusBar } from 'expo-status-bar';
import React, { useState, useEffect } from 'react';
import { Text, View, ScrollView, Button, StyleSheet } from 'react-native';
import API from './../API.js';
import Post from './Post.js'
let Feed = () => {
let [Me, setMeProfile] = useState({});
let [Posts, setPosts] = useState([]);
useEffect(async () => {
let r = await API.getMe();
setMeProfile(r);
let posts = await API.getPosts();
setPosts(posts);
//console.log(posts)
}, []);
return (
<View>
<ScrollView>
{
Posts.map((post, i) => {
return (
//<Text key={i}>{post.content}</Text>
<Post post={post} viewer={Me} key={i}/>
)
})
}
</ScrollView>
</View>
);
}
export default Feed;

View File

@@ -38,7 +38,6 @@ let Media = (props) => {
const imagesTag = imagesTagF(props.content);
const imageStyle = imagesTag.length == 1 ? styles.image : styles.multipleImage;
const videosId = videoIdF(props.content);
console.log(videosId);
const vimeo = videosId.length ? <VimeoPlayer videoId={videosId[1]} /> : undefined;
return (
<View>

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>
);
}