SwiftUI中弹出Alert后导航栏返回按钮消失问题求助
Alert关闭后导航栏返回按钮消失
我编写了如下极简的AccountView代码:
struct AccountView: View { @State private var showingLogoutAlert = false var body: some View { Button("Log out!") { showingLogoutAlert = true } .alert(isPresented: $showingLogoutAlert, content: { Alert(title: Text("Log out of Flow?"), primaryButton: .cancel(), secondaryButton: .destructive(Text("Log out"), action: { //logOut() })) }) } }
点击按钮会弹出确认登出的Alert,但无论点击Alert的「取消」还是「登出」按钮关闭弹窗后,当前页面导航栏的返回按钮都会消失。我已经将代码精简到最小程度,在全新的SwiftUI应用中也能稳定复现该问题。(动图完整展示流程:进入AccountView页面后点击按钮弹出Alert,关闭Alert后导航栏左侧的返回按钮消失)
内容的提问来源于stack exchange,提问作者Aziz A
相关产品推荐
相关产品推荐

