-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] - iOS 15, dismissal is not working, if the showModal toggles within onAppear function of the view. #101
Comments
omg my apologies i completely forgot about this 🤦♂️ this bug needs to be fixed ASAP i will get to it this weekend |
@jevonmao Hey, I am not really sure if you have fixed the problem yet. But, the issue is not present in |
@sapoepsilon thank you letting me know that the bug is only for modal. I'm still working on fixing it. Thank you and the community for all the understanding. |
@sapoepsilon This is the code I tried to reproduce with, and it seems like the bug isn't present on Xcode 13.1 simulator. Is there something I'm missing? import SwiftUI
import PermissionsSwiftUINotification
import PermissionsSwiftUIHealth
import HealthKit
@available(iOS 13.0, *)
struct ContentView: View {
@State private var showModal: Bool = false
let healths = Set([HKObjectType.workoutType()])
var body: some View {
VStack {
Text("Hello World")
}
.JMModal(showModal: $showModal, for: [.health(categories: .init(readAndWrite: healths)), .notification], restrictDismissal: true)
.onAppear {
showModal = true
}
}
} |
Hey, it is still present in my code, when switched it from .JMAlert to .JMModal. I have no clue what's causing this, but my code structure is something like this:
If this won't trigger it, then probably something in my code is triggering this behavior. Weirdly enough this bug is not present with the .JMAlert. I will continue to debug, and let you know what exactly is causing this behavior |
As far as I can see the problem occurs when the JMModal is hooked into nested views. Or when hooked into a nested view it allows to disappear by scrolling down. Pulling the JMModal up in your view hierarchy should help. @jevonmao Displaying JMModal sheet always on a topmost view controller instead of a bodyView would be a possible solution. |
Way to go @konradgalczynski07 ! Thanks you so much for debugging the strange behavior. Pulling the modifier up top of view hierarchy (i'm not sure if there is a reason to nest it anyway) will be the best solution for now until we figure out a fix in PermissionsSwiftUI. |
Hello, any news to fix the bug friend? it's still happening for iOS16+ |
I had to switch to cocoapods version and I started seeing this - I ask for 2 permissions but alert is dismissed after allowing only one. |
@erikhric The alert is dismissed after only one allow? Do you mind elaborating on the bug you are facing? If this is separate from the dismissal bug in this issue, and unfixable by pulling out the modifier to higher view hierarchy, I will open a new issue and look into this separately. |
@Dave181295 Can you share the code where this bug still appears? Code used: NavigationView {
ScrollView {
Button(action: {}, label: {
Text("Test button")
})
.JMModal(showModal: $showPermissions, for: [.siri])
}
.navigationTitle("Test")
.onAppear {
showPermissions = true
}
} |
Describe the bug
A clear and concise description of what the bug is.
This bug only present on iOS 15. When, the showModal boolean is set to true in .onAppear. It is not possible to dismiss the modal, unless
restrictDismissal
is set to false.To Reproduce
Steps to reproduce the behavior:
Great example would be:
Expected behavior
A clear and concise description of what you expected to happen.
Modal with permissions will disappear when the "close" button is pressed
Screenshots
![ios15BUG](https://user-images.githubusercontent.com/47342870/137643185-506b28b3-820f-4f1a-8928-f6910532c8dc.gif)
If applicable, add screenshots to help explain your problem.
Attached GIF recording of the issue
*Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The issue is present in the simulator and in the physical device.
The text was updated successfully, but these errors were encountered: