繁体   English   中英

在 SwiftUI 中为 NavigationLink 更改 listRowBackground 不会更改完整背景

[英]Change of listRowBackground in SwiftUI for NavigationLink doesn't change the full background

代码如下:

List(selection: $selectedBoard) {
    ForEach(boards) { board in
        NavigationLink(tag: board, selection: $selectedBoard) {
            BoardView(board: board)
        } label: {
            Text(board.name ?? "Board")
         }
        .listRowBackground(self.selectedBoard == board ? Color.App.boardSelection : Color.App.boardBackground)

效果如下:

在此处输入图像描述

看到左边和右边的灰色空间了吗? 这是我不知道如何删除的强调色。 整行应该是相同的,统一的颜色有点浅黑色。

工作示例: https://github.com/igr/Clmn

https://github.com/igr/Clmn/blob/main/Clmn/Views/BoardList/BoardsNavigationListView.swift#L32

当在NavigationView中使用List迭代NavigationLink元素时会发生这种情况。

这似乎是一个错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM