fullScreenCover中列表内NavigationLink点击无响应问题求助
问题原因与解决方法
你的NavigationLink点击无响应,核心原因是fullScreenCover内的视图未被NavigationView包裹——NavigationLink必须处于NavigationView的层级上下文里,才能触发页面跳转逻辑。
修改后的代码示例
Button("New Message"){ shownFCover.toggle() }.fullScreenCover(isPresented: $shownFCover) { // 在外层添加NavigationView NavigationView { VStack { Button("Close"){ shownFCover.toggle() } List { ForEach(0..<16) { index in NavigationLink { Text("Hello") } label: { HStack{ Image(systemName: "\(index).circle.fill").font(.title).foregroundColor(.red) Text("\(index). Item") } } } } } // 可选:隐藏默认导航栏,避免和自定义Close按钮重复 .navigationBarHidden(true) } }
关键说明
- 添加
NavigationView作为fullScreenCover内容的根视图,为NavigationLink提供必要的导航上下文。 - 如果不需要系统默认的导航栏,可以用
.navigationBarHidden(true)隐藏,保持界面风格统一。
内容的提问来源于stack exchange,提问作者Abdullah
相关产品推荐
相关产品推荐

