Skip to content

Commit 786b7ab

Browse files
authored
Merge pull request #35319 from MrRefactor/proposal/27866
2 parents bb658c8 + 9610f7c commit 786b7ab

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type ShouldPreventScrollOnAutoCompleteSuggestion from './types';
2+
3+
const shouldPreventScrollOnAutoCompleteSuggestion: ShouldPreventScrollOnAutoCompleteSuggestion = () => false;
4+
5+
export default shouldPreventScrollOnAutoCompleteSuggestion;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type ShouldPreventScrollOnAutoCompleteSuggestion from './types';
2+
3+
const shouldPreventScrollOnAutoCompleteSuggestion: ShouldPreventScrollOnAutoCompleteSuggestion = () => true;
4+
5+
export default shouldPreventScrollOnAutoCompleteSuggestion;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as Browser from '@libs/Browser';
2+
import type ShouldPreventScrollOnAutoCompleteSuggestion from './types';
3+
4+
const isMobileSafari = Browser.isMobileSafari();
5+
6+
const shouldPreventScrollOnAutoCompleteSuggestion: ShouldPreventScrollOnAutoCompleteSuggestion = () => !isMobileSafari;
7+
8+
export default shouldPreventScrollOnAutoCompleteSuggestion;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type ShouldPreventScrollOnAutoCompleteSuggestion = () => boolean;
2+
3+
export default ShouldPreventScrollOnAutoCompleteSuggestion;

src/styles/utils/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import CONST from '@src/CONST';
1414
import type {Transaction} from '@src/types/onyx';
1515
import {defaultStyles} from '..';
1616
import type {ThemeStyles} from '..';
17+
import shouldPreventScrollOnAutoCompleteSuggestion from './autoCompleteSuggestion';
1718
import getCardStyles from './cardStyles';
1819
import containerComposeStyles from './containerComposeStyles';
1920
import FontUtils from './FontUtils';
@@ -790,20 +791,22 @@ function getBaseAutoCompleteSuggestionContainerStyle({left, bottom, width}: GetB
790791
};
791792
}
792793

794+
const shouldPreventScroll = shouldPreventScrollOnAutoCompleteSuggestion();
795+
793796
/**
794797
* Gets the correct position for auto complete suggestion container
795798
*/
796799
function getAutoCompleteSuggestionContainerStyle(itemsHeight: number): ViewStyle {
797800
'worklet';
798801

799802
const borderWidth = 2;
800-
const height = itemsHeight + 2 * CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTER_INNER_PADDING;
803+
const height = itemsHeight + 2 * CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTER_INNER_PADDING + (shouldPreventScroll ? borderWidth : 0);
801804

802805
// The suggester is positioned absolutely within the component that includes the input and RecipientLocalTime view (for non-expanded mode only). To position it correctly,
803806
// we need to shift it by the suggester's height plus its padding and, if applicable, the height of the RecipientLocalTime view.
804807
return {
805808
overflow: 'hidden',
806-
top: -(height + CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTER_PADDING + borderWidth),
809+
top: -(height + CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTER_PADDING + (shouldPreventScroll ? 0 : borderWidth)),
807810
height,
808811
minHeight: CONST.AUTO_COMPLETE_SUGGESTER.SUGGESTION_ROW_HEIGHT,
809812
};

0 commit comments

Comments
 (0)