From b0e319b3965806c5752da23d446c165fd858b1a5 Mon Sep 17 00:00:00 2001 From: Diogo Date: Mon, 16 Dec 2024 22:47:56 +0000 Subject: [PATCH] fraction on long press --- apps/ios/Shared/Views/ChatList/ChatListView.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 43f9cdb19b..c9f5652bf5 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -718,6 +718,16 @@ struct ChatTagsView: View { setActiveFilter(filter: .userTag(tag: tag)) } .onLongPressGesture { + let fraction: Double + + switch chatTagsModel.userTags.count { + case 0..<4: + fraction = 0.35 + case 4..<9: + fraction = 0.7 + default: + fraction = 1 + } sheet = SomeSheet( content: { AnyView( @@ -726,7 +736,8 @@ struct ChatTagsView: View { } ) }, - id: "tag list" + id: "tag list", + fraction: fraction ) } } @@ -757,7 +768,7 @@ struct ChatTagsView: View { } .sheet(item: $sheet) { if #available(iOS 16.0, *) { - $0.content.presentationDetents([.fraction(0.3)]) + $0.content.presentationDetents([.fraction($0.fraction)]) } else { $0.content }