From 2f5f9df6dec1e905f3abf37d124ecd92d0e3a3d9 Mon Sep 17 00:00:00 2001 From: Ashm Walia Date: Wed, 27 Jan 2021 08:29:56 -0800 Subject: Pre-final --- src/components/comments/AddComment.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/components/comments/AddComment.tsx') diff --git a/src/components/comments/AddComment.tsx b/src/components/comments/AddComment.tsx index 86f4170c..46086e81 100644 --- a/src/components/comments/AddComment.tsx +++ b/src/components/comments/AddComment.tsx @@ -25,14 +25,14 @@ export interface AddCommentProps { setNewCommentsAvailable: Function; objectId: string; placeholderText: string; - isThreadInFocus: boolean; + isCommentInFocus: boolean; } const AddComment: React.FC = ({ setNewCommentsAvailable, objectId, placeholderText, - isThreadInFocus, + isCommentInFocus, }) => { const [comment, setComment] = React.useState(''); const [keyboardVisible, setKeyboardVisible] = React.useState(false); @@ -43,7 +43,7 @@ const AddComment: React.FC = ({ const postedComment = await postComment( comment.trim(), objectId, - isThreadInFocus, + isCommentInFocus, ); if (postedComment) { @@ -65,11 +65,13 @@ const AddComment: React.FC = ({ }, []); const ref = useRef(null); + + //If a comment is in Focus, bring the keyboard up so user is able to type in a reply useEffect(() => { - if (isThreadInFocus) { + if (isCommentInFocus) { ref.current?.focus(); } - }, [isThreadInFocus]); + }, [isCommentInFocus]); return ( = ({