From 8272e2d75bd1bdc9b1d28960d2e896d20ae73a21 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 9 Jul 2021 15:52:37 -0400 Subject: Fix mention box padding issue --- src/components/common/TaggTypeahead.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/components/common') diff --git a/src/components/common/TaggTypeahead.tsx b/src/components/common/TaggTypeahead.tsx index 7444e2d8..672cff69 100644 --- a/src/components/common/TaggTypeahead.tsx +++ b/src/components/common/TaggTypeahead.tsx @@ -6,7 +6,7 @@ import {SEARCH_ENDPOINT_MESSAGES} from '../../constants'; import {loadSearchResults} from '../../services'; import {RootState} from '../../store/rootReducer'; import {ProfilePreviewType} from '../../types'; -import {SCREEN_HEIGHT, SCREEN_WIDTH, shuffle} from '../../utils'; +import {isIPhoneX, SCREEN_HEIGHT, SCREEN_WIDTH, shuffle} from '../../utils'; import TaggUserRowCell from './TaggUserRowCell'; type TaggTypeaheadProps = { @@ -24,7 +24,10 @@ const TaggTypeahead: React.FC = ({ }) => { const {friends} = useSelector((state: RootState) => state.friends); const [results, setResults] = useState([]); - const [viewPx, setViewPx] = useState(0); + const [viewPxy, setViewPxy] = useState<{px: number; py: number}>({ + px: 0, + py: 0, + }); const viewRef = useRef(null); const [height, setHeight] = useState(0); const margin = component === 'comment' ? -10 : 0; @@ -46,9 +49,9 @@ const TaggTypeahead: React.FC = ({ _width: number, _height: number, px: number, - _py: number, + py: number, ) => { - setViewPx(px); + setViewPxy({px, py}); }, ); }; @@ -70,17 +73,17 @@ const TaggTypeahead: React.FC = ({ } return ( - + + {/* */} {!isShowBelowStyle && } {results.map((user) => (