Skip to content

Commit

Permalink
fix: correct text input label background layout (#3349)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored Sep 5, 2022
1 parent 028aaf4 commit 6769fca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/components/TextInput/Label/LabelBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const LabelBackground = ({
outputRange: [hasFocus ? 1 : 0, 0],
});

const { isV3, colors } = useTheme();
const { isV3 } = useTheme();

const labelTranslationX = {
translateX: parentState.labeled.interpolate({
Expand All @@ -42,9 +42,7 @@ const LabelBackground = ({
}),
};

const labelTextTransform = isV3
? [...labelStyle.transform]
: [...labelStyle.transform, labelTextScaleY];
const labelTextTransform = [...labelStyle.transform, labelTextScaleY];

const labelTextWidth = isV3
? {
Expand Down Expand Up @@ -82,8 +80,8 @@ const LabelBackground = ({
styles.outlinedLabel,
isV3 && styles.md3OutlinedLabel,
{
top: topPosition + (isV3 ? 0 : 1),
backgroundColor: isV3 ? colors.surface : backgroundColor,
top: topPosition + 1,
backgroundColor,
opacity,
transform: labelTextTransform,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
"paddingHorizontal": 0,
"position": "absolute",
"textAlign": "left",
"top": 58,
"top": 59,
"transform": Array [
Object {
"translateX": 0,
Expand All @@ -497,6 +497,9 @@ exports[`correctly applies height to multiline Outline TextInput 1`] = `
Object {
"scale": 0.75,
},
Object {
"scaleY": 0.2,
},
],
"width": -16,
"writingDirection": "ltr",
Expand Down

0 comments on commit 6769fca

Please sign in to comment.