Skip to content

Commit 23f6bfe

Browse files
authored
Merge pull request Expensify#63304 from nkdengineer/fix/62573
fix: in bottom modal option is partially hidden
2 parents 980163f + 6d7aa3e commit 23f6bfe

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/components/ButtonWithDropdownMenu/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Icon from '@components/Icon';
77
import * as Expensicons from '@components/Icon/Expensicons';
88
import PopoverMenu from '@components/PopoverMenu';
99
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
10+
import useResponsiveLayout from '@hooks/useResponsiveLayout';
1011
import useStyleUtils from '@hooks/useStyleUtils';
1112
import useTheme from '@hooks/useTheme';
1213
import useThemeStyles from '@hooks/useThemeStyles';
@@ -60,6 +61,7 @@ function ButtonWithDropdownMenu<IValueType>({
6061
const [popoverAnchorPosition, setPopoverAnchorPosition] = useState<AnchorPosition | null>(defaultPopoverAnchorPosition);
6162
const {windowWidth, windowHeight} = useWindowDimensions();
6263
const dropdownAnchor = useRef<View | null>(null);
64+
const {shouldUseNarrowLayout} = useResponsiveLayout();
6365
// eslint-disable-next-line react-compiler/react-compiler
6466
const dropdownButtonRef = isSplitButton ? buttonRef : mergeRefs(buttonRef, dropdownAnchor);
6567
const selectedItem = options.at(selectedItemIndex) ?? options.at(0);
@@ -228,6 +230,9 @@ function ButtonWithDropdownMenu<IValueType>({
228230
// eslint-disable-next-line react-compiler/react-compiler
229231
anchorRef={nullCheckRef(dropdownAnchor)}
230232
withoutOverlay
233+
shouldUseScrollView
234+
scrollContainerStyle={shouldUseNarrowLayout && styles.pv4}
235+
shouldUseModalPaddingStyle={false}
231236
anchorAlignment={anchorAlignment}
232237
headerText={menuHeaderText}
233238
menuItems={options.map((item, index) => ({

src/components/Modal/BaseModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ function BaseModal(
212212
popoverAnchorPosition,
213213
innerContainerStyle,
214214
outerStyle,
215+
shouldUseModalPaddingStyle,
215216
),
216-
[StyleUtils, type, windowWidth, windowHeight, isSmallScreenWidth, popoverAnchorPosition, innerContainerStyle, outerStyle],
217+
[StyleUtils, type, windowWidth, windowHeight, isSmallScreenWidth, popoverAnchorPosition, innerContainerStyle, outerStyle, shouldUseModalPaddingStyle],
217218
);
218219

219220
const modalPaddingStyles = useMemo(() => {

src/styles/utils/generators/ModalStyleUtils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ type GetModalStylesStyleUtil = {
4141
popoverAnchorPosition?: ViewStyle,
4242
innerContainerStyle?: ViewStyle,
4343
outerStyle?: ViewStyle,
44+
shouldUseModalPaddingStyle?: boolean,
4445
) => GetModalStyles;
4546
};
4647

4748
const createModalStyleUtils: StyleUtilGenerator<GetModalStylesStyleUtil> = ({theme, styles}) => ({
48-
getModalStyles: (type, windowDimensions, popoverAnchorPosition = {}, innerContainerStyle = {}, outerStyle = {}): GetModalStyles => {
49+
getModalStyles: (type, windowDimensions, popoverAnchorPosition = {}, innerContainerStyle = {}, outerStyle = {}, shouldUseModalPaddingStyle = true): GetModalStyles => {
4950
const {windowWidth, isSmallScreenWidth} = windowDimensions;
5051

5152
let modalStyle: GetModalStyles['modalStyle'] = {
@@ -212,13 +213,16 @@ const createModalStyleUtils: StyleUtilGenerator<GetModalStylesStyleUtil> = ({the
212213
width: '100%',
213214
borderTopLeftRadius: variables.componentBorderRadiusLarge,
214215
borderTopRightRadius: variables.componentBorderRadiusLarge,
215-
paddingTop: variables.componentBorderRadiusLarge,
216-
paddingBottom: variables.componentBorderRadiusLarge,
217216
justifyContent: 'center',
218217
overflow: 'hidden',
219218
boxShadow: theme.shadow,
220219
};
221220

221+
if (shouldUseModalPaddingStyle) {
222+
modalContainerStyle.paddingTop = variables.componentBorderRadiusLarge;
223+
modalContainerStyle.paddingBottom = variables.componentBorderRadiusLarge;
224+
}
225+
222226
shouldAddBottomSafeAreaPadding = true;
223227
swipeDirection = undefined;
224228
animationIn = 'slideInUp';

0 commit comments

Comments
 (0)