Skip to content

Commit

Permalink
Update keyboard offset to add more space above the keyboard when it o…
Browse files Browse the repository at this point in the history
…pens
  • Loading branch information
Siddharth Agarwal committed May 20, 2024
1 parent 3ac7aad commit 43fc4a2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.TextFieldValue
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.dhis2.commons.resources.ResourceManager
import org.dhis2.form.extensions.autocompleteList
Expand Down Expand Up @@ -79,14 +80,16 @@ fun FieldProvider(
.onSizeChanged { intSize ->
visibleArea = Rect(
size = Size(intSize.width.toFloat(), intSize.height.toFloat()),
offset = Offset(0f, 20f),
offset = Offset(0f, 200f),
)
}
.onFocusChanged {
if (it.isFocused && !fieldUiModel.focused) {
scope.launch {
bringIntoViewRequester.bringIntoView(visibleArea)
fieldUiModel.onItemClick()

delay(10)
bringIntoViewRequester.bringIntoView(visibleArea)
}
}
}
Expand Down

0 comments on commit 43fc4a2

Please sign in to comment.