diff options
author | Ivan Chen <ivan@thetaggid.com> | 2021-01-27 17:30:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 17:30:08 -0500 |
commit | 60d3d97ad6913369762877a9dbfdaac0473deb28 (patch) | |
tree | a643a1790d7bff35ea911341c59f5fbd7ab1f068 /src/components/comments/CommentsContainer.tsx | |
parent | 21a3e000443c5c4ab2ae91000108b9d3b0383964 (diff) | |
parent | fa589628285602136542b3f8944297dea34ddbf6 (diff) |
Merge pull request #204 from IvanIFChen/tma568-delete-comments
[TMA-568] Delete Comments
Diffstat (limited to 'src/components/comments/CommentsContainer.tsx')
-rw-r--r-- | src/components/comments/CommentsContainer.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/components/comments/CommentsContainer.tsx b/src/components/comments/CommentsContainer.tsx index 0a19694b..d8134caf 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,9 @@ const CommentsContainer: React.FC<CommentsContainerProps> = ({ screenType={screenType} typeOfComment={typeOfComment} setCommentObjectInFocus={setCommentObjectInFocus} + newCommentsAvailable={newCommentsAvailable} + setNewCommentsAvailable={setNewCommentsAvailable} + canDelete={comment.commenter.username === loggedInUsername} /> ))} </ScrollView> @@ -86,9 +93,7 @@ const CommentsContainer: React.FC<CommentsContainerProps> = ({ }; const styles = StyleSheet.create({ - scrollView: { - paddingHorizontal: 20, - }, + scrollView: {}, scrollViewContent: { justifyContent: 'center', }, |