Skip to content

Commit 6769fca

Browse files
authored
fix: correct text input label background layout (#3349)
1 parent 028aaf4 commit 6769fca

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/components/TextInput/Label/LabelBackground.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const LabelBackground = ({
2626
outputRange: [hasFocus ? 1 : 0, 0],
2727
});
2828

29-
const { isV3, colors } = useTheme();
29+
const { isV3 } = useTheme();
3030

3131
const labelTranslationX = {
3232
translateX: parentState.labeled.interpolate({
@@ -42,9 +42,7 @@ const LabelBackground = ({
4242
}),
4343
};
4444

45-
const labelTextTransform = isV3
46-
? [...labelStyle.transform]
47-
: [...labelStyle.transform, labelTextScaleY];
45+
const labelTextTransform = [...labelStyle.transform, labelTextScaleY];
4846

4947
const labelTextWidth = isV3
5048
? {
@@ -82,8 +80,8 @@ const LabelBackground = ({
8280
styles.outlinedLabel,
8381
isV3 && styles.md3OutlinedLabel,
8482
{
85-
top: topPosition + (isV3 ? 0 : 1),
86-
backgroundColor: isV3 ? colors.surface : backgroundColor,
83+
top: topPosition + 1,
84+
backgroundColor,
8785
opacity,
8886
transform: labelTextTransform,
8987
},

src/components/__tests__/__snapshots__/TextInput.test.js.snap

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
486486
"paddingHorizontal": 0,
487487
"position": "absolute",
488488
"textAlign": "left",
489-
"top": 58,
489+
"top": 59,
490490
"transform": Array [
491491
Object {
492492
"translateX": 0,
@@ -497,6 +497,9 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
497497
Object {
498498
"scale": 0.75,
499499
},
500+
Object {
501+
"scaleY": 0.2,
502+
},
500503
],
501504
"width": -16,
502505
"writingDirection": "ltr",

0 commit comments

Comments
 (0)