Vortex icon indicating copy to clipboard operation
Vortex copied to clipboard

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

Open abushnaq opened this issue 1 year ago • 0 comments

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()
}

abushnaq avatar Sep 30 '24 19:09 abushnaq