You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Going back from MessagesScreen sometimes doesn't work.
onBackPressed callback of the MessagesScreen composable is not invoked. This happens if you enter the screen while keyboard is opened or is closed at the time of navigating to MessagesScreen. Cannot go back even when you close the keyboard/send a message/reopen and close keyboard.
In MessagesScreen, there is a line to check if keyboard is opened: val isImeVisible = WindowInsets.ime.getBottom(LocalDensity.current) > 0
However in the case above this value always seems to be true when using it in the back handler.
It seems it doesn't take this value into consideration so it seems like it uses the first value, and never updates.
val isImeVisible =WindowInsets.ime.getBottom(LocalDensity.current) >0val backAction:BackAction= remember(listViewModel, composerViewModel, attachmentsPickerViewModel) {
{
val isStartedForThread = listViewModel.isStartedForThread
val isInThread = listViewModel.isInThread
val isShowingOverlay = listViewModel.isShowingOverlay
when {
isImeVisible ->Unit
attachmentsPickerViewModel.isShowingAttachments -> attachmentsPickerViewModel.changeAttachmentState(
false,
)
isShowingOverlay -> listViewModel.selectMessage(null)
isStartedForThread -> onBackPressed()
isInThread -> {
listViewModel.leaveThread()
composerViewModel.leaveThread()
}
else-> onBackPressed()
}
}
}
If we add isImeVisible to remember's keys, then it seems to be working fine:
Let's assume that you have some screen where you can search your channels
Search for a channel(let the keyboard be open)
Go to Messages screen for that channel
Trigger system back press or toolbar back button
Nothing happens
Expected behavior
User is able to do whatever their onBackPressed callback is supposed to do, e.g. navigate back.
However, onBackPressed callback is not invoked.
Device:
Vendor and model: Xiaomi Redmi Note 7 and Samsung Galaxy S24
Android version: 10 and 14
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered:
Describe the bug
Going back from MessagesScreen sometimes doesn't work.
onBackPressed callback of the MessagesScreen composable is not invoked. This happens if you enter the screen while keyboard is opened or is closed at the time of navigating to MessagesScreen. Cannot go back even when you close the keyboard/send a message/reopen and close keyboard.
In MessagesScreen, there is a line to check if keyboard is opened:
val isImeVisible = WindowInsets.ime.getBottom(LocalDensity.current) > 0
However in the case above this value always seems to be true when using it in the back handler.
It seems it doesn't take this value into consideration so it seems like it uses the first value, and never updates.
If we add isImeVisible to remember's keys, then it seems to be working fine:
SDK version
To Reproduce
Steps to reproduce the behavior:
Expected behavior
User is able to do whatever their onBackPressed callback is supposed to do, e.g. navigate back.
However, onBackPressed callback is not invoked.
Device:
Screenshots
If applicable, add screenshots to help explain your problem.
The text was updated successfully, but these errors were encountered: