You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 22:06:32