Giter Club home page Giter Club logo

Comments (11)

konradgalczynski07 avatar konradgalczynski07 commented on May 20, 2024 3

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.

navigationView

Or when hooked into a nested view it allows to disappear by scrolling down.

innerView

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.

Dave181295 avatar Dave181295 commented on May 20, 2024 1

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.

jevonmao avatar jevonmao commented on May 20, 2024

omg my apologies i completely forgot about this 🤦‍♂️ this bug needs to be fixed ASAP i will get to it this weekend

from permissionsswiftui.

sapoepsilon avatar sapoepsilon commented on May 20, 2024

@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.

jevonmao avatar jevonmao commented on May 20, 2024

@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.

jevonmao avatar jevonmao commented on May 20, 2024

@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.

sapoepsilon avatar sapoepsilon commented on May 20, 2024

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.

jevonmao avatar jevonmao commented on May 20, 2024

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.

erikhric avatar erikhric commented on May 20, 2024

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.

jevonmao avatar jevonmao commented on May 20, 2024

@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.

jevonmao avatar jevonmao commented on May 20, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.