Skip to content

Commit

Permalink
Merge pull request #4261 from tloncorp/po/tlon-3321-fix-invite-people…
Browse files Browse the repository at this point in the history
…-height-issue

desktop: set a max height on the invite people modal
  • Loading branch information
patosullivan authored Dec 6, 2024
2 parents bf68409 + 6f5530b commit 8d37262
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 13 additions & 2 deletions packages/ui/src/components/ActionSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -190,7 +190,18 @@ const ActionSheetHeader = ActionSheetHeaderFrame.styleable(

const ActionSheetContent = YStack.styleable((props, ref) => {
const contentStyle = useContentStyle();
return <YStack {...contentStyle} {...props} ref={ref} />;
const { bottom } = useSafeAreaInsets();
const { height } = useWindowDimensions();
const maxHeight = height - bottom - getTokenValue('$2xl');
return (
<YStack
// prevent the modal from going off screen
maxHeight={maxHeight}
{...contentStyle}
{...props}
ref={ref}
/>
);
});

const ActionSheetScrollableContent = ({
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/components/InviteUsersSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const InviteUsersSheetComponent = ({
snapPoints={[85]}
snapPointsMode="percent"
>
<ActionSheet.Content flex={1} paddingBottom={bottom}>
<ActionSheet.Content
// prevent the modal from going off screen
flex={1}
paddingBottom={bottom}
>
<InviteUsersWidget group={group} onInviteComplete={onInviteComplete} />
</ActionSheet.Content>
</ActionSheet>
Expand Down

0 comments on commit 8d37262

Please sign in to comment.