mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Reduces reliance on presentationMode to dismiss
Bindings are passed instead and this fixes issues with Add Web (etc) only appearing once.
This commit is contained in:
@@ -12,8 +12,8 @@ import RSCore
|
||||
|
||||
struct AddFolderView: View {
|
||||
|
||||
@Environment(\.presentationMode) private var presentationMode
|
||||
@ObservedObject private var viewModel = AddFolderModel()
|
||||
@Binding var isPresented: Bool
|
||||
|
||||
var body: some View {
|
||||
#if os(iOS)
|
||||
@@ -21,16 +21,14 @@ struct AddFolderView: View {
|
||||
.onReceive(viewModel.$shouldDismiss, perform: {
|
||||
dismiss in
|
||||
if dismiss == true {
|
||||
presentationMode
|
||||
.wrappedValue
|
||||
.dismiss()
|
||||
isPresented = false
|
||||
}
|
||||
})
|
||||
#else
|
||||
macForm
|
||||
.onReceive(viewModel.$shouldDismiss, perform: { dismiss in
|
||||
if dismiss == true {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
isPresented = false
|
||||
}
|
||||
})
|
||||
#endif
|
||||
@@ -50,7 +48,7 @@ struct AddFolderView: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarItems(
|
||||
leading:Button("Cancel", action: {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
isPresented = false
|
||||
}
|
||||
)
|
||||
.help("Cancel Adding Folder"),
|
||||
@@ -113,7 +111,7 @@ struct AddFolderView: View {
|
||||
}
|
||||
Spacer()
|
||||
Button("Cancel", action: {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
isPresented = false
|
||||
})
|
||||
.help("Cancel Adding Folder")
|
||||
|
||||
@@ -125,9 +123,3 @@ struct AddFolderView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AddFolderView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AddFolderView()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user