diff --git a/app/components/post_draft/post_draft.tsx b/app/components/post_draft/post_draft.tsx index dd7343e52..657657574 100644 --- a/app/components/post_draft/post_draft.tsx +++ b/app/components/post_draft/post_draft.tsx @@ -52,6 +52,7 @@ function PostDraft({ const [postInputTop, setPostInputTop] = useState(0); const [isFocused, setIsFocused] = useState(false); const keyboardHeight = useKeyboardHeight(); + const kbHeight = Platform.OS === 'ios' ? keyboardHeight : 0; // useKeyboardHeight is already deducting the keyboard height on Android const headerHeight = useDefaultHeaderHeight(); const serverUrl = useServerUrl(); @@ -61,9 +62,8 @@ function PostDraft({ setCursorPosition(message.length); }, [channelId, rootId]); - const autocompletePosition = AUTOCOMPLETE_ADJUST + keyboardHeight + postInputTop; + const autocompletePosition = AUTOCOMPLETE_ADJUST + kbHeight + postInputTop; const autocompleteAvailableSpace = containerHeight - autocompletePosition - (isChannelScreen ? headerHeight : 0); - const [animatedAutocompletePosition, animatedAutocompleteAvailableSpace] = useAutocompleteDefaultAnimatedValues(autocompletePosition, autocompleteAvailableSpace); if (channelIsArchived || deactivatedChannel) { diff --git a/app/hooks/autocomplete.ts b/app/hooks/autocomplete.ts index 0e4e234b1..0ef95f272 100644 --- a/app/hooks/autocomplete.ts +++ b/app/hooks/autocomplete.ts @@ -10,11 +10,11 @@ export const useAutocompleteDefaultAnimatedValues = (position: number, available useEffect(() => { animatedPosition.value = position; - }, [position]); + }, [position, animatedPosition]); useEffect(() => { animatedAvailableSpace.value = availableSpace; - }, [availableSpace]); + }, [availableSpace, animatedAvailableSpace]); return [animatedPosition, animatedAvailableSpace]; };