Skip to content

Commit

Permalink
[REFACTOR] #125 : 입력 페이지 키보드 완료 누르면 키보드 숨기도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Feb 16, 2024
1 parent 204a99c commit f03976b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ package com.wap.designsystem.component

import androidx.annotation.StringRes
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.unit.dp
import com.wap.designsystem.WappTheme

Expand Down Expand Up @@ -46,13 +51,16 @@ fun WappTextField(
)
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun WappRoundedTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
@StringRes placeholder: Int,
) {
val keyboardController = LocalSoftwareKeyboardController.current

TextField(
value = value,
onValueChange = onValueChange,
Expand All @@ -72,6 +80,8 @@ fun WappRoundedTextField(
color = WappTheme.colors.gray82,
)
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),
shape = RoundedCornerShape(10.dp),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ internal fun SignUpTextField(
tint = WappTheme.colors.white,
modifier = Modifier.size(20.dp),
)

Spacer(modifier = Modifier.width(8.dp))

Text(
text = title,
color = WappTheme.colors.white,
style = WappTheme.typography.contentBold,
)
}

TextField(
value = text,
onValueChange = onValueChanged,
Expand All @@ -66,7 +69,9 @@ internal fun SignUpTextField(
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
)

Spacer(modifier = Modifier.height(8.dp))

Text(
text = supportingText,
color = WappTheme.colors.yellow34,
Expand Down

0 comments on commit f03976b

Please sign in to comment.