Pill Performance Improvement part 3 (#1908)

* pill performance improvement

* code improvement

* better doc
This commit is contained in:
Mauro
2023-10-16 16:43:35 +02:00
committed by GitHub
parent 6898419211
commit 0d72554e6f
4 changed files with 15 additions and 2 deletions
+4 -1
View File
@@ -34,7 +34,6 @@ struct PillView: View {
.padding(.vertical, 4)
// for now design has defined no color so we will just use gray
.background(Capsule().foregroundColor(context.viewState.isOwnMention ? .compound.bgCriticalPrimary : .gray))
.frame(maxWidth: 235)
.onChange(of: context.viewState.displayText) { _ in
didChangeText()
}
@@ -53,9 +52,13 @@ struct PillView_Previews: PreviewProvider, TestablePreview {
.previewDisplayName("Loading Own")
PillView(imageProvider: mockMediaProvider,
context: PillContext.mock(type: .loadedUser(isOwn: false))) { }
// To simulate the trimming that happens at UIKit level
.frame(maxWidth: PillConstants.maxWidth)
.previewDisplayName("Loaded Long")
PillView(imageProvider: mockMediaProvider,
context: PillContext.mock(type: .loadedUser(isOwn: true))) { }
// To simulate the trimming that happens at UIKit level
.frame(maxWidth: PillConstants.maxWidth)
.previewDisplayName("Loaded Long Own")
PillView(imageProvider: mockMediaProvider,
context: PillContext.mock(type: .allUsers)) { }