mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Reset isPresented binding after dismissing picker
This commit is contained in:
parent
c99df92c6b
commit
7e6997a821
@ -17,7 +17,10 @@ struct ActivePostToolbarView: View {
|
||||
)
|
||||
.disabled(activePost.status == PostStatus.local.rawValue)
|
||||
.popover(isPresented: $isPresentingSharingServicePicker) {
|
||||
PostEditorSharingPicker(sharingItems: createPostUrl())
|
||||
PostEditorSharingPicker(
|
||||
isPresented: $isPresentingSharingServicePicker,
|
||||
sharingItems: createPostUrl()
|
||||
)
|
||||
}
|
||||
Button(action: { publishPost(activePost) }, label: { Image(systemName: "paperplane") })
|
||||
.disabled(activePost.body.isEmpty || activePost.status == PostStatus.published.rawValue)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PostEditorSharingPicker: NSViewRepresentable {
|
||||
@Binding var isPresented: Bool
|
||||
var sharingItems: [Any] = []
|
||||
|
||||
func makeNSView(context: Context) -> some NSView {
|
||||
@ -32,6 +33,7 @@ struct PostEditorSharingPicker: NSViewRepresentable {
|
||||
didChoose service: NSSharingService?
|
||||
) {
|
||||
sharingServicePicker.delegate = nil
|
||||
self.owner.isPresented = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user