Skip to content

Commit

Permalink
Merge pull request #17495 from ahmedGaber93/add-padding-bottom-to-mod…
Browse files Browse the repository at this point in the history
…al-base
  • Loading branch information
Alexander Mechler authored Apr 19, 2023
2 parents 20fab46 + b1affeb commit 370758d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Modal/BaseModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class BaseModal extends PureComponent {
modalContainerStyleMarginBottom: modalContainerStyle.marginBottom,
modalContainerStylePaddingTop: modalContainerStyle.paddingTop,
modalContainerStylePaddingBottom: modalContainerStyle.paddingBottom,
insets,
});

return (
Expand Down
8 changes: 6 additions & 2 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,19 @@ function getModalPaddingStyles({
modalContainerStyleMarginBottom,
modalContainerStylePaddingTop,
modalContainerStylePaddingBottom,
insets,
}) {
// use fallback value for safeAreaPaddingBottom to keep padding bottom consistent with padding top.
// More info: issue #17376
const safeAreaPaddingBottomWithFallback = insets.bottom === 0 ? (modalContainerStylePaddingTop || 0) : safeAreaPaddingBottom;
return {
marginTop: (modalContainerStyleMarginTop || 0) + (shouldAddTopSafeAreaMargin ? safeAreaPaddingTop : 0),
marginBottom: (modalContainerStyleMarginBottom || 0) + (shouldAddBottomSafeAreaMargin ? safeAreaPaddingBottom : 0),
marginBottom: (modalContainerStyleMarginBottom || 0) + (shouldAddBottomSafeAreaMargin ? safeAreaPaddingBottomWithFallback : 0),
paddingTop: shouldAddTopSafeAreaPadding
? (modalContainerStylePaddingTop || 0) + safeAreaPaddingTop
: modalContainerStylePaddingTop || 0,
paddingBottom: shouldAddBottomSafeAreaPadding
? (modalContainerStylePaddingBottom || 0) + safeAreaPaddingBottom
? (modalContainerStylePaddingBottom || 0) + safeAreaPaddingBottomWithFallback
: modalContainerStylePaddingBottom || 0,
paddingLeft: safeAreaPaddingLeft || 0,
paddingRight: safeAreaPaddingRight || 0,
Expand Down

0 comments on commit 370758d

Please sign in to comment.