-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ 3๋จ๊ณ - ํ์๊ฐ์ (์ ํจ์ฑ ๊ฒ์ฌ) #92
base: hyunjung-choi
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3๋จ๊ณ ๋ฏธ์
๊ณ ์ ๋ง์ผ์
จ์ด์!
ํฌ๊ธฐํ์ง ์๊ณ ๋๊น์ง ๋ฏธ์
์งํํ์๋ ๋ชจ์ต์ด ๋น๋์ ๐
์ฌ๋ฌ ์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ผ๋ ํ์ธํด์ฃผ์ธ์!
์์ง ๊ตฌํํ์ง ๋ชปํ ๊ฒ๋ค๊ณผ ํผ๋๋ฐฑ ๋ฐ์ ํ ๋ค์ ๋ฆฌ๋ทฐ ์์ฒญ ๋ถํ๋๋ ค์ :)
val composeTestRule = createComposeRule() | ||
private val username = mutableStateOf("") | ||
private val email = mutableStateOf("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด์ ๋ฏธ์
์ TextFieldComponent ์ฒ๋ผ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ฅผ ๋ง๋ค์๋ฏ์ด,
์ด ์ปดํฌ๋ํธ ๋ด์๋ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ฅผ ํ์ฉํด์ ์ด๋ฉ์ผ ๋ฑ์ ๊ธฐ๋ฅ์ ์ถ๊ฐํด๋ณด๋ ๊ฑด ์ด๋จ๊น์?
isError = it.isNotEmpty() && !it.matches(Regex(EMAIL_REGEX)) | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex๊ฐ์ฒด๋ ์์ฑ ๋น์ฉ์ด ๋์ผ๋, ํ ๋ฒ๋ง ์์ฑํ๊ณ ์ฌํ์ฉํด๋ณด๋ ๊ฑด ์ด๋จ๊น์?
|
||
@Composable | ||
fun EmailTextField(email: MutableState<String>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋จธํฐ๋ฆฌ์ผ์ TextField์ ๊ตฌํ์ฒด๋ ์ด๋ป๊ฒ ํ ์คํธ๋ฅผ ์ฃผ๊ณ ๋ฐ๋์ง ์ฐธ๊ณ ํ์ ์ ๋ฐ์ํด๋ณด์ ๋ ์ข๊ฒ ์ด์ :)
๐ 3๋จ๊ณ - ํ์๊ฐ์ (์ ํจ์ฑ ๊ฒ์ฌ)
โ ๊ตฌํํ ๊ธฐ๋ฅ ๋ชฉ๋ก
SignupTextField
๋ถ๋ฆฌUsernameTextField
EmailTextField
PasswordTextField
UsernameTextField
EmailTextField
PasswordTextField
๐ ํผ๋๋ฐฑ
mutableStateOf
๋์setContent
ํ์ฉRegex
๊ฐ์ฒด๋ ์์ฑ ๋น์ฉ์ด ๋๋ค โ ํ ๋ฒ๋ง ์์ฑํ๊ณ ์ฌํ์ฉTextField
๊ตฌํ์ฒด๊ฐ ํ ์คํธ๋ฅผ ๋ค๋ฃจ๋ ๋ฐฉ๋ฒ ํ์ต ํ ์ ์ฉ์ปดํฌ์ฆ๋ ์ฒ์, ํ ์คํธ ์ฝ๋๋ ์ฒ์์ด๋ผ์ ๋๋ฌด๋๋ฌด ์ด๋ ต๋ค์..๐ญ
์์ง ๋ค ๊ตฌํํ์ง๋ ๋ชปํ์ง๋ง, ํผ๋๋ฐฑ ๋ถํ ๋๋ฆฝ๋๋ค!