diff --git a/navi-uitron/src/main/java/com/navi/uitron/render/OtpBoxRenderer.kt b/navi-uitron/src/main/java/com/navi/uitron/render/OtpBoxRenderer.kt index c45c6b2..40f5cc1 100644 --- a/navi-uitron/src/main/java/com/navi/uitron/render/OtpBoxRenderer.kt +++ b/navi-uitron/src/main/java/com/navi/uitron/render/OtpBoxRenderer.kt @@ -23,11 +23,14 @@ import androidx.compose.ui.unit.dp import androidx.compose.foundation.layout.* import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.text.selection.LocalTextSelectionColors +import androidx.compose.foundation.text.selection.TextSelectionColors import androidx.compose.runtime.* import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Color.Companion.Transparent import androidx.compose.ui.graphics.SolidColor import androidx.compose.ui.layout.layoutId import androidx.compose.ui.platform.LocalConfiguration @@ -287,36 +290,44 @@ class OtpBoxRenderer : Renderer { } } val keyboardController = LocalSoftwareKeyboardController.current - BasicTextField( - modifier = modifier, - textStyle = TextStyle( - fontSize = property.inputTextProperty?.textStyle?.fontSize?.sp ?: 14.sp, - color = property.inputTextProperty?.textStyle?.color?.hexToComposeColor - ?: Color.Black, - fontFamily = UiTronSdkManager.getDependencyProvider() - .getFontFamily(property.inputTextProperty?.textStyle?.fontFamily), - fontWeight = UiTronSdkManager.getDependencyProvider() - .getFontWeight(property.inputTextProperty?.textStyle?.fontWeight), - textAlign = TextAlign.Center - ), - keyboardOptions = KeyboardOptions( - capitalization = KeyboardUtil.getKeyboardCapitalization(property.keyboardOptions?.capitalization), - keyboardType = KeyboardUtil.getKeyboardType(property.keyboardOptions?.keyboardType), - imeAction = KeyboardUtil.getImeAction(property.keyboardOptions?.imeAction) - ), - keyboardActions = KeyboardActions( - onDone = { keyboardController?.hide() } - ), - visualTransformation = property.visualTransformation?.getVisualTransformation() - ?: VisualTransformation.None, - value = inputValue, - onValueChange = onValueChange, - singleLine = true, - enabled = property.isEnabled ?: true, - cursorBrush = SolidColor( - property.cursorColor?.hexToComposeColor ?: Color.Transparent - ) + val customTextSelectionColors = TextSelectionColors( + handleColor = Transparent, + backgroundColor = Transparent ) + CompositionLocalProvider( + LocalTextSelectionColors provides customTextSelectionColors, + ) { + BasicTextField( + modifier = modifier, + textStyle = TextStyle( + fontSize = property.inputTextProperty?.textStyle?.fontSize?.sp ?: 14.sp, + color = property.inputTextProperty?.textStyle?.color?.hexToComposeColor + ?: Color.Black, + fontFamily = UiTronSdkManager.getDependencyProvider() + .getFontFamily(property.inputTextProperty?.textStyle?.fontFamily), + fontWeight = UiTronSdkManager.getDependencyProvider() + .getFontWeight(property.inputTextProperty?.textStyle?.fontWeight), + textAlign = TextAlign.Center + ), + keyboardOptions = KeyboardOptions( + capitalization = KeyboardUtil.getKeyboardCapitalization(property.keyboardOptions?.capitalization), + keyboardType = KeyboardUtil.getKeyboardType(property.keyboardOptions?.keyboardType), + imeAction = KeyboardUtil.getImeAction(property.keyboardOptions?.imeAction) + ), + keyboardActions = KeyboardActions( + onDone = { keyboardController?.hide() } + ), + visualTransformation = property.visualTransformation?.getVisualTransformation() + ?: VisualTransformation.None, + value = inputValue, + onValueChange = onValueChange, + singleLine = true, + enabled = property.isEnabled ?: true, + cursorBrush = SolidColor( + property.cursorColor?.hexToComposeColor ?: Color.Transparent + ) + ) + } } }