From c4ef7863f90795105661a639f1750a6b55e252ee Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Fri, 6 Dec 2024 07:16:46 -0600 Subject: [PATCH 1/2] desktop: set a max height on the invite people modal --- packages/ui/src/components/InviteUsersSheet.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/InviteUsersSheet.tsx b/packages/ui/src/components/InviteUsersSheet.tsx index bb18c0e367..8a47b16e6a 100644 --- a/packages/ui/src/components/InviteUsersSheet.tsx +++ b/packages/ui/src/components/InviteUsersSheet.tsx @@ -1,6 +1,7 @@ import * as db from '@tloncorp/shared/db'; import React, { useRef } from 'react'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import { getTokenValue, useWindowDimensions } from 'tamagui'; import { ActionSheet } from './ActionSheet'; import { InviteUsersWidget } from './InviteUsersWidget'; @@ -18,6 +19,8 @@ const InviteUsersSheetComponent = ({ }) => { const { bottom } = useSafeAreaInsets(); const hasOpened = useRef(open); + const { height } = useWindowDimensions(); + const maxHeight = height - bottom - getTokenValue('$2xl'); if (!hasOpened.current && open) { hasOpened.current = true; @@ -32,7 +35,12 @@ const InviteUsersSheetComponent = ({ snapPoints={[85]} snapPointsMode="percent" > - + From 6f5530bd704d8981a0034badfefd86cba92ad799 Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Fri, 6 Dec 2024 09:42:25 -0600 Subject: [PATCH 2/2] set max height for all ActionSheetContent instead of just InviteUsersSheet --- packages/ui/src/components/ActionSheet.tsx | 15 +++++++++++++-- packages/ui/src/components/InviteUsersSheet.tsx | 4 ---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/ui/src/components/ActionSheet.tsx b/packages/ui/src/components/ActionSheet.tsx index a5215b80a5..fc3a513b19 100644 --- a/packages/ui/src/components/ActionSheet.tsx +++ b/packages/ui/src/components/ActionSheet.tsx @@ -8,7 +8,7 @@ import { useMemo, useRef, } from 'react'; -import { Modal } from 'react-native'; +import { Modal, useWindowDimensions } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { Dialog, @@ -190,7 +190,18 @@ const ActionSheetHeader = ActionSheetHeaderFrame.styleable( const ActionSheetContent = YStack.styleable((props, ref) => { const contentStyle = useContentStyle(); - return ; + const { bottom } = useSafeAreaInsets(); + const { height } = useWindowDimensions(); + const maxHeight = height - bottom - getTokenValue('$2xl'); + return ( + + ); }); const ActionSheetScrollableContent = ({ diff --git a/packages/ui/src/components/InviteUsersSheet.tsx b/packages/ui/src/components/InviteUsersSheet.tsx index 8a47b16e6a..f726bc50e9 100644 --- a/packages/ui/src/components/InviteUsersSheet.tsx +++ b/packages/ui/src/components/InviteUsersSheet.tsx @@ -1,7 +1,6 @@ import * as db from '@tloncorp/shared/db'; import React, { useRef } from 'react'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; -import { getTokenValue, useWindowDimensions } from 'tamagui'; import { ActionSheet } from './ActionSheet'; import { InviteUsersWidget } from './InviteUsersWidget'; @@ -19,8 +18,6 @@ const InviteUsersSheetComponent = ({ }) => { const { bottom } = useSafeAreaInsets(); const hasOpened = useRef(open); - const { height } = useWindowDimensions(); - const maxHeight = height - bottom - getTokenValue('$2xl'); if (!hasOpened.current && open) { hasOpened.current = true; @@ -37,7 +34,6 @@ const InviteUsersSheetComponent = ({ >