NotificationsTab
This commit is contained in:
29
Views/SinglePost.js
Normal file
29
Views/SinglePost.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { View, Text, StyleSheet, ScrollView, FlatList } from 'react-native';
|
||||
import API from './../API.js';
|
||||
import Post from './../components/Post.js';
|
||||
|
||||
let SinglePost = ({ route }) => {
|
||||
let [post, setPost] = useState({});
|
||||
console.log(route.params.postid)
|
||||
useEffect(async () => {
|
||||
if (route.params.postid)
|
||||
setPost(await API.getPost(route.params.postid));
|
||||
}, [route]);
|
||||
return (post._id ? (
|
||||
<ScrollView>
|
||||
<Post post={post} viewer={route.params.viewer} />
|
||||
</ScrollView>
|
||||
) : null);
|
||||
};
|
||||
|
||||
export default SinglePost;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
backgroundColor: "#edf2f7",
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user