Fix preview issue.
TimelineItemEventForTimestampViewProvider can now have event content which is not TimelineItemTextContent
This commit is contained in:
parent
9d162ca789
commit
bb9e01a9f8
1 changed files with 18 additions and 11 deletions
|
|
@ -22,18 +22,25 @@ internal fun TimelineItemEventRowTimestampPreview(
|
||||||
@PreviewParameter(TimelineItemEventForTimestampViewProvider::class) event: TimelineItem.Event
|
@PreviewParameter(TimelineItemEventForTimestampViewProvider::class) event: TimelineItem.Event
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
Column {
|
Column {
|
||||||
val oldContent = event.content as TimelineItemTextContent
|
when (event.content) {
|
||||||
listOf(
|
is TimelineItemTextContent -> listOf(
|
||||||
"Text",
|
"Text",
|
||||||
"Text longer, displayed on 1 line",
|
"Text longer, displayed on 1 line",
|
||||||
"Text which should be rendered on several lines",
|
"Text which should be rendered on several lines",
|
||||||
).forEach { str ->
|
).forEach { str ->
|
||||||
ATimelineItemEventRow(
|
ATimelineItemEventRow(
|
||||||
event = event.copy(
|
event = event.copy(
|
||||||
content = oldContent.copy(
|
content = event.content.copy(
|
||||||
body = str,
|
body = str,
|
||||||
pillifiedBody = str,
|
pillifiedBody = str,
|
||||||
|
),
|
||||||
|
reactionsState = aTimelineItemReactions(count = 0),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else -> ATimelineItemEventRow(
|
||||||
|
event = event.copy(
|
||||||
|
content = event.content,
|
||||||
reactionsState = aTimelineItemReactions(count = 0),
|
reactionsState = aTimelineItemReactions(count = 0),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue