Message composer isn't resized when changing the replied to message (#1750)
This commit is contained in:
parent
d21358ed9b
commit
92fa35e0c7
2 changed files with 14 additions and 1 deletions
1
changelog.d/1560.bugfix
Normal file
1
changelog.d/1560.bugfix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Message composer wasn't resized when selecting a several lines message to reply to, then a single line one.
|
||||||
|
|
@ -41,6 +41,7 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
|
@ -104,6 +105,7 @@ import io.element.android.libraries.theme.ElementTheme
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
import kotlin.random.Random
|
||||||
import androidx.compose.material3.Button as Material3Button
|
import androidx.compose.material3.Button as Material3Button
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -339,6 +341,16 @@ private fun MessagesViewContent(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This key is used to force the sheet to be remeasured when the content changes.
|
||||||
|
// Any state change that should trigger a height size should be added to the list of remembered values here.
|
||||||
|
val sheetResizeContentKey = remember(
|
||||||
|
state.composerState.mode.relatedEventId,
|
||||||
|
state.composerState.richTextEditorState.lineCount,
|
||||||
|
state.composerState.memberSuggestions.size
|
||||||
|
) {
|
||||||
|
Random.nextInt()
|
||||||
|
}
|
||||||
|
|
||||||
ExpandableBottomSheetScaffold(
|
ExpandableBottomSheetScaffold(
|
||||||
sheetDragHandle = if (state.composerState.showTextFormatting) {
|
sheetDragHandle = if (state.composerState.showTextFormatting) {
|
||||||
@Composable { BottomSheetDragHandle() }
|
@Composable { BottomSheetDragHandle() }
|
||||||
|
|
@ -371,7 +383,7 @@ private fun MessagesViewContent(
|
||||||
state = state,
|
state = state,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
sheetContentKey = state.composerState.richTextEditorState.lineCount + state.composerState.memberSuggestions.size,
|
sheetContentKey = sheetResizeContentKey,
|
||||||
sheetTonalElevation = 0.dp,
|
sheetTonalElevation = 0.dp,
|
||||||
sheetShadowElevation = if (state.composerState.memberSuggestions.isNotEmpty()) 16.dp else 0.dp,
|
sheetShadowElevation = if (state.composerState.memberSuggestions.isNotEmpty()) 16.dp else 0.dp,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue