nathantannar4 / Transmission

Bridges UIKit presentation APIs to a SwiftUI API so you can use presentation controllers, interactive transitions and more.
BSD 2-Clause "Simplified" License
378 stars 13 forks source link

TextField FocusState doesn't work inside DestinationLink #33

Closed PhilipDukhov closed 8 months ago

PhilipDukhov commented 8 months ago

Below code works fine on 1.1.0, but in 1.1.2 it doesn't bring focus to text field.

struct ContentView: View {
    @State var presented = false

    var body: some View {
        NavigationView {
            DestinationLink {
                TextFieldView()
            } label: {
                Text("show")
            }
        }
    }
}

struct TextFieldView: View {
    @FocusState var isFocused

    var body: some View {
        TextField("hey", text: .constant(""))
            .focused($isFocused)
            .onAppear {
                isFocused = true
            }
    }
}
nathantannar4 commented 8 months ago

Attempting to fix #24 broke this, fixed in 1.1.3 but mutating the binding cannot dismiss with animation. DestinationCoordinator must be used.