Comments (11)
As far as I can see the problem occurs when the JMModal is hooked into nested views.
In such a scenario, I found some strange behavior, for example that if it is pinned to a NavigationView, the modal is only removed if the user clicks the "Allowed" button again after allowing permissions.
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.
from permissionsswiftui.
Hello, any news to fix the bug friend? it's still happening for iOS16+
need to tap multiples times on the allowed permission
from permissionsswiftui.
omg my apologies i completely forgot about this 🤦♂️ this bug needs to be fixed ASAP i will get to it this weekend
from permissionsswiftui.
@jevonmao Hey, I am not really sure if you have fixed the problem yet. But, the issue is not present in
.JMMALERT()
just a heads up.
from permissionsswiftui.
@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.
from permissionsswiftui.
@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
}
}
}
from permissionsswiftui.
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:
import SwiftUI
import PermissionsSwiftUINotification
import PermissionsSwiftUIHealth
import HealthKit
struct ContentView: View {
@State private var showModal: Bool = false
let healths = Set([HKObjectType.workoutType()])
var body: some View {
ZStack {
GeometryReader { geo in
ZStack {
Text("Hello World")
}
}
}
.JMModal(showModal: $showModal, for: [.health(categories: .init(readAndWrite: healths)), .notification], restrictDismissal: true)
.onAppear {
showModal = true
}
}
}
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
from permissionsswiftui.
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.
from permissionsswiftui.
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.
from permissionsswiftui.
@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.
from permissionsswiftui.
@Dave181295 Can you share the code where this bug still appears?
I tried to reproduce cases of calling JMModal
within nested view, as well as attached to a NavigationView
. Neither was reproducible on 16.4.
Code used:
NavigationView {
ScrollView {
Button(action: {}, label: {
Text("Test button")
})
.JMModal(showModal: $showPermissions, for: [.siri])
}
.navigationTitle("Test")
.onAppear {
showPermissions = true
}
}
from permissionsswiftui.
Related Issues (20)
- [BUG] - Type 'Array<PermissionType.PermissionManager>.ArrayLiteralElement' (aka 'PermissionType.PermissionManager') has no member 'locationAlways' HOT 1
- [BUG] - Apple rejects Alert because button title is Allow and not Continue or Next HOT 2
- [BUG] - The package product 'Introspect' requires minimum platform version 13.0 for the iOS platform, but this target supports 11.0 HOT 10
- [BUG] - Error while building using SPM HOT 2
- [BUG] - Text elements passed as string should handle attributed content HOT 1
- 如果使用Environment来配置本地化会更好。 HOT 4
- [BUG] - Xcode 14.3.1 HOT 2
- iOS 17 Support HOT 5
- [ Reject] - Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage HOT 1
- [BUG] - Phrase "button_next" is not translated
- [BUG] - ITMS-90683: Missing purpose string in Info.plist HOT 3
- Access to modal view (to use in custom onboarding)
- [BUG] - Photo library authorization doesnt work for limited access HOT 3
- [BUG] - Xcode Dependencies Package cannot uncheck permissions HOT 1
- [BUG] - @Environment(\.scenePhase) breaks JMModal authorization Status and autoDismiss HOT 1
- Build requests into another view
- Add ScreenTime permission
- [BUG] - incompatible with recent versions of SwiftUI-Introspect HOT 1
- [BUG] - Library conflict problem
- [BUG] - AutoDismiss does not work.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permissionsswiftui.