LeoNatan / LNPopupUI

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

Can't make custom popup close button. #5

Closed iTollMouS closed 3 years ago

iTollMouS commented 3 years ago
import SwiftUI
import LNPopupUI

struct AppetizerTabView: View {

    @State var isPopupOpen: Bool = false 

    var body: some View {
        TabView{
            AppetizerListView()
                .tabItem {
                    Image(systemName: "house")
                    Text("Home")
                }
            AccountView()
                .tabItem {
                    Image(systemName: "person")
                    Text("Account")
                }

            OrderView()
                .tabItem {
                    Image(systemName: "bag")
                    Text("Home")
                }
        }

        .popup(isBarPresented: .constant(true) , isPopupOpen: $isPopupOpen , popupContent: {
            Button(action: {
                self.isPopupOpen.toggle()
            }, label: {
                Image(systemName: "info.circle")
                    .resizable()
                    .frame(width: 30, height: 30)
                    .foregroundColor(Color(.lightGray))
            })
        })

        .popupInteractionStyle(.drag)
        .popupBarCustomView(wantsDefaultTapGesture: false, wantsDefaultPanGesture: true, wantsDefaultHighlightGesture: false) {
            HStack(spacing: 24){
                Text("Choose any user to\ndisplay coding activity")
                    .font(.system(size: 16, weight: .light))
                    .foregroundColor(.black)
                    .frame(height: 40)
                    .lineLimit(nil)
                    .multilineTextAlignment(.center)
                    .padding(10)
                    .padding(.leading)
                Button(action: {
                    self.isPopupOpen.toggle()
                }, label: {
                    Image(systemName: "info.circle")
                        .resizable()
                        .frame(width: 30, height: 30)
                        .foregroundColor(Color(.black))
                })
            }
        }
    }
}
LeoNatan commented 3 years ago

?

iDevelopper commented 3 years ago

can @iTollMouS elaborate?

iTollMouS commented 3 years ago
import SwiftUI
import LNPopupUI

struct AppetizerTabView: View {

    _**@State var isPopupOpen: Bool = false**_  <-- this state controls when popup is open / close 

    var body: some View {
        TabView{
            AppetizerListView()
                .tabItem {
                    Image(systemName: "house")
                    Text("Home")
                }
            AccountView()
                .tabItem {
                    Image(systemName: "person")
                    Text("Account")
                }

            OrderView()
                .tabItem {
                    Image(systemName: "bag")
                    Text("Home")
                }
        }

        .popup(isBarPresented: .constant(true) , isPopupOpen: $isPopupOpen , popupContent: {
            **_Button(action: {
                self.isPopupOpen.toggle() <- in second View , I want to make a button that dismiss the popup , but this button doesn't work 
            }, label: {
                Image(systemName: "info.circle")
                    .resizable()
                    .frame(width: 30, height: 30)
                    .foregroundColor(Color(.lightGray))
            })_**
        })

        .popupInteractionStyle(.drag)
        .popupBarCustomView(wantsDefaultTapGesture: false, wantsDefaultPanGesture: true, wantsDefaultHighlightGesture: false) {
            HStack(spacing: 24){
                Text("Choose any user to\ndisplay coding activity")
                    .font(.system(size: 16, weight: .light))
                    .foregroundColor(.black)
                    .frame(height: 40)
                    .lineLimit(nil)
                    .multilineTextAlignment(.center)
                    .padding(10)
                    .padding(.leading)
                Button(action: {
                    self.isPopupOpen.toggle()
                }, label: {
                    Image(systemName: "info.circle")
                        .resizable()
                        .frame(width: 30, height: 30)
                        .foregroundColor(Color(.black))
                })
            }
        }
    }
}
iTollMouS commented 3 years ago

I want to make a button of my design for popup dismissal , but idk why it doesnt work . Here is a video demo https://streamable.com/umkyq8

iDevelopper commented 3 years ago

@iTollMouS ,

So you should update the title of the issue like this:

Can't make custom popup close button.

iTollMouS commented 3 years ago

Apologies

LeoNatan commented 3 years ago

Just dumping code and expecting answers is not a good way to ask for help. Nobody here works for you or owes you something.

iTollMouS commented 3 years ago

apologies, it is the first time for me to do this . Thanks for notifying me as I'm learning how to report properly ✌️😬

LeoNatan commented 3 years ago

Found a bug in the internal logic. Will push a fix in a few minutes.

iTollMouS commented 3 years ago

[cid:2A9D63CF-CB97-4EC4-AC2A-E37E697FA0B0]

Thank you.

On Nov 23, 2020, at 8:41 PM, Leo Natan notifications@github.com wrote:



Found a bug in the internal logic. Will push a fix in a few minutes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/LeoNatan/LNPopupUI/issues/5#issuecomment-732316809, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHXPK5IONRT3GUYRB35WFP3SRKNDPANCNFSM4T6WQGXA.

LeoNatan commented 3 years ago

It's a more elaborate change than I thought, found more issues. Will fix it soon.

LeoNatan commented 3 years ago

Please try with 1.2.7. Thanks

iTollMouS commented 3 years ago

Thanks for the fixing . It is working !!

https://streamable.com/zh0mzu


From: Leo Natan notifications@github.com Sent: Monday, November 23, 2020 5:46 PM To: LeoNatan/LNPopupUI LNPopupUI@noreply.github.com Cc: iTollMouS tariq.almazyad@hotmail.com; Mention mention@noreply.github.com Subject: Re: [LeoNatan/LNPopupUI] Can't make custom popup close button. (#5)

Please try with 1.2.7. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/LeoNatan/LNPopupUI/issues/5#issuecomment-732470090, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHXPK5MCHUB2DYJ3IQS3DKDSRLQ2VANCNFSM4T6WQGXA.

LeoNatan commented 3 years ago

Great!

Thanks, Leo Natan

On Nov 24, 2020, at 00:55, iTollMouS notifications@github.com wrote:



Thanks for the fixing . It is working !!

https://streamable.com/zh0mzu


From: Leo Natan notifications@github.com Sent: Monday, November 23, 2020 5:46 PM To: LeoNatan/LNPopupUI LNPopupUI@noreply.github.com Cc: iTollMouS tariq.almazyad@hotmail.com; Mention mention@noreply.github.com Subject: Re: [LeoNatan/LNPopupUI] Can't make custom popup close button. (#5)

Please try with 1.2.7. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/LeoNatan/LNPopupUI/issues/5#issuecomment-732470090, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHXPK5MCHUB2DYJ3IQS3DKDSRLQ2VANCNFSM4T6WQGXA.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/LeoNatan/LNPopupUI/issues/5#issuecomment-732473465, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AARKJYNAAGAXETSE7CVQLB3SRLR4XANCNFSM4T6WQGXA.