Add notifications
This commit is contained in:
@@ -2,20 +2,11 @@ import { StatusBar } from 'expo-status-bar';
|
||||
import React, { useState, useEffect } 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 API from '../API.js';
|
||||
import Post from '../components/Post.js';
|
||||
import Moment from 'moment';
|
||||
|
||||
|
||||
let LoadPost = ({ postid, viewer }) => {
|
||||
let [post, setPost] = useState({});
|
||||
useEffect(async () => {
|
||||
setPost(await API.getPost(postid));
|
||||
}, [postid]);
|
||||
return (post._id ? <Post post={post} viewer={viewer} /> : null);
|
||||
};
|
||||
|
||||
let Notifications = ({ navigation, route }) => {
|
||||
let NotificationsView = ({ navigation, route }) => {
|
||||
let [Me, setMeProfile] = useState({});
|
||||
let [notifications, setNotifications] = useState([]);
|
||||
useEffect(async () => {
|
||||
@@ -24,7 +15,6 @@ let Notifications = ({ navigation, route }) => {
|
||||
setNotifications(r.notifications)
|
||||
}, [route.params]);
|
||||
const renderNotification = (({ item }) => {
|
||||
//return (<LoadPost postid={item.postid} viewer={Me} />);
|
||||
const gotToPost = () => {
|
||||
navigation.navigate('SinglePost', { postid: item.postid, viewer: Me });
|
||||
};
|
||||
@@ -55,7 +45,7 @@ let Notifications = ({ navigation, route }) => {
|
||||
);
|
||||
}
|
||||
|
||||
export default Notifications;
|
||||
export default NotificationsView;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
31
Views/Video.js
Normal file
31
Views/Video.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, Button } from 'react-native';
|
||||
import { Video, AVPlaybackStatus } from 'expo-av';
|
||||
|
||||
export default function App({videoUrl}) {
|
||||
const video = React.useRef(null);
|
||||
const [status, setStatus] = React.useState({});
|
||||
return (
|
||||
<View>
|
||||
<Video
|
||||
ref={video}
|
||||
style={styles.video}
|
||||
source={{
|
||||
uri: videoUrl,
|
||||
}}
|
||||
useNativeControls
|
||||
resizeMode="contain"
|
||||
isLooping
|
||||
onPlaybackStatusUpdate={status => setStatus(() => status)}
|
||||
/>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
title={status.isPlaying ? 'Pause' : 'Play'}
|
||||
onPress={() =>
|
||||
status.isPlaying ? video.current.pauseAsync() : video.current.playAsync()
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user