Add moment
This commit is contained in:
@@ -4,6 +4,7 @@ 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 Moment from 'moment';
|
||||
|
||||
|
||||
let LoadPost = ({ postid, viewer }) => {
|
||||
@@ -31,6 +32,9 @@ let Notifications = ({ navigation, route }) => {
|
||||
<Card style={{ margin: 3 }} onPress={gotToPost}>
|
||||
<Card.Content>
|
||||
<Text>{item.body}</Text>
|
||||
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
|
||||
{" " + Moment(item.ts).fromNow()}
|
||||
</Text>
|
||||
</Card.Content>
|
||||
</Card>
|
||||
)
|
||||
|
||||
@@ -3,8 +3,6 @@ import React, { useState, useEffect } from 'react';
|
||||
import { View, ActivityIndicator, StyleSheet, SafeAreaView, FlatList } from 'react-native';
|
||||
import API from './../API.js';
|
||||
import Post from './../components/Post.js';
|
||||
import { Provider as PaperProvider } from 'react-native-paper';
|
||||
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
||||
import NewPost from "./../components/NewPost.js";
|
||||
|
||||
|
||||
@@ -28,13 +26,12 @@ let Profile = ({ navigation, route }) => {
|
||||
}
|
||||
}, [route.params]);
|
||||
const renderPost = (({ item }) => {
|
||||
if (item.nonOrganicType)
|
||||
return (<></>);
|
||||
return (<Post post={item} viewer={Me} />);
|
||||
});
|
||||
|
||||
return (
|
||||
<PaperProvider settings={{
|
||||
icon: props => <MaterialIcons {...props} />,
|
||||
}}>
|
||||
<SafeAreaView style={styles.container}>
|
||||
<View>
|
||||
{Posts.length === 0 && <ActivityIndicator />}
|
||||
@@ -53,7 +50,6 @@ let Profile = ({ navigation, route }) => {
|
||||
</View>
|
||||
<StatusBar style="auto" />
|
||||
</SafeAreaView>
|
||||
</PaperProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import UserName from './UserName.js';
|
||||
import Media from './Media.js';
|
||||
import Comment from "./Comment";
|
||||
import NewComment from './NewComment.js';
|
||||
import Moment from 'moment';
|
||||
|
||||
|
||||
let Post = (props) => {
|
||||
@@ -58,6 +59,9 @@ let Post = (props) => {
|
||||
<Text style={styles.userName}>
|
||||
<UserName profileid={post.profileid} />
|
||||
{toProfileText}
|
||||
<Text style={{ fontWeight: 'normal', fontSize: 12 }}>
|
||||
{" " + Moment(post.createdAt).fromNow()}
|
||||
</Text>
|
||||
</Text>
|
||||
<Text style={{ fontSize: 18 }}>{cleanContent}</Text>
|
||||
<Media content={post.content} />
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"@react-navigation/native-stack": "^6.5.0",
|
||||
"expo": "~43.0.2",
|
||||
"expo-status-bar": "~1.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"react": "17.0.1",
|
||||
"react-dom": "17.0.1",
|
||||
"react-google-material-icons": "^1.0.4",
|
||||
|
||||
Reference in New Issue
Block a user