Skip to content

Commit 39ab2f8

Browse files
committed
Fix multiple previews issue.
1 parent 223eae9 commit 39ab2f8

File tree

1 file changed

+24
-24
lines changed
  • libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer

1 file changed

+24
-24
lines changed

libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/TextComposer.kt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ fun TextComposer(
120120
}
121121

122122
val layoutModifier = modifier
123-
.fillMaxSize()
124-
.height(IntrinsicSize.Min)
123+
.fillMaxSize()
124+
.height(IntrinsicSize.Min)
125125

126126
val composerOptionsButton: @Composable () -> Unit = remember {
127127
@Composable {
@@ -324,8 +324,8 @@ private fun StandardLayout(
324324
if (voiceMessageState is VoiceMessageState.Preview || voiceMessageState is VoiceMessageState.Recording) {
325325
Box(
326326
modifier = Modifier
327-
.padding(bottom = 5.dp, top = 5.dp, end = 3.dp, start = 3.dp)
328-
.size(48.dp),
327+
.padding(bottom = 5.dp, top = 5.dp, end = 3.dp, start = 3.dp)
328+
.size(48.dp),
329329
contentAlignment = Alignment.Center,
330330
) {
331331
voiceDeleteButton()
@@ -335,8 +335,8 @@ private fun StandardLayout(
335335
}
336336
Box(
337337
modifier = Modifier
338-
.padding(bottom = 8.dp, top = 8.dp)
339-
.weight(1f)
338+
.padding(bottom = 8.dp, top = 8.dp)
339+
.weight(1f)
340340
) {
341341
voiceRecording()
342342
}
@@ -349,16 +349,16 @@ private fun StandardLayout(
349349
}
350350
Box(
351351
modifier = Modifier
352-
.padding(bottom = 8.dp, top = 8.dp)
353-
.weight(1f)
352+
.padding(bottom = 8.dp, top = 8.dp)
353+
.weight(1f)
354354
) {
355355
textInput()
356356
}
357357
}
358358
Box(
359-
Modifier
360-
.padding(bottom = 5.dp, top = 5.dp, end = 6.dp, start = 6.dp)
361-
.size(48.dp),
359+
Modifier
360+
.padding(bottom = 5.dp, top = 5.dp, end = 6.dp, start = 6.dp)
361+
.size(48.dp),
362362
contentAlignment = Alignment.Center,
363363
) {
364364
endButton()
@@ -380,8 +380,8 @@ private fun TextFormattingLayout(
380380
) {
381381
Box(
382382
modifier = Modifier
383-
.weight(1f)
384-
.padding(horizontal = 12.dp)
383+
.weight(1f)
384+
.padding(horizontal = 12.dp)
385385
) {
386386
textInput()
387387
}
@@ -425,11 +425,11 @@ private fun TextInputBox(
425425

426426
Column(
427427
modifier = Modifier
428-
.clip(roundedCorners)
429-
.border(0.5.dp, borderColor, roundedCorners)
430-
.background(color = bgColor)
431-
.requiredHeightIn(min = 42.dp)
432-
.fillMaxSize(),
428+
.clip(roundedCorners)
429+
.border(0.5.dp, borderColor, roundedCorners)
430+
.background(color = bgColor)
431+
.requiredHeightIn(min = 42.dp)
432+
.fillMaxSize(),
433433
) {
434434
if (composerMode is MessageComposerMode.Special) {
435435
ComposerModeView(
@@ -440,9 +440,9 @@ private fun TextInputBox(
440440
val defaultTypography = ElementTheme.typography.fontBodyLgRegular
441441
Box(
442442
modifier = Modifier
443-
.padding(top = 4.dp, bottom = 4.dp, start = 12.dp, end = 12.dp)
444-
// Apply test tag only once, otherwise 2 nodes will have it (both the normal and subcomposing one) and tests will fail
445-
.then(if (!subcomposing) Modifier.testTag(TestTags.textEditor) else Modifier),
443+
.padding(top = 4.dp, bottom = 4.dp, start = 12.dp, end = 12.dp)
444+
// Apply test tag only once, otherwise 2 nodes will have it (both the normal and subcomposing one) and tests will fail
445+
.then(if (!subcomposing) Modifier.testTag(TestTags.textEditor) else Modifier),
446446
contentAlignment = Alignment.CenterStart,
447447
) {
448448
// Placeholder
@@ -488,8 +488,8 @@ private fun TextInput(
488488
// This prevents it gaining focus and mutating the state.
489489
registerStateUpdates = !subcomposing,
490490
modifier = Modifier
491-
.padding(top = 6.dp, bottom = 6.dp)
492-
.fillMaxWidth(),
491+
.padding(top = 6.dp, bottom = 6.dp)
492+
.fillMaxWidth(),
493493
style = ElementRichTextEditorStyle.composerStyle(hasFocus = state.hasFocus),
494494
resolveMentionDisplay = resolveMentionDisplay,
495495
resolveRoomMentionDisplay = resolveRoomMentionDisplay,
@@ -600,7 +600,7 @@ internal fun TextComposerReplyPreview(@PreviewParameter(InReplyToDetailsProvider
600600

601601
@PreviewsDayNight
602602
@Composable
603-
internal fun TextComposerCaptionPreview(@PreviewParameter(InReplyToDetailsProvider::class) inReplyToDetails: InReplyToDetails) = ElementPreview {
603+
internal fun TextComposerCaptionPreview() = ElementPreview {
604604
PreviewColumn(
605605
items = aTextEditorStateMarkdownList()
606606
) { textEditorState ->

0 commit comments

Comments
 (0)