From d7cc8607c7d887b384c14953954f610b21209fbe Mon Sep 17 00:00:00 2001 From: Kanat Kiialbaev Date: Fri, 30 Aug 2024 09:37:50 -0400 Subject: [PATCH] [5304] enableEdgeToEdge hides EditText/TextField (#5386) * [5304] enableEdgeToEdge hides EditText/TextField * add CHANGELOG * code clean up --- CHANGELOG.md | 1 + .../chat/android/compose/ui/messages/MessagesScreen.kt | 2 ++ .../android/compose/ui/messages/composer/MessageComposer.kt | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df4c2cf1b1..17f75d84d1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ ### ⬆️ Improved - `DefaultMentionSuggestionItemCenterContent` component uses `user.id` if `user.name` is empty. [#5384](https://github.com/GetStream/stream-chat-android/pull/5384) - Added `showFileSize` parameter to `StreamAttachmentFactories.defaultFactories` to control file size UI visibility. [#5383](https://github.com/GetStream/stream-chat-android/pull/5383) +- Made `MessagesScreen` edge-to-edge friendly. [#5386](https://github.com/GetStream/stream-chat-android/pull/5386) ### ✅ Added - Add `PollDialogs` component used to show poll dialogs. [#5370](https://github.com/GetStream/stream-chat-android/pull/5370) diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt index 97b18f514be..ed8d1996f04 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/MessagesScreen.kt @@ -36,6 +36,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.ime import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.MaterialTheme @@ -202,6 +203,7 @@ public fun MessagesScreen( Box( modifier = Modifier .fillMaxSize() + .systemBarsPadding() .testTag("Stream_MessagesScreen"), ) { Scaffold( diff --git a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt index 4c5358682b8..3583ce3ac36 100644 --- a/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt +++ b/stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/composer/MessageComposer.kt @@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -217,7 +218,7 @@ public fun MessageComposer( val messageComposerState by viewModel.messageComposerState.collectAsState() MessageComposer( - modifier = modifier, + modifier = modifier.imePadding(), onSendMessage = { text, attachments -> val messageWithData = viewModel.buildNewMessage(text, attachments)