onScrollPhaseChange doesn't get called when using List

Hi, I can't get onScrollPhaseChange to fire when using a List. It works as expected when using a ScollView and LazyVStack.

Interestingly, onScrollGeometryChange gets called as expected for both List and ScrollView.

Has anyone successfully used onScrollPhaseChange with a List?

Answered by DTS Engineer in 794639022

Please file a bug report and post your bug number, just for the record.

Xcode 16 Beta 3 did not resolve the issue.

Please file a bug report and post your bug number, just for the record.

FB14257442

Submitted FB15595530 as I have the same issue. It would be super helpful if this worked on List.

It appears that using the listStyle modifier makes the phase modifier work:

List {
    ForEach(0..<100, id: \.self) { i in
        Text("Hello, World! \(i)")
            .id(i)
            .onAppear { visible[i] = true }
            .onDisappear { visible[i] = false }
    }
}

// without modifier // ❌
// .listStyle(.automatic) // ❌
// .listStyle(.grouped) // ✅
// .listStyle(.inset) // ✅
// .listStyle(.insetGrouped) // ✅
// .listStyle(.plain) // ✅
// .listStyle(.sidebar) // ✅

.onScrollPhaseChange { old, new, _ in
    print("old: \(old), new: \(new)")
    if old != .idle, new == .idle {
        let message = visible.keys.sorted().reduce(into: "") { base, element in
            base += "i: \(element) (\(visible[element]?.description ?? "null")), "
        }
        print(message)
    }
}

Not fixed in Xcode 26 Beta 1, WTF?

onScrollPhaseChange doesn't get called when using List
 
 
Q