diff --git a/Tusker/Screens/Compose/ComposeAttachmentsList.swift b/Tusker/Screens/Compose/ComposeAttachmentsList.swift index 0d2f30f5..063ca36f 100644 --- a/Tusker/Screens/Compose/ComposeAttachmentsList.swift +++ b/Tusker/Screens/Compose/ComposeAttachmentsList.swift @@ -70,7 +70,9 @@ struct ComposeAttachmentsList: View { .listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2)) } .listStyle(PlainListStyle()) + // todo: scrollDisabled doesn't remove the need for manually calculating the frame height .frame(height: totalListHeight) + .scrollDisabledIfAvailable(totalHeight: totalListHeight) .onAppear(perform: self.didAppear) .onReceive(draft.$attachments, perform: self.attachmentsChanged) } @@ -212,6 +214,16 @@ fileprivate extension View { self } } + + @available(iOS, obsoleted: 16.0) + @ViewBuilder + func scrollDisabledIfAvailable(totalHeight: CGFloat) -> some View { + if #available(iOS 16.0, *) { + self.scrollDisabled(true) + } else { + self.frame(height: totalHeight) + } + } } @available(iOS 16.0, *)