Reputation: 2114
When I present a sheet with SwiftUI, everything gets bolded. If I swipe a bit, the bold goes away.
Example:
.navigationBarItems(leading:
Button(action:{
self.isSheetPresented.toggle()
}) {
Text("Display")
}
.frame(width: 25, height: 45)
.sheet(isPresented: $isSheetPresented) {
Textfield("Hello", text: $binding)
})
}
Is there an easy workaround besides applying
.fontWeight(.regular) or .font(.body)
to everything?
PS: running Xcode Version 12.2 beta 3 (12B5035g) on MacOS 11.0 Beta (20A5395g)
Upvotes: 3
Views: 319
Reputation: 258443
Try to move sheet out of navigationBarItems and attach to some view inside body, like
// ... other views
.navigationBarItems(leading:
Button(action:{
self.isSheetPresented.toggle()
}) {
Text("Display")
}
.frame(width: 25, height: 45)
)
...
} // end of NavigationView
.sheet(isPresented: $isSheetPresented) { // << here !!
Textfield("Hello", text: $binding)
}
Upvotes: 7
Reputation: 53
Ok, I did some tests:
.navigationBarItems(leading:
Button(action: {self.showingSettings = true}) {
Image(systemName: "gear")
}
//.sheet(isPresented: $showingAddItem, content: {
// AddView(expirations: self.expirations)
,
trailing:
Button(action: {self.showingAddItem = true}) {
Image(systemName: "plus")
}
//.sheet(isPresented: $showingSettings, content: {
// SettingsView()
)
.sheet(isPresented: $showingAddItem, content: {
AddView(expirations: self.expirations)
})
.sheet(isPresented: $showingSettings, content: {
SettingsView()
})
But by doing so the trailing button is not working, only the leading one
Upvotes: 0