OnAppear calls unexpectedly when Keyboard Appears in SwiftUI

前端 未结 2 964
南笙
南笙 2021-02-02 12:38

I am experiencing very odd behavior in SwiftUI 2.0 and iOS14.

When the keyboard appears on the screen, the OnAppear method of other tab\'s view called automatically.

2条回答
  •  天命终不由人
    2021-02-02 13:16

    To avoid reloading your view try with on the TabView

    .ignoresSafeArea(.keyboard, edges: .bottom)
    

    It only works on iOS 14

提交回复
热议问题