Skip to content

Commit ffc5170

Browse files
committed
Added a fix for the cropped rows on macOS 11.3
This is clearly a SwiftUI bug and it has been reported with FB9092071
1 parent f73c1ac commit ffc5170

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

OpenHaystack/OpenHaystack/HaystackApp/Views/AccessoryListEntry.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct AccessoryListEntry: View {
6464
.fill(accessory.isNearby ? Color.green : accessory.isActive ? Color.orange : Color.red)
6565
.frame(width: 8, height: 8)
6666
}
67+
.listRowBackground(Color.clear)
6768
.padding(EdgeInsets(top: 5, leading: 0, bottom: 5, trailing: 0))
6869
.contextMenu {
6970
Button("Delete", action: { self.delete(accessory) })

OpenHaystack/OpenHaystack/HaystackApp/Views/ManageAccessoriesView.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ struct ManageAccessoriesView: View {
5656

5757
/// Accessory List view.
5858
var accessoryList: some View {
59+
5960
List(self.accessories, id: \.self, selection: $focusedAccessory) { accessory in
6061
AccessoryListEntry(
6162
accessory: accessory,
@@ -74,9 +75,10 @@ struct ManageAccessoriesView: View {
7475
alertType: self.$alertType,
7576
delete: self.delete(accessory:),
7677
deployAccessoryToMicrobit: self.deploy(accessory:),
77-
zoomOn: { self.focusedAccessory = $0 })
78+
zoomOn: { self.focusedAccessory = $0 }
79+
)
7880
}
79-
.listStyle(SidebarListStyle())
81+
.listStyle(PlainListStyle())
8082

8183
}
8284

@@ -271,3 +273,11 @@ struct ManageAccessoriesView_Previews: PreviewProvider {
271273
ManageAccessoriesView(alertType: self.$alertType, focusedAccessory: self.$focussed, accessoryToDeploy: self.$deploy, showESP32DeploySheet: self.$showESPSheet)
272274
}
273275
}
276+
277+
//FIXME: This is a workaround, because the List with Default style (and clear background) started to crop the rows on macOS 11.3
278+
extension NSTableView {
279+
open override func viewDidMoveToWindow() {
280+
super.viewDidMoveToWindow()
281+
self.backgroundColor = .clear
282+
}
283+
}

0 commit comments

Comments
 (0)