From 2f5f9df6dec1e905f3abf37d124ecd92d0e3a3d9 Mon Sep 17 00:00:00 2001
From: Ashm Walia <ashmwalia@outlook.com>
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<AddCommentProps> = ({
   setNewCommentsAvailable,
   objectId,
   placeholderText,
-  isThreadInFocus,
+  isCommentInFocus,
 }) => {
   const [comment, setComment] = React.useState('');
   const [keyboardVisible, setKeyboardVisible] = React.useState(false);
@@ -43,7 +43,7 @@ const AddComment: React.FC<AddCommentProps> = ({
     const postedComment = await postComment(
       comment.trim(),
       objectId,
-      isThreadInFocus,
+      isCommentInFocus,
     );
 
     if (postedComment) {
@@ -65,11 +65,13 @@ const AddComment: React.FC<AddCommentProps> = ({
   }, []);
 
   const ref = useRef<TextInput>(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 (
     <KeyboardAvoidingView
@@ -78,7 +80,7 @@ const AddComment: React.FC<AddCommentProps> = ({
       <View
         style={[
           styles.container,
-          keyboardVisible ? {backgroundColor: '#fff'} : {},
+          keyboardVisible ? styles.whiteBackround : {},
         ]}>
         <View style={styles.textContainer}>
           <Image
@@ -150,6 +152,9 @@ const styles = StyleSheet.create({
     marginVertical: '2%',
     alignSelf: 'flex-end',
   },
+  whiteBackround: {
+    backgroundColor: '#fff',
+  },
 });
 
 export default AddComment;
-- 
cgit v1.2.3-70-g09d2

