Skip to content

Commit 7b3230d

Browse files
committed
textField centerd style dependes on fieldState.value
1 parent 9bf2be2 commit 7b3230d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/incubator/TextField/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ const TextField = (props: InternalTextFieldProps) => {
116116
const _validationMessageStyle = useMemo(() => {
117117
return centered ? [validationMessageStyle, styles.centeredValidationMessage] : validationMessageStyle;
118118
}, [validationMessageStyle, centered]);
119+
const hasValue = useMemo(() => {
120+
return fieldState.value !== undefined;
121+
}, [fieldState.value]);
119122
const inputStyle = useMemo(() => {
120-
return [typographyStyle, colorStyle, others.style, fieldState.value && centered && styles.centeredInput];
121-
}, [typographyStyle, colorStyle, others.style, centered]);
123+
return [typographyStyle, colorStyle, others.style, hasValue && centered && styles.centeredInput];
124+
}, [typographyStyle, colorStyle, others.style, centered, hasValue]);
122125
const dummyPlaceholderStyle = useMemo(() => {
123126
return [inputStyle, styles.dummyPlaceholder];
124127
}, [inputStyle]);

0 commit comments

Comments
 (0)