Skip to content

Commit

Permalink
fix: After sending a reaction, keyboard opens automatically (WPB-9358) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine authored Jun 7, 2024
1 parent 97a0369 commit 61eacdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.nativeKeyCode
import androidx.compose.ui.input.key.onPreInterceptKeyBeforeSoftKeyboard
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -283,6 +284,7 @@ private fun MessageComposerTextInput(
val interactionSource = remember { MutableInteractionSource() }
val isPressed by interactionSource.collectIsPressedAsState()
var isReadOnly by remember { mutableStateOf(false) }
val focusManager = LocalFocusManager.current

LaunchedEffect(inputFocused) {
if (inputFocused) {
Expand All @@ -291,6 +293,7 @@ private fun MessageComposerTextInput(
focusRequester.requestFocus()
} else {
isReadOnly = true
focusManager.clearFocus()
keyboardController?.hide()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,6 @@ sealed class MessageCompositionType {
}

sealed class MessageType {
object Normal : MessageType()
data object Normal : MessageType()
data class SelfDeleting(val selfDeletionTimer: SelfDeletionTimer) : MessageType()
}

0 comments on commit 61eacdc

Please sign in to comment.