mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Pill Performance Improvement part 3 (#1908)
* pill performance improvement * code improvement * better doc
This commit is contained in:
@@ -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)) { }
|
||||
|
||||
Reference in New Issue
Block a user