11package com.runnect.runnect.presentation.mypage.editname
22
33import androidx.compose.foundation.Image
4+ import androidx.compose.foundation.border
45import androidx.compose.foundation.clickable
56import androidx.compose.foundation.layout.Box
67import androidx.compose.foundation.layout.Column
@@ -14,11 +15,10 @@ import androidx.compose.foundation.layout.size
1415import androidx.compose.foundation.layout.statusBarsPadding
1516import androidx.compose.foundation.layout.width
1617import androidx.compose.foundation.shape.RoundedCornerShape
18+ import androidx.compose.foundation.text.BasicTextField
1719import androidx.compose.foundation.text.KeyboardActions
1820import androidx.compose.foundation.text.KeyboardOptions
1921import androidx.compose.material3.CircularProgressIndicator
20- import androidx.compose.material3.OutlinedTextField
21- import androidx.compose.material3.OutlinedTextFieldDefaults
2222import androidx.compose.material3.Text
2323import androidx.compose.runtime.Composable
2424import androidx.compose.ui.Alignment
@@ -130,29 +130,37 @@ private fun NicknameTextField(
130130 onDone : () -> Unit ,
131131) {
132132 val textStyle = RunnectTheme .textStyle
133- OutlinedTextField (
133+ // OutlinedTextField enforces a 56dp minimum height (M3 internal contentPadding),
134+ // which clips text inside the 44dp height the XML version used.
135+ // BasicTextField + decorationBox gives identical layout to the original AppCompatEditText.
136+ BasicTextField (
134137 value = value,
135138 onValueChange = { if (it.length <= 7 ) onValueChange(it) },
136139 modifier = Modifier
137140 .fillMaxWidth()
138141 .height(44 .dp),
139142 textStyle = textStyle.semiBold15.copy(textAlign = TextAlign .Center , color = G1 ),
140- placeholder = {
141- Text (
142- text = stringResource(R .string.my_page_edit_name_guide),
143- style = textStyle.semiBold15.copy(textAlign = TextAlign .Center ),
144- color = G3 ,
145- modifier = Modifier .fillMaxWidth(),
146- )
147- },
148143 singleLine = true ,
149144 keyboardOptions = KeyboardOptions (imeAction = ImeAction .Done ),
150145 keyboardActions = KeyboardActions (onDone = { onDone() }),
151- shape = RoundedCornerShape (10 .dp),
152- colors = OutlinedTextFieldDefaults .colors(
153- focusedBorderColor = M2 ,
154- unfocusedBorderColor = M2 ,
155- cursorColor = M1 ,
156- ),
146+ decorationBox = { innerTextField ->
147+ Box (
148+ modifier = Modifier
149+ .fillMaxSize()
150+ .border(width = 1 .dp, color = M2 , shape = RoundedCornerShape (10 .dp))
151+ .padding(horizontal = 16 .dp),
152+ contentAlignment = Alignment .Center ,
153+ ) {
154+ if (value.isEmpty()) {
155+ Text (
156+ text = stringResource(R .string.my_page_edit_name_guide),
157+ style = textStyle.semiBold15.copy(textAlign = TextAlign .Center ),
158+ color = G3 ,
159+ modifier = Modifier .fillMaxWidth(),
160+ )
161+ }
162+ innerTextField()
163+ }
164+ },
157165 )
158166}
0 commit comments