aboutsummaryrefslogtreecommitdiff
path: root/src/components/comments/CommentsContainer.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-01-27 16:15:00 -0500
committerIvan Chen <ivan@tagg.id>2021-01-27 16:15:00 -0500
commitfb69ccebb05d2ec54d85576d23989e7309349830 (patch)
tree35a4997f848bfc681bb50bd2eebb397ba85026e5 /src/components/comments/CommentsContainer.tsx
parent3cbfdc6026ef886b7919181b69a2f252723a6bd8 (diff)
finished delete
Diffstat (limited to 'src/components/comments/CommentsContainer.tsx')
-rw-r--r--src/components/comments/CommentsContainer.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/components/comments/CommentsContainer.tsx b/src/components/comments/CommentsContainer.tsx
index 0a19694b..fd4b32af 100644
--- a/src/components/comments/CommentsContainer.tsx
+++ b/src/components/comments/CommentsContainer.tsx
@@ -1,9 +1,10 @@
-import React, {useRef, useEffect, useState} from 'react';
+import React, {useEffect, useRef, useState} from 'react';
import {StyleSheet} from 'react-native';
import {ScrollView} from 'react-native-gesture-handler';
-import {useDispatch} from 'react-redux';
+import {useDispatch, useSelector} from 'react-redux';
import {CommentTile} from '.';
import {getComments} from '../../services';
+import {RootState} from '../../store/rootReducer';
import {CommentType, ScreenType, TypeOfComment} from '../../types';
export type CommentsContainerProps = {
screenType: ScreenType;
@@ -32,6 +33,9 @@ const CommentsContainer: React.FC<CommentsContainerProps> = ({
setCommentObjectInFocus,
commentObjectInFocus,
}) => {
+ const {username: loggedInUsername} = useSelector(
+ (state: RootState) => state.user.user,
+ );
const [commentsList, setCommentsList] = useState<CommentType[]>([]);
const dispatch = useDispatch();
const ref = useRef<ScrollView>(null);
@@ -79,6 +83,8 @@ const CommentsContainer: React.FC<CommentsContainerProps> = ({
screenType={screenType}
typeOfComment={typeOfComment}
setCommentObjectInFocus={setCommentObjectInFocus}
+ setNewCommentsAvailable={setNewCommentsAvailable}
+ canDelete={comment.commenter.username === loggedInUsername}
/>
))}
</ScrollView>
@@ -86,9 +92,7 @@ const CommentsContainer: React.FC<CommentsContainerProps> = ({
};
const styles = StyleSheet.create({
- scrollView: {
- paddingHorizontal: 20,
- },
+ scrollView: {},
scrollViewContent: {
justifyContent: 'center',
},