From 98b11aebbc99ade873b7c8681ac38d6e0e72332c Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Sat, 12 Jun 2021 02:01:57 +0900 Subject: Alter location of suggested --- src/components/comments/MentionInputControlled.tsx | 93 +++++++++++++++++----- 1 file changed, 73 insertions(+), 20 deletions(-) (limited to 'src/components/comments/MentionInputControlled.tsx') diff --git a/src/components/comments/MentionInputControlled.tsx b/src/components/comments/MentionInputControlled.tsx index 2fd2b41d..c52f3286 100644 --- a/src/components/comments/MentionInputControlled.tsx +++ b/src/components/comments/MentionInputControlled.tsx @@ -1,11 +1,15 @@ import React, {FC, MutableRefObject, useMemo, useRef, useState} from 'react'; import { NativeSyntheticEvent, + StyleSheet, Text, TextInput, TextInputSelectionChangeEventData, + TouchableOpacity, View, } from 'react-native'; +import {useDispatch, useSelector} from 'react-redux'; +import {TAGG_LIGHT_BLUE} from '../../constants'; import { MentionInputProps, MentionPartType, @@ -19,6 +23,10 @@ import { isMentionPartType, parseValue, } from 'react-native-controlled-mentions/dist/utils'; +import {Avatar} from '../common'; +import {normalize} from 'react-native-elements'; + +import UpArrowIcon from '../../assets/icons/up_arrow.svg'; const MentionInputControlled: FC = ({ value, @@ -32,6 +40,8 @@ const MentionInputControlled: FC = ({ onSelectionChange, + addComment, + ...textInputProps }) => { const textInput = useRef(null); @@ -40,6 +50,8 @@ const MentionInputControlled: FC = ({ const [keyboardText, setKeyboardText] = useState(''); + const {avatar} = useSelector((state: RootState) => state.user); + const validRegex = () => { if (partTypes.length === 0) { return /.*@[^ ]*$/; @@ -160,26 +172,35 @@ const MentionInputControlled: FC = ({ ).map(renderMentionSuggestions) : null} - - - {parts.map(({text, partType, data}, index) => - partType ? ( - - {text} - - ) : ( - {text} - ), - )} - - + + + + + {parts.map(({text, partType, data}, index) => + partType ? ( + + {text} + + ) : ( + {text} + ), + )} + + + + + + + + {validateInput(keyboardText) ? ( @@ -195,4 +216,36 @@ const MentionInputControlled: FC = ({ ); }; +const styles = StyleSheet.create({ + avatar: { + height: 35, + width: 35, + borderRadius: 30, + marginRight: 10, + marginLeft: '3%', + marginVertical: '2%', + // alignSelf: 'flex-end', + }, + containerStyle: { + flexDirection: 'row', + alignSelf: 'center', + alignItems: 'center', + justifyContent: 'center', + // borderWidth: 1, + height: normalize(40), + }, + submitButton: { + height: 35, + width: 35, + backgroundColor: TAGG_LIGHT_BLUE, + borderRadius: 999, + justifyContent: 'center', + alignItems: 'center', + marginRight: '3%', + marginVertical: '2%', + alignSelf: 'flex-end', + }, + text: {flex: 1}, +}); + export {MentionInputControlled}; -- cgit v1.2.3-70-g09d2