refactor: safe area inset fallback (#2329)

This commit is contained in:
Aman Harwara
2023-05-10 15:59:45 +05:30
committed by GitHub
parent 8c3a2d3bc8
commit b506137655
6 changed files with 49 additions and 22 deletions

View File

@@ -8,9 +8,9 @@ import { useDisableBodyScrollOnMobile } from '@/Hooks/useDisableBodyScrollOnMobi
import { useAndroidBackHandler } from '@/NativeMobileWeb/useAndroidBackHandler'
import Modal from '../Modal/Modal'
import { classNames } from '@standardnotes/snjs'
import { isIOS } from '@/Utils'
import { useCommandService } from '../CommandProvider'
import { ESCAPE_COMMAND } from '@standardnotes/ui-services'
import { useAvailableSafeAreaPadding } from '@/Hooks/useSafeAreaPadding'
const PreferencesView: FunctionComponent<PreferencesProps> = ({
application,
@@ -56,6 +56,8 @@ const PreferencesView: FunctionComponent<PreferencesProps> = ({
})
}, [commandService, closePreferences])
const { hasTopInset } = useAvailableSafeAreaPadding()
return (
<Modal
close={closePreferences}
@@ -68,7 +70,7 @@ const PreferencesView: FunctionComponent<PreferencesProps> = ({
<div
className={classNames(
'flex w-full flex-row items-center justify-between border-b border-solid border-border bg-default px-3 pb-2 md:p-3',
isIOS() ? 'pt-safe-top' : 'pt-2',
hasTopInset ? 'pt-safe-top' : 'pt-2',
)}
>
<div className="hidden h-8 w-8 md:block" />