Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popup from bottom does not always animate in the correct direction #93

Closed
jtressle opened this issue Jan 19, 2023 · 13 comments
Closed

Popup from bottom does not always animate in the correct direction #93

jtressle opened this issue Jan 19, 2023 · 13 comments

Comments

@jtressle
Copy link

Hi,

I just updated to version 2.0.0, and I'm having issues with the following popup animating correctly.

.popup(isPresented: $showingMenu, view: { menu() }, customize: { $0 .type(.toast) .position(.bottom) .closeOnTap(true) .closeOnTapOutside(true) .backgroundColor(.black.opacity(0.4)) })

I'm toggling showingMenu from a navigation button, and have placed the above code onto a ZStack.

The first time I click my button, the menu animates correctly from the bottom. All subsequent button presses have the menu animating from the top down. This was not occurring in version 1.3.

Again, many thanks for this library.

Thanks,

@jtressle
Copy link
Author

Closing this for now because I think my main view is causing this issue. I'll report back any findings.

@jtressle jtressle reopened this Jan 20, 2023
@jtressle
Copy link
Author

I'm reopening this issue, but I still don't have a concrete reason why the bottom toast fails to animate correctly on my app, but not on the example app.

My view hierarchy is basically:

ZStack { NavigationView { Color.white .edgesIgnoringSafeArea(.bottom) .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .principal) { Image("icon") .colorMultiply(Color.primary) .padding() } .navigationBarItems( leading: Button(action:{ [weak viewModel] in self.actionSheets.show1 = true }) { Image(systemName: "") } .buttonStyle(PlainButtonStyle()) , trailing: Button { self.actionSheets.show2 = true } label: { Image("") } ) } } } .popup(isPresented: $actionSheets.show1, type: .toast, position: .bottom, closeOnTap: true, closeOnTapOutside: true, backgroundColor: .black.opacity(0.4), view: { actionSheet1() }) .popup(isPresented: $actionSheets.show2, type: .toast, position: .bottom, closeOnTap: true, closeOnTapOutside: true, backgroundColor: .black.opacity(0.4), view: { actionSheet2() })

Both 1.3.1 and 2.0.0 have the same issue. It's also interesting that actionSheet2() is more prone to animating wrong. Also, sorry if the example above has syntax errors. It's just a high-level example.

Thanks

@f3dm76
Copy link
Collaborator

f3dm76 commented Jan 20, 2023

Hey @jtressle since it works as expected in the example app, I cannot really help you unless you provide a compilable minimal reproducible example. Could you please attach such an example? Have a nice day

@jtressle
Copy link
Author

Hi @f3dm76, I was able to reproduce the issue with this example. In the iOS example app, replace line 14 ContentView() with ContentViewExample(). On my device, clicking on "First" will animate the ActionSheetFirst from the top down. I've also attached a video showing the issue.

My device is running 16.2.

Hope this helps.

Thanks.

RPReplay_Final1674245288.mp4

ContentViewExample.swift.txt

@Rittenzore
Copy link

same issue!

@Rittenzore
Copy link

I noticed that if you manually set .isOpaque(true) it will work fine. Besides I noticed this error occurs when you set .closeOnTapOutside(true) without .isOpaque(true). If you set .isOpaque(true).closeOnTapOutside(true), it will work fine

@yujinqiu
Copy link

yujinqiu commented Feb 8, 2023

same issue!

@Dave181295
Copy link

Same issue friends

@pomeloL
Copy link

pomeloL commented Apr 2, 2023

same issue!!!!!!!

@f3dm76
Copy link
Collaborator

f3dm76 commented Apr 3, 2023

Hey everyone, thank you for your reports, sorry it took me a while, but please check out version 2.1.3, the issue should be gone there. Special thanks to @Rittenzore for figuring out the exact root of this issue, it helped me a lot in fixing it. Have a wonderful day guys!

@f3dm76 f3dm76 closed this as completed Apr 28, 2023
@Dave181295
Copy link

@f3dm76 Hey, when updating to 2.1.3 and running I got a crash
Capture d’écran 2023-05-16 à 22 31 52

This is the usage:

.popup(item: $showPopup) { item in

customize: {
            $0
                .type(.toast)
                .position(.bottom)
                .animation(.easeInOut)
                .dragToDismiss(true)
                .closeOnTapOutside(true)
                .dismissCallback {
                    shouldBlurView = false
                }
      
        }

@Dave181295
Copy link

Update

Just had to init it as nil instead

@State private var showPopup:PopupType?
instead of

@State private var showPopup:PopupType = .interests

Still a bug tho

@f3dm76
Copy link
Collaborator

f3dm76 commented May 17, 2023

Hey @Dave181295, I found a crash during dismiss, is that the one you have? Fixed in 2.4.2, please check it out
P.S. Better open another ticket, since it's not about dismiss animation any more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants