Add option to align web dialogs to top

This commit is contained in:
Eric Bailey
2025-02-17 16:21:40 -06:00
parent d805dec08f
commit 2dab545d24
3 changed files with 9 additions and 4 deletions
+5 -2
View File
@@ -41,6 +41,7 @@ export function Outer({
children, children,
control, control,
onClose, onClose,
webOptions,
}: React.PropsWithChildren<DialogOuterProps>) { }: React.PropsWithChildren<DialogOuterProps>) {
const {_} = useLingui() const {_} = useLingui()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
@@ -116,7 +117,7 @@ export function Outer({
a.inset_0, a.inset_0,
a.z_10, a.z_10,
a.align_center, a.align_center,
gtMobile ? a.p_lg : a.p_md, gtMobile ? a.p_5xl : a.p_xl,
{overflowY: 'auto'}, {overflowY: 'auto'},
]}> ]}>
<Backdrop /> <Backdrop />
@@ -124,7 +125,9 @@ export function Outer({
style={[ style={[
a.w_full, a.w_full,
a.z_20, a.z_20,
a.justify_center, webOptions?.alignTop
? undefined
: a.justify_center,
a.align_center, a.align_center,
{ {
minHeight: web('calc(90vh - 36px)') || undefined, minHeight: web('calc(90vh - 36px)') || undefined,
+3 -1
View File
@@ -60,7 +60,9 @@ export type DialogOuterProps = {
control: DialogControlProps control: DialogControlProps
onClose?: () => void onClose?: () => void
nativeOptions?: Omit<BottomSheetViewProps, 'children'> nativeOptions?: Omit<BottomSheetViewProps, 'children'>
webOptions?: {} webOptions?: {
alignTop?: boolean
}
testID?: string testID?: string
} }
+1 -1
View File
@@ -22,7 +22,7 @@ import {ReportDialogProps} from './types'
export function ReportDialog(props: ReportDialogProps) { export function ReportDialog(props: ReportDialogProps) {
return ( return (
<Dialog.Outer control={props.control}> <Dialog.Outer webOptions={{alignTop: true}} control={props.control}>
<Dialog.Handle /> <Dialog.Handle />
<ReportDialogInner {...props} /> <ReportDialogInner {...props} />
</Dialog.Outer> </Dialog.Outer>