joehinkle11 / Lazy-Pop-SwiftUI

Allows a swipe on any part of the screen to start an interruptible pop animation to the previous view

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When LazyPop is canceled, other actions in the view are disabled.

keremcesme opened this issue · comments

Hello there is a look like the following. LazyPop is active. The problem is as follows: The user can come back to the previous view by sliding from anywhere on the screen. But if the user gives up and cancels lazypop, the view locks. My "Test 2" button becomes unclickable. How can I solve this?

        Button(action: {
            // Actions:
            self.mode.wrappedValue.dismiss()
        }, label: {
            Text("Test 2")
        })
    }
    .lazyPop()
    .navigationBarHidden(true)
    .navigationBarBackButtonHidden(true)
    
}

Very odd, I would have to try it myself. Have you tried changing the order of the modifiers?

I have the same issue

Sounds like lazy pop would be too dangerous to use if it locks up UIs. If anyone finds the underlying problem, please comment here or make a PR. If I find free time I'll look into it myself

Same issue

I think I found out what's the problem is.

In my case, the culprit is the .ignoresSafeArea() modifier, if you add .ignoresSafeArea() modifier after the .lazyPop(), if would make UI locks, after remove the .ignoresSafeArea(), it won't lock anymore.

That's interesting. Can anyone else confirm this? We could add a warning in the readme about this

I found that when removing .ignoresSafeArea(), my view is still locked, but only momentarily. I can still scroll in a ScrollView, but I can't tap any buttons

Ok thank you. I'll update the readme with a gotcha about .ignoresSafeArea(). @ssadel if you find what else is causing the bug to happen in your code, then I can add another gotcha to the readme.

I'll leave the issue open until a proper workaround is found.

Found an interesting behaviour.

fromView - the view that is about to be popped but is cancelled by the user

  1. If the fromView contains any text fields, they will not be affected by the cancellation
  2. After tapping any one of them, all the buttons also start working as expected

I found that when removing .ignoresSafeArea(), my view is still locked, but only momentarily. I can still scroll in a ScrollView, but I can't tap any buttons

did you solve the problem

interestingly enough, i've come across this issue while using https://github.com/AndrewSB/SwipeTransition/tree/spm in a UIHostingController, quite similarly to how this library is implemented.

the fact that you're seeing the same issue with buttons become inactive makes me think its a limitation of SwiftUI somehow

@AndrewSB This problem still exists, do you have a solution?

nope, i'm looking for a way to get around this too

There is another question, how to handle side sliding gestures in Page?

the solution in SwipeTransition does it, go check out the UIGestureDelegate in it; it tells the gesture recognized to not begin if the view receiving the touch is a UIPage

Can you give the key code, thank you very much

If the Page gesture is detected, why not keep the original side swipe gesture, why choose not to work? The user cannot close the page

is there any way to fix this ATM?