Notifications view improvement and some cleaning
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { View, Text, StyleSheet, SafeAreaView, FlatList } from 'react-native';
|
||||
import { Card } from 'react-native-paper';
|
||||
import API from '../API.js';
|
||||
import Post from '../components/Post.js';
|
||||
import SinglePost from '../components/SinglePostComponent';
|
||||
import Moment from 'moment';
|
||||
import { useSnapshot } from 'valtio';
|
||||
import GlobalState from '../contexts/GlobalState.js';
|
||||
@@ -11,7 +10,7 @@ import GlobalState from '../contexts/GlobalState.js';
|
||||
let NotificationsView = ({ navigation, route }) => {
|
||||
const gState = useSnapshot(GlobalState);
|
||||
const viewer = gState.me;
|
||||
const renderNotification = (({ item }) => {
|
||||
const renderNotification = (({ item }) => {
|
||||
const gotToPost = () => {
|
||||
navigation.navigate('SinglePost', { postid: item.postid });
|
||||
};
|
||||
@@ -22,6 +21,7 @@ let NotificationsView = ({ navigation, route }) => {
|
||||
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
|
||||
{" " + Moment(item.ts).fromNow()}
|
||||
</Text>
|
||||
<SinglePost postId={item.postid} />
|
||||
</Card.Content>
|
||||
</Card>
|
||||
)
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { Searchbar } from 'react-native-paper';
|
||||
import { View, ScrollView, StyleSheet, SafeAreaView, FlatList } from 'react-native';
|
||||
import { StyleSheet, SafeAreaView, FlatList } from 'react-native';
|
||||
import API from "../API";
|
||||
import UserName from "../components/UserName";
|
||||
import ProfileCard from "../components/ProfileCard";
|
||||
import ProfileSmallHeader from '../components/ProfileSmallHeader.js'
|
||||
|
||||
const Search = () => {
|
||||
const [searchQuery, setSearchQuery] = React.useState('');
|
||||
|
||||
@@ -1,29 +1,9 @@
|
||||
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';
|
||||
import React from 'react';
|
||||
import SinglePostComponent from '../components/SinglePostComponent';
|
||||
|
||||
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}/>
|
||||
</ScrollView>
|
||||
) : null);
|
||||
return <SinglePostComponent postId={route.params.postid} />;
|
||||
};
|
||||
|
||||
export default SinglePost;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
backgroundColor: "#edf2f7",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user