Skip to content

Commit 723ac36

Browse files
committed
chore(fc/conversation): hide IME when opening room info as well
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 640a846 commit 723ac36

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/chat/conversation/ConversationScreen.kt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ data class ConversationScreen(
9595
val navigator = LocalCodeNavigator.current
9696
val vm = getViewModel<ConversationViewModel>()
9797

98+
val keyboardVisible by keyboardAsState()
99+
val keyboard = LocalSoftwareKeyboardController.current
100+
val composeScope = rememberCoroutineScope()
101+
98102
LaunchedEffect(chatId) {
99103
if (chatId != null) {
100104
vm.dispatchEvent(
@@ -156,9 +160,7 @@ data class ConversationScreen(
156160

157161
val state by vm.stateFlow.collectAsState()
158162
val messages = vm.messages.collectAsLazyPagingItems()
159-
val keyboardVisible by keyboardAsState()
160-
val keyboard = LocalSoftwareKeyboardController.current
161-
val composeScope = rememberCoroutineScope()
163+
162164

163165
val goBack = {
164166
composeScope.launch {
@@ -188,14 +190,21 @@ data class ConversationScreen(
188190
}
189191

190192
val openRoomDetails = {
191-
navigator.push(
192-
ScreenRegistry.get(
193-
NavScreenProvider.Chat.Info(
194-
state.roomInfoArgs
193+
composeScope.launch {
194+
if (keyboardVisible) {
195+
keyboard?.hide()
196+
delay(500)
197+
}
198+
navigator.push(
199+
ScreenRegistry.get(
200+
NavScreenProvider.Chat.Info(
201+
state.roomInfoArgs
202+
)
195203
)
196204
)
197-
)
205+
}
198206
}
207+
199208
Column {
200209
AppBarWithTitle(
201210
title = {

0 commit comments

Comments
 (0)