@@ -37,6 +37,7 @@ import androidx.compose.ui.Modifier
3737import androidx.compose.ui.focus.onFocusChanged
3838import androidx.compose.ui.layout.onGloballyPositioned
3939import androidx.compose.ui.layout.positionInParent
40+ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
4041import androidx.compose.ui.platform.testTag
4142import androidx.compose.ui.res.stringResource
4243import androidx.compose.ui.text.font.FontWeight
@@ -86,6 +87,7 @@ fun RestoreWalletView(
8687
8788 val scrollState = rememberScrollState()
8889 val coroutineScope = rememberCoroutineScope()
90+ val keyboardController = LocalSoftwareKeyboardController .current
8991 val inputFieldPositions = remember { mutableMapOf<Int , Int >() }
9092
9193 val wordsPerColumn = if (is24Words) 12 else 6
@@ -160,10 +162,11 @@ fun RestoreWalletView(
160162 words,
161163 onWordCountChanged = { is24Words = it },
162164 onFirstWordChanged = { firstFieldText = it },
165+ onValidWords = { keyboardController?.hide() },
163166 onInvalidWords = { invalidIndices ->
164167 invalidWordIndices.clear()
165168 invalidWordIndices.addAll(invalidIndices)
166- }
169+ },
167170 )
168171 } else {
169172 updateWordValidity(
@@ -455,6 +458,7 @@ private fun handlePastedWords(
455458 onWordCountChanged : (Boolean ) -> Unit ,
456459 onFirstWordChanged : (String ) -> Unit ,
457460 onInvalidWords : (List <Int >) -> Unit ,
461+ onValidWords : () -> Unit ,
458462) {
459463 val pastedWords = pastedText.trim().split(" \\ s+" .toRegex()).filter { it.isNotEmpty() }
460464 if (pastedWords.size == 12 || pastedWords.size == 24 ) {
@@ -474,6 +478,7 @@ private fun handlePastedWords(
474478 words[index] = " "
475479 }
476480 onFirstWordChanged(pastedWords.first())
481+ onValidWords()
477482 }
478483}
479484
0 commit comments