๐ 3๋จ๊ณ - ํ์๊ฐ์ (์ ํจ์ฑ ๊ฒ์ฌ)#92
๐ 3๋จ๊ณ - ํ์๊ฐ์
(์ ํจ์ฑ ๊ฒ์ฌ)#92hyunjung-choi wants to merge 14 commits intonext-step:hyunjung-choifrom
Conversation
malibinYun
left a comment
There was a problem hiding this comment.
3๋จ๊ณ ๋ฏธ์
๊ณ ์ ๋ง์ผ์
จ์ด์!
ํฌ๊ธฐํ์ง ์๊ณ ๋๊น์ง ๋ฏธ์
์งํํ์๋ ๋ชจ์ต์ด ๋น๋์ ๐
์ฌ๋ฌ ์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ผ๋ ํ์ธํด์ฃผ์ธ์!
์์ง ๊ตฌํํ์ง ๋ชปํ ๊ฒ๋ค๊ณผ ํผ๋๋ฐฑ ๋ฐ์ ํ ๋ค์ ๋ฆฌ๋ทฐ ์์ฒญ ๋ถํ๋๋ ค์ :)
| val composeTestRule = createComposeRule() | ||
| private val username = mutableStateOf("") | ||
| private val email = mutableStateOf("") |
There was a problem hiding this comment.
mutableStateOf๋ฅผ ํ์ฉํด์ ์ปดํฌ๋ํธ์ ๊ฐ์ ๋ณ๊ฒฝํด์ฃผ๊ธฐ๋ณด๋ค,
๋งค ํ
์คํธ๋ง๋ค ์ ์ปดํฌ๋ํธ๋ฅผ setContentํด์, ๊ฑฐ๊ธฐ์ ํ์ํ ๊ฐ์ ์ง์ ๋ฃ์ด์ฃผ๋ ํํ๋ ์ด๋จ๊น์?
| TextField( | ||
| value = email.value, | ||
| onValueChange = { | ||
| email.value = it | ||
| isError = it.isNotEmpty() && !it.matches(Regex(EMAIL_REGEX)) | ||
| }, | ||
| isError = isError, | ||
| label = { | ||
| Text(text = stringResource(id = R.string.signup_email)) | ||
| }, | ||
| modifier = Modifier | ||
| .fillMaxWidth(1.0F) | ||
| .testTag("emailTextField"), | ||
| singleLine = true, | ||
| keyboardOptions = KeyboardOptions( | ||
| autoCorrect = false, | ||
| keyboardType = KeyboardType.Email | ||
| ), | ||
| keyboardActions = KeyboardActions( | ||
| onDone = { | ||
| focusManager.moveFocus(FocusDirection.Next) | ||
| } | ||
| ) | ||
| ) |
There was a problem hiding this comment.
์ด์ ๋ฏธ์
์ TextFieldComponent ์ฒ๋ผ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์๋ฏ์ด,
์ด ์ปดํฌ๋ํธ ๋ด์๋ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ฅผ ํ์ฉํด์ ์ด๋ฉ์ผ ๋ฑ์ ๊ธฐ๋ฅ์ ์ถ๊ฐํด๋ณด๋ ๊ฑด ์ด๋จ๊น์?
| isError = it.isNotEmpty() && !it.matches(Regex(EMAIL_REGEX)) | ||
| }, |
There was a problem hiding this comment.
Regex๊ฐ์ฒด๋ ์์ฑ ๋น์ฉ์ด ๋์ผ๋, ํ ๋ฒ๋ง ์์ฑํ๊ณ ์ฌํ์ฉํด๋ณด๋ ๊ฑด ์ด๋จ๊น์?
|
|
||
| @Composable | ||
| fun EmailTextField(email: MutableState<String>) { |
There was a problem hiding this comment.
๋จธํฐ๋ฆฌ์ผ์ TextField์ ๊ตฌํ์ฒด๋ ์ด๋ป๊ฒ ํ ์คํธ๋ฅผ ์ฃผ๊ณ ๋ฐ๋์ง ์ฐธ๊ณ ํ์ ์ ๋ฐ์ํด๋ณด์ ๋ ์ข๊ฒ ์ด์ :)
๐ 3๋จ๊ณ - ํ์๊ฐ์ (์ ํจ์ฑ ๊ฒ์ฌ)
โ ๊ตฌํํ ๊ธฐ๋ฅ ๋ชฉ๋ก
SignupTextField๋ถ๋ฆฌUsernameTextFieldEmailTextFieldPasswordTextFieldUsernameTextFieldEmailTextFieldPasswordTextField๐ ํผ๋๋ฐฑ
mutableStateOf๋์setContentํ์ฉRegex๊ฐ์ฒด๋ ์์ฑ ๋น์ฉ์ด ๋๋ค โ ํ ๋ฒ๋ง ์์ฑํ๊ณ ์ฌํ์ฉTextField๊ตฌํ์ฒด๊ฐ ํ ์คํธ๋ฅผ ๋ค๋ฃจ๋ ๋ฐฉ๋ฒ ํ์ต ํ ์ ์ฉ์ปดํฌ์ฆ๋ ์ฒ์, ํ ์คํธ ์ฝ๋๋ ์ฒ์์ด๋ผ์ ๋๋ฌด๋๋ฌด ์ด๋ ต๋ค์..๐ญ
์์ง ๋ค ๊ตฌํํ์ง๋ ๋ชปํ์ง๋ง, ํผ๋๋ฐฑ ๋ถํ ๋๋ฆฝ๋๋ค!