Textfield works very weird in iOS 17, how to fix?

I have the following code working great in iOS16

TextField(
            "Describe...",
            text: Binding(
                get: { promptText },
                set:
                    { (newValue, _) in
                        if let _ = newValue.lastIndex(of: "\n") {
                            isFocused = false
                        } else {
                            promptText = newValue
                        }
                    }
              ),
            axis: .vertical
        )

but in iOS 17 it breaks. But it breaks in a very mysterious way.

Firstly, the @ FocusState doesn't work.

Setting it to false does not dismiss keyboard. Fine, but also what's weird is that when I press the done button, the new line gets added to the textField anyway, even if I don't set the newValue. What's going on?

i am also seeing this same issue on iOS 17 only. the value in the getter for the custom binding is being ignored and the value input directly to the text field is being used. in my case i am adjusting the raw entry into a format of mm:ss filling in from right to left.

Textfield works very weird in iOS 17, how to fix?
 
 
Q