Skip to content

Commit

Permalink
fix: TextField Keyboard Padding in Discovery Webview
Browse files Browse the repository at this point in the history
  • Loading branch information
HamzaIsrar12 committed Jul 14, 2024
1 parent 2fe8313 commit 8bcc913
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.add
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
Expand All @@ -34,6 +40,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -224,6 +231,15 @@ private fun WebViewDiscoveryScreen(
)
)
}
val consumeWindowInsets = if (isPreLogin) {
WindowInsets.navigationBars
.add(WindowInsets(bottom = 112.dp)) // The size of AuthButtonPanel
.asPaddingValues(LocalDensity.current)
} else {
WindowInsets.navigationBars
.add(WindowInsets(bottom = 56.dp)) // The size of BottomNavigationView
.asPaddingValues(LocalDensity.current)
}

Column(
modifier = Modifier
Expand All @@ -245,6 +261,8 @@ private fun WebViewDiscoveryScreen(
Box(
modifier = modifierScreenWidth
.fillMaxHeight()
.consumeWindowInsets(consumeWindowInsets)
.imePadding()
.background(Color.White),
contentAlignment = Alignment.TopCenter
) {
Expand Down

0 comments on commit 8bcc913

Please sign in to comment.