From e50a3f3b4464d74848e62e6de8809f4a0e0bcce2 Mon Sep 17 00:00:00 2001 From: Soumya Ranjan Patra Date: Mon, 25 Sep 2023 19:04:57 +0530 Subject: [PATCH] =?UTF-8?q?Added=20a=20field=20to=20specify=20whether=20to?= =?UTF-8?q?=20show=20keyboard=20when=20customTextFiel=E2=80=A6=20(#192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/navi/uitron/model/ui/CustomTextFieldProperty.kt | 4 +++- .../java/com/navi/uitron/render/CustomTextFieldRenderer.kt | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/navi-uitron/src/main/java/com/navi/uitron/model/ui/CustomTextFieldProperty.kt b/navi-uitron/src/main/java/com/navi/uitron/model/ui/CustomTextFieldProperty.kt index 884c4b6..f03fc94 100644 --- a/navi-uitron/src/main/java/com/navi/uitron/model/ui/CustomTextFieldProperty.kt +++ b/navi-uitron/src/main/java/com/navi/uitron/model/ui/CustomTextFieldProperty.kt @@ -23,7 +23,8 @@ data class CustomTextFieldProperty( var cursorColor: String? = null, var colors: OutlinedTextFieldColors? = null, var arrangementData: ArrangementData? = null, - var invalidCharRegex: String? = null + var invalidCharRegex: String? = null, + var showKeyboardOnRender : Boolean? = null ) : BaseProperty() { override fun copyNonNullFrom(property: BaseProperty?) { @@ -48,6 +49,7 @@ data class CustomTextFieldProperty( customTextFieldProperty?.colors?.let { colors = it } customTextFieldProperty?.arrangementData?.let { arrangementData = it } customTextFieldProperty?.invalidCharRegex?.let { invalidCharRegex = it } + customTextFieldProperty?.showKeyboardOnRender?.let { showKeyboardOnRender = it } } } diff --git a/navi-uitron/src/main/java/com/navi/uitron/render/CustomTextFieldRenderer.kt b/navi-uitron/src/main/java/com/navi/uitron/render/CustomTextFieldRenderer.kt index d3827b8..fe3bbfb 100644 --- a/navi-uitron/src/main/java/com/navi/uitron/render/CustomTextFieldRenderer.kt +++ b/navi-uitron/src/main/java/com/navi/uitron/render/CustomTextFieldRenderer.kt @@ -275,6 +275,11 @@ class CustomTextFieldRenderer( } } } + LaunchedEffect(key1 = Unit) { + if (property.showKeyboardOnRender.orFalse()) { + keyboardController?.show() + } + } } }