Skip to content

Commit 3737984

Browse files
committed
refactor: lift NumberPad amount state and callbacks up
1 parent 07f9480 commit 3737984

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/src/main/java/to/bitkit/ui/components/NumberPad.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import androidx.compose.foundation.lazy.grid.items
1212
import androidx.compose.material3.Icon
1313
import androidx.compose.material3.Text
1414
import androidx.compose.runtime.Composable
15-
import androidx.compose.runtime.getValue
1615
import androidx.compose.ui.Alignment
1716
import androidx.compose.ui.Modifier
1817
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
@@ -61,10 +60,9 @@ fun NumberPad(
6160
currencies: CurrencyState = LocalCurrencies.current,
6261
type: NumberPadType = viewModel.getNumberPadType(currencies),
6362
availableHeight: Dp? = null,
63+
errorKey: String? = viewModel.uiState.collectAsStateWithLifecycle().value.errorKey,
64+
onPress: (String) -> Unit = { key -> viewModel.handleNumberPadInput(key, currencies) },
6465
) {
65-
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
66-
val errorKey: String? = uiState.errorKey
67-
val onPress: (String) -> Unit = { key -> viewModel.handleNumberPadInput(key, currencies) }
6866

6967
BoxWithConstraints(modifier = modifier) {
7068
val constraintsHeight = this.maxHeight

0 commit comments

Comments
 (0)