aboutsummaryrefslogtreecommitdiff
path: root/src/components/comments/CommentTextField.tsx
diff options
context:
space:
mode:
authorBrian Kim <brian@tagg.id>2021-06-16 23:53:03 +0900
committerBrian Kim <brian@tagg.id>2021-06-16 23:53:03 +0900
commit8560936e0dc21ee2d06677c766a0bbcbc93b6de0 (patch)
tree3b9e9bcedc75aedc24d5cdb68bf83a7c0abb8e9d /src/components/comments/CommentTextField.tsx
parent902ad06d502024e1e42187887e07a7ac59d662e8 (diff)
Further merges with master
Diffstat (limited to 'src/components/comments/CommentTextField.tsx')
-rw-r--r--src/components/comments/CommentTextField.tsx28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/components/comments/CommentTextField.tsx b/src/components/comments/CommentTextField.tsx
index 3e97449c..a3a14ec8 100644
--- a/src/components/comments/CommentTextField.tsx
+++ b/src/components/comments/CommentTextField.tsx
@@ -40,6 +40,9 @@ type CommentTextFieldProps = {
) => null;
parts: Part[];
addComment: () => any;
+ theme?: 'dark' | 'white';
+ keyboardVisible?: boolean;
+ comment?: string;
};
const CommentTextField: FC<CommentTextFieldProps> = ({
@@ -53,6 +56,9 @@ const CommentTextField: FC<CommentTextFieldProps> = ({
handleSelectionChange,
parts,
addComment,
+ theme = 'white',
+ keyboardVisible = true,
+ comment = '',
...textInputProps
}) => {
const {avatar} = useSelector((state: RootState) => state.user);
@@ -93,11 +99,20 @@ const CommentTextField: FC<CommentTextFieldProps> = ({
)}
</Text>
</TextInput>
- <View style={styles.submitButton}>
- <TouchableOpacity style={styles.submitButton} onPress={addComment}>
- <UpArrowIcon width={35} height={35} color={'white'} />
- </TouchableOpacity>
- </View>
+ {(theme === 'white' || (theme === 'dark' && keyboardVisible)) && (
+ <View style={styles.submitButton}>
+ <TouchableOpacity
+ style={
+ comment === ''
+ ? [styles.submitButton, styles.greyButton]
+ : styles.submitButton
+ }
+ disabled={comment === ''}
+ onPress={addComment}>
+ <UpArrowIcon width={35} height={35} color={'white'} />
+ </TouchableOpacity>
+ </View>
+ )}
</View>
{validateInput(keyboardText)
@@ -130,6 +145,9 @@ const styles = StyleSheet.create({
justifyContent: 'center',
height: normalize(40),
},
+ greyButton: {
+ backgroundColor: 'grey',
+ },
submitButton: {
height: 35,
width: 35,