SwiftUI List Row Background not Rendering Off Screen

Hi there!

I've been able to get the .listRowBackground() modifier to work in SwiftUI (with iOS 15) but am experiencing a weird graphical issue where rows that start off screen do not have the correct background colour until they appear on screen then off again.

Not sure if there is a way to force all elements to render but as far as I can see I am using the modifier correctly.

Any help is greatly appreciated!

Anthony

Code:

var body: some View {
        ZStack {
            Color.theme.darkTheme
                .edgesIgnoringSafeArea(.all)

            VStack {
                      ForEach(Array(array.keys), id: \.self) { key in
                    List {
                        ForEach(systemFaults[key]!, id: \.self) { fault in
                            GenericItemView(label: "FAULT ID", item: "\(fault.faultID)")
                            GenericItemView(label: "IS ACTIVE", item: fault.isActive ? "TRUE" : "FALSE")
                            GenericItemView(label: "SET COUNT", item: "\(fault.setCount)")
                            GenericItemView(label: "LAST TIMESTAMP", item: "\(fault.timestampSeconds) secs")
                        }
                        .listRowBackground(Color.theme.darkerAccent)
                    }
                    Spacer()
                }

            }

        }

    }

Generic Item view is a simple HStack to display the text and associated value.

Screenshots

Initial Sheet being presented

Bottom Entries in the List Off Screen after Scrolling Up

I have the same problem only in my case the screen that's not visible is a tab. Did you have any luck with it?

I'm having the same problem. Did any of you solve this?

I came up with a goofy workaround, described in my post here (using pointlessViewUpdatingBool) https://stackoverflow.com/questions/72317769/swiftui-list-row-background-not-rendering-off-screen/

SwiftUI List Row Background not Rendering Off Screen
 
 
Q