LeoNatan / LNPopupUI

A SwiftUI library for presenting views as popups, much like the Apple Music and Podcasts apps.
MIT License
320 stars 29 forks source link

Using a custom view for the popup bar breaks presentation/dismiss animations #14

Closed danwilliams64 closed 2 years ago

danwilliams64 commented 2 years ago

Describe the Bug When using a custom view for the popup bar, the presentation and dismiss animations do not appear correctly. This is happening on the iOS 15.4 simulator and device using the latest version of Xcode (13.3.1).

To Reproduce

  1. In the example project, modify the MusicScene to use a custom popup bar (see code block below for the one I used).
  2. Present the popup bar by clicking on a track.
  3. Notice the presentation animation starts higher than where it finishes and slides down to attach itself to the bottom safe area guide.
  4. This happens with and without using a TabView.

Expected Behavior The animation should behave the same as when using the built-in popup bars.

Screenshots LNPopupUI-CustomView

Additional Context Thanks for the amazing library! This is the modified custom popup bar from the MapScene that I used:

    .popupBarCustomView(wantsDefaultTapGesture: false, wantsDefaultPanGesture: false, wantsDefaultHighlightGesture: false) {
      ZStack(alignment: .trailing) {
        HStack {
          Button("Dismiss Bar") { isPopupBarPresented = false }
          Spacer()
          Button(action: {
            isPopupOpen.toggle()
          }, label: {
            Image(systemName: "chevron.up")
              .renderingMode(.template)
          })
        }
        .padding()
      }
    }
LeoNatan commented 2 years ago

I will take a look soon. Thanks!

LeoNatan commented 2 years ago

Yeah, I reproduced it. Investigating.

LeoNatan commented 2 years ago

Fixed in 1.3.2. Enjoy!

danwilliams64 commented 2 years ago

Thank you!