在 iOS16 中,工作表内部存在键盘的错误,当工作表关闭时键盘消失(没关系),但布局未更新。我只看到了关于同一问题的 1 个问题,想知道也许有人找到了临时解决方法,直到苹果不解决这个问题。重现代码:
struct Test: View {
@State var isPresented: Bool = false
@State var text: String = ""
var body: some View {
VStack{
Button {
isPresented.toggle()
} label: {
Text("PRESENT")
}
}
.sheet(isPresented: $isPresented) {
ZStack {
Color.red
VStack{
TextField("Test", text: $text)
.frame(height: 50, alignment: .center)
Spacer()
Rectangle()
.fill(Color.blue)
.frame(width:300, height: 50)
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
视频: https: //vimeo.com/758845068