Skip to content

Commit

Permalink
Merge pull request #22 from jfpalacios/bugfix-looped-dismissal
Browse files Browse the repository at this point in the history
Fix dismissal of presentedViewController by other views
  • Loading branch information
izyumkin authored Sep 2, 2023
2 parents d77f5c6 + 48e7e7a commit 26a1a88
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ public struct MCEmojiPickerRepresentableController: UIViewControllerRepresentabl
context.coordinator.addPickerDismissingObserver()
representableController.present(emojiPicker, animated: true)
case false:
if representableController.presentedViewController is MCEmojiPickerViewController {
if representableController.presentedViewController is MCEmojiPickerViewController && context.coordinator.isPresented {
representableController.presentedViewController?.dismiss(animated: true)
}
}
context.coordinator.isPresented = isPresented
}
}

Expand All @@ -137,6 +138,7 @@ extension MCEmojiPickerRepresentableController {
public class Coordinator: NSObject, MCEmojiPickerDelegate {

public var isNewEmojiSet = false
public var isPresented = false

private var representableController: MCEmojiPickerRepresentableController

Expand Down

0 comments on commit 26a1a88

Please sign in to comment.