Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/AutoCompleteSuggestions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {useEffect} from 'react';
// The coordinates are based on the App's height, not the device height.
// So we need to get the height from useWindowDimensions to calculate the position correctly. More details: https://github.com/Expensify/App/issues/53180
// eslint-disable-next-line no-restricted-imports
import {useWindowDimensions} from 'react-native';
import {Platform, useWindowDimensions} from 'react-native';
import useKeyboardState from '@hooks/useKeyboardState';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
Expand Down Expand Up @@ -57,7 +57,7 @@ function AutoCompleteSuggestions<TSuggestion>({measureParentContainerAndReportCu
const isSuggestionMenuAboveRef = React.useRef<boolean>(false);
const leftValue = React.useRef<number>(0);
const prevLeftValue = React.useRef<number>(0);
const {height: windowHeight, width: windowWidth} = useWindowDimensions();
const {height: baseWindowHeight, width: windowWidth} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const [suggestionHeight, setSuggestionHeight] = React.useState(0);
const [containerState, setContainerState] = React.useState(initialContainerState);
Expand All @@ -66,6 +66,10 @@ function AutoCompleteSuggestions<TSuggestion>({measureParentContainerAndReportCu
const {keyboardHeight, isKeyboardAnimatingRef} = useKeyboardState();
const {paddingBottom: bottomInset, paddingTop: topInset} = StyleUtils.getPlatformSafeAreaPadding(insets ?? undefined);

// On Android < 15, the window height does not include the system bars height, so we subtract them for now.
// TODO: Adjust position calculation once https://github.com/facebook/react-native/pull/53254 is merged (stop subtracting insets).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoontek, I believe we decided to use the RN patch, which you created upstream in the RN library.

const windowHeight = Platform.OS === 'android' && Number(Platform.Version) >= 35 ? baseWindowHeight - insets.top - insets.bottom : baseWindowHeight;

useEffect(() => {
const container = containerRef.current;
if (!container) {
Expand Down
Loading