Coder Social home page Coder Social logo

Making isBarPresented = true, while its animating closed when set to false causes the popup to become bugged until open/closed again about lnpopupui HOT 12 CLOSED

leonatan avatar leonatan commented on July 18, 2024
Making isBarPresented = true, while its animating closed when set to false causes the popup to become bugged until open/closed again

from lnpopupui.

Comments (12)

LeoNatan avatar LeoNatan commented on July 18, 2024 2

There is a new version of LNPopupUI too, which will no longer display the empty image on the bar if you don't set an image.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024 1

Thanks, I’ll take a look. With 2.18, it’s supposed to gate each operation/animation. I guess it’s not as air-tight as I hoped.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

Hello,
Can you please check which version of LNPopupController you have cached in Xcode?
Please try updating to the latest version.
Thanks

from lnpopupui.

Cleover avatar Cleover commented on July 18, 2024

2.18.0, which is latest if I'm not mistaken.
image

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

This is such a hard problem to solve. The SwiftUI/UIKit bridge manages to hide this issue by either disabling interactions during the transition (sheet) or breaking animations (showing/hiding navigation bar). I'm really not sure what to do. Not sure how to throttle or maintain state across animations.

from lnpopupui.

Cleover avatar Cleover commented on July 18, 2024

Would the animation break by snapping it back to shown when interrupting the animation to close? If that's the case, I'm not personally against it, but I figure you'd prefer it to be smoother for an official release. The way it is now kinda messes with the user experience in my opinion, getting stuck in this weird shown/hidden limbo.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

The issue with interruptible animations is that the underlying LNPopupController framework was never really designed to operate like this. It used to be a user error to change state while a transition was happening. One was supposed to listen to state events (didPresent, didOpen, etc.) and throttle UI on their own, considering the state. With SwiftUI, this is not really possible, and I did try to make it somewhat interruptible, but never got it to 100%. This queue mechanism I added recently was supposed to hide this, but I guess it doesn't work as you say. Apple is doing something similar too (try showing+hiding+showing+hiding+showing a sheet very fast—it will go the same queue mechanism), but their hacks are better behaved than mine. :)

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

It's even worse. Even adding a hack at the UIKit level (just testing, not really for production), which blocks touch events while the animation is running, SwiftUI is so asynchronous that it manages to get several taps on the button before UIKit gets to run and disable interactions. 🤣 SwiftUI is just peaches.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

OK, I did something, and at least from a quick play, it seems to work correctly so far. I'll make a new LNPopupController release, so you can test to see if it solves your issues. Events are now being coalesced, so this might be enough to prevent crazy queues.

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

Please try with LNPopupController 2.18.1.

from lnpopupui.

Cleover avatar Cleover commented on July 18, 2024

Massive props, works like a charm now.
https://github.com/LeoNatan/LNPopupUI/assets/40129637/868a5727-0637-4666-b755-0ff3d4a3863f
I did add a small check on my end to make sure whenever its switched to false it checks if it should be set to true, and switch it back this has helped to update it right as it can after the animation to keep it on track.

.onChange(of: showPopupBar) { popupBarOpen in
    if !popupBarOpen {
        if queueManager.queue.count > 0 {
            showPopupBar = true
        }
    }
}

Huge Thank You!

from lnpopupui.

LeoNatan avatar LeoNatan commented on July 18, 2024

Great, thanks for confirming!
Happy coding!

from lnpopupui.

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.