joehinkle11 / Lazy-Pop-SwiftUI

Allows a swipe on any part of the screen to start an interruptible pop animation to the previous view
zlib License
193 stars 9 forks source link

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

Open keremcesme opened 3 years ago

keremcesme commented 3 years ago

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)

}
joehinkle11 commented 3 years ago

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

buluoray commented 3 years ago

I have the same issue

joehinkle11 commented 3 years ago

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

bougieL commented 3 years ago

Same issue

whereiswhere commented 2 years ago

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.

joehinkle11 commented 2 years ago

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

ssadel commented 2 years ago

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

joehinkle11 commented 2 years ago

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.

krispykalsi commented 1 year ago

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
gaohomway commented 1 year ago

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

AndrewSB commented 1 year ago

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

gaohomway commented 1 year ago

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

AndrewSB commented 1 year ago

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

gaohomway commented 1 year ago

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

AndrewSB commented 1 year ago

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

gaohomway commented 1 year ago

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

ejbills commented 1 year ago

is there any way to fix this ATM?

lukewusb commented 3 weeks ago

Hi there, just FYI, we have the same issue, which was resolved after we tried the solution from StackOverflow. We have no idea why it works, but it indeed fixes the problem.

https://stackoverflow.com/questions/78554872/swiftui-tap-gestures-not-responding-in-swiftui-view-after-uikit-interactive-tran