SwiftUI: dynamicTypeSize doesn't work for items in a List

Hi, I have a List and I want to limit the dynamic text size for some of the elements in the list's row item view. I created a test view below. The ".dynamicTypeSize(.large)" restriction only works if it's applied to the List view, not if it's set for the the ContentItemView in the ForEach below.

Is there a reason for this? Do I need to do something else to limit a list row to a certain size? The example only has a text field, but I want to do this for a Image with some text inside it, and I wanted to restrict that text field, but it doesn't seem to work when the view is inside a List row.

Please let me know if there's a workaround for it.


import SwiftUI
import CoreData

struct ContentView: View {

    @FetchRequest(
        sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)],
        animation: .default)
    private var items: FetchedResults<Item>
    @State private var multiSelectedContacts = Set<Item.ID>()
    
    var body: some View {
        NavigationStack {
            List (selection: $multiSelectedContacts) {
                ForEach(items) { item in
                    ContentItemView(item: item)
                }
                .dynamicTypeSize(.large) //  <-- doesn't works 
            }
            .dynamicTypeSize(.large) //  <-- THIS WORKS
        }
    }
}

struct ContentItemView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @ObservedObject var item: Item
    @State var presentConfirmation = false
    var body: some View {
        
        HStack {
            if let timestamp = item.timestamp, let itemNumber = item.itemNumber {
                Text("\(itemNumber) - \(timestamp, formatter: itemFormatter)")
            }
        }
        .popover(isPresented: $item.canShowPopover, content: {
            Text("Test Item Label")
                .frame(width: 100, height: 150)
        })
    }
}


private let itemFormatter: DateFormatter = {
    let formatter = DateFormatter()
    formatter.dateStyle = .short
    formatter.timeStyle = .long
    return formatter
}()

#Preview {
    ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
}
SwiftUI: dynamicTypeSize doesn't work for items in a List
 
 
Q