Use iOS 16 API for disabling compose attachment list scrolling
This commit is contained in:
parent
5b70c713b2
commit
5a5364ad3b
|
@ -70,7 +70,9 @@ struct ComposeAttachmentsList: View {
|
||||||
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
.listRowInsets(EdgeInsets(top: cellPadding / 2, leading: cellPadding / 2, bottom: cellPadding / 2, trailing: cellPadding / 2))
|
||||||
}
|
}
|
||||||
.listStyle(PlainListStyle())
|
.listStyle(PlainListStyle())
|
||||||
|
// todo: scrollDisabled doesn't remove the need for manually calculating the frame height
|
||||||
.frame(height: totalListHeight)
|
.frame(height: totalListHeight)
|
||||||
|
.scrollDisabledIfAvailable(totalHeight: totalListHeight)
|
||||||
.onAppear(perform: self.didAppear)
|
.onAppear(perform: self.didAppear)
|
||||||
.onReceive(draft.$attachments, perform: self.attachmentsChanged)
|
.onReceive(draft.$attachments, perform: self.attachmentsChanged)
|
||||||
}
|
}
|
||||||
|
@ -212,6 +214,16 @@ fileprivate extension View {
|
||||||
self
|
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, *)
|
@available(iOS 16.0, *)
|
||||||
|
|
Loading…
Reference in New Issue