35 lines
955 B
JavaScript
35 lines
955 B
JavaScript
import { StatusBar } from 'expo-status-bar';
|
|
import React, { useState, useEffect } from 'react';
|
|
import { Text, View, ScrollView, Button } from 'react-native';
|
|
import API from './../API.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>
|
|
<Text>Hello: {Me.profile && Me.profile.firstName} {Me.profile && Me.profile.lastName}</Text>
|
|
{
|
|
Posts.map((post, i) => {
|
|
return (
|
|
<Text key={i}>{post.content}</Text>
|
|
)
|
|
})
|
|
}
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export default Feed;
|