Fix performance issues with lists
This commit is contained in:
@ -51,13 +51,19 @@ struct FileListView: View {
|
||||
TextField("", text: $searchString, prompt: Text("Search"))
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.padding(.horizontal, 8)
|
||||
List(filteredFiles) { file in
|
||||
SelectableListItem(selected: selectedFile == file) {
|
||||
Text(file.id)
|
||||
}
|
||||
.onTapGesture {
|
||||
selectedFile = file
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 0) {
|
||||
ForEach(filteredFiles) { file in
|
||||
SelectableListItem(selected: selectedFile == file) {
|
||||
Text(file.id)
|
||||
}
|
||||
.id(file.id)
|
||||
.onTapGesture {
|
||||
selectedFile = file
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 8)
|
||||
}
|
||||
.onChange(of: selectedFileType) { oldValue, newValue in
|
||||
guard oldValue != newValue else {
|
||||
|
Reference in New Issue
Block a user