Message composer isn't resized when changing the replied to message (#1750)
This commit is contained in:
committed by
GitHub
parent
d21358ed9b
commit
92fa35e0c7
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.DisposableEffect
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
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 kotlinx.collections.immutable.ImmutableList
|
||||
import timber.log.Timber
|
||||
import kotlin.random.Random
|
||||
import androidx.compose.material3.Button as Material3Button
|
||||
|
||||
@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(
|
||||
sheetDragHandle = if (state.composerState.showTextFormatting) {
|
||||
@Composable { BottomSheetDragHandle() }
|
||||
@@ -371,7 +383,7 @@ private fun MessagesViewContent(
|
||||
state = state,
|
||||
)
|
||||
},
|
||||
sheetContentKey = state.composerState.richTextEditorState.lineCount + state.composerState.memberSuggestions.size,
|
||||
sheetContentKey = sheetResizeContentKey,
|
||||
sheetTonalElevation = 0.dp,
|
||||
sheetShadowElevation = if (state.composerState.memberSuggestions.isNotEmpty()) 16.dp else 0.dp,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user