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

Confetti is not triggering if there is a TextField in the view #20

Open
abushnaq opened this issue Sep 30, 2024 · 0 comments
Open

Confetti is not triggering if there is a TextField in the view #20

abushnaq opened this issue Sep 30, 2024 · 0 comments

Comments

@abushnaq
Copy link

abushnaq commented Sep 30, 2024

Hi all,

The code below does not trigger the confetti either onAppear or onTap. If I remove the TextField both work fine. Is this a known limitation?

import SwiftUI
import Vortex

struct ContentView: View {    
    @State var answer : String = ""
    var suppliedAnswer : String = "Hello"
    var body: some View {
        VortexViewReader { proxy in
            ZStack {
                VStack
                {
                    Text("What is the capital of the United States?")
                     TextField("Placeholder", text: $answer)
                }
                VortexView(.confetti.makeUniqueCopy()) {
                    Rectangle()
                        .fill(.white)
                        .frame(width: 16, height: 16)
                        .tag("square")
                    
                    Circle()
                        .fill(.white)
                        .frame(width: 16)
                        .tag("circle")
                }.onAppear()
                {
                    let location1 = CGPoint(x: 221.0, y: 627.66)
                    let location2 = CGPoint(x: 233.0, y: 200.66)
     
                    proxy.move(to: location1)
                    proxy.burst()
                    proxy.move(to: location2)
                    proxy.burst()
                }
                .onTapGesture { location in
                    proxy.move(to: location)
                    proxy.burst()
                }
            }
        }
    }
}

#Preview {
    ContentView()
}
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

1 participant