Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/components/Modal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function BaseModal(
shouldPreventScroll={shouldPreventScrollOnFocus}
>
<View
style={[styles.defaultModalContainer, modalPaddingStyles, modalContainerStyle, !isVisible && styles.pointerEventsNone]}
style={[styles.defaultModalContainer, modalContainerStyle, modalPaddingStyles, !isVisible && styles.pointerEventsNone]}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to switch this up because modalContainerStyle will override the padding style from modalPaddingStyles. modalPaddingStyles contains the modalContainerStyle padding + safe area.

Copy link
Contributor

Choose a reason for hiding this comment

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

Switching these styles will make the modal always have padding, causing a larger blank space in some modals. More details here #60779 (comment)

ref={ref}
>
<ColorSchemeWrapper>{children}</ColorSchemeWrapper>
Expand Down
4 changes: 1 addition & 3 deletions src/components/Search/SearchRouter/SearchRouterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import FocusTrapForModal from '@components/FocusTrap/FocusTrapForModal';
import KeyboardAvoidingView from '@components/KeyboardAvoidingView';
import Modal from '@components/Modal';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useThemeStyles from '@hooks/useThemeStyles';
import useViewportOffsetTop from '@hooks/useViewportOffsetTop';
import useWindowDimensions from '@hooks/useWindowDimensions';
Expand All @@ -20,7 +19,6 @@ function SearchRouterModal() {
const {windowHeight} = useWindowDimensions();
const {isSearchRouterDisplayed, closeSearchRouter} = useSearchRouterContext();
const viewportOffsetTop = useViewportOffsetTop();
const safeAreaInsets = useSafeAreaInsets();

// On mWeb Safari, the input caret stuck for a moment while the modal is animating. So, we hide the caret until the animation is done.
const [shouldHideInputCaret, setShouldHideInputCaret] = useState(isMobileWebSafari);
Expand All @@ -31,7 +29,7 @@ function SearchRouterModal() {
<Modal
type={modalType}
isVisible={isSearchRouterDisplayed}
innerContainerStyle={{paddingTop: safeAreaInsets.top + viewportOffsetTop}}
innerContainerStyle={{paddingTop: viewportOffsetTop}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the extra top insets after switching the modalPaddingStyles position.

popoverAnchorPosition={{right: 6, top: 6}}
fullscreen
propagateSwipe
Expand Down
1 change: 1 addition & 0 deletions src/styles/utils/generators/ModalStyleUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ const createModalStyleUtils: StyleUtilGenerator<GetModalStylesStyleUtil> = ({the
borderTopLeftRadius: variables.componentBorderRadiusLarge,
borderTopRightRadius: variables.componentBorderRadiusLarge,
paddingTop: variables.componentBorderRadiusLarge,
paddingBottom: variables.componentBorderRadiusLarge,
justifyContent: 'center',
overflow: 'hidden',
boxShadow: theme.shadow,
Expand Down
2 changes: 1 addition & 1 deletion src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ function getModalPaddingStyles({
marginTop: getCombinedSpacing(modalContainerStyle.marginTop, safeAreaPaddingTop, shouldAddTopSafeAreaMargin),
marginBottom: getCombinedSpacing(modalContainerStyle.marginBottom, safeAreaPaddingBottomWithFallback, shouldAddBottomSafeAreaMargin),
paddingTop: getCombinedSpacing(modalContainerStyle.paddingTop, safeAreaPaddingTop, shouldAddTopSafeAreaPadding),
paddingBottom: getCombinedSpacing(modalContainerStyle.paddingBottom, safeAreaPaddingBottomWithFallback, shouldAddBottomSafeAreaPadding),
paddingBottom: getCombinedSpacing(modalContainerStyle.paddingBottom, safeAreaPaddingBottom, shouldAddBottomSafeAreaPadding),
paddingLeft: safeAreaPaddingLeft ?? 0,
paddingRight: safeAreaPaddingRight ?? 0,
};
Expand Down
Loading