Skip to content

Commit 0396b88

Browse files
tjaniczekTomasz Janiczek
andauthored
fix: input label positioning regression (#3728)
Co-authored-by: Tomasz Janiczek <[email protected]>
1 parent 9037214 commit 0396b88

File tree

4 files changed

+2
-22
lines changed

4 files changed

+2
-22
lines changed

src/components/TextInput/Label/InputLabel.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const InputLabel = (props: InputLabelProps) => {
3838
labelTranslationXOffset,
3939
maxFontSizeMultiplier,
4040
testID,
41-
theme,
4241
} = props;
4342

4443
const paddingOffset =
@@ -116,7 +115,6 @@ const InputLabel = (props: InputLabelProps) => {
116115
labeled,
117116
labelLayoutWidth,
118117
labelStyle,
119-
theme,
120118
placeholderStyle,
121119
baseLabelTranslateX,
122120
topPosition,

src/components/TextInput/Label/LabelBackground.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import { Animated, StyleSheet } from 'react-native';
33

4-
import { useInternalTheme } from '../../../core/theming';
54
import AnimatedText from '../../Typography/AnimatedText';
65
import type { LabelBackgroundProps } from '../types';
76

@@ -16,15 +15,12 @@ const LabelBackground = ({
1615
roundness,
1716
labelStyle,
1817
maxFontSizeMultiplier,
19-
theme: themeOverrides,
2018
}: LabelBackgroundProps) => {
2119
const opacity = labeled.interpolate({
2220
inputRange: [0, 0.6],
2321
outputRange: [1, 0],
2422
});
2523

26-
const { isV3 } = useInternalTheme(themeOverrides);
27-
2824
const labelTranslationX = {
2925
translateX: labeled.interpolate({
3026
inputRange: [0, 1],
@@ -41,14 +37,6 @@ const LabelBackground = ({
4137

4238
const labelTextTransform = [...labelStyle.transform, labelTextScaleY];
4339

44-
const labelTextWidth = isV3
45-
? {
46-
width: labelLayoutWidth - placeholderStyle.paddingHorizontal,
47-
}
48-
: {
49-
maxWidth: labelLayoutWidth - 2 * placeholderStyle.paddingHorizontal,
50-
};
51-
5240
const isRounded = roundness > 6;
5341
const roundedEdgeCover = isRounded ? (
5442
<Animated.View
@@ -76,14 +64,13 @@ const LabelBackground = ({
7664
placeholderStyle,
7765
labelStyle,
7866
styles.outlinedLabel,
79-
isV3 && styles.md3OutlinedLabel,
8067
{
8168
top: topPosition + 1,
69+
width: labelLayoutWidth - placeholderStyle.paddingHorizontal,
8270
backgroundColor,
8371
opacity,
8472
transform: labelTextTransform,
8573
},
86-
labelTextWidth,
8774
]}
8875
numberOfLines={1}
8976
maxFontSizeMultiplier={maxFontSizeMultiplier}
@@ -105,11 +92,8 @@ const styles = StyleSheet.create({
10592
// eslint-disable-next-line react-native/no-color-literals
10693
outlinedLabel: {
10794
position: 'absolute',
108-
left: 18,
95+
left: 8,
10996
paddingHorizontal: 0,
11097
color: 'transparent',
11198
},
112-
md3OutlinedLabel: {
113-
left: 8,
114-
},
11599
});

src/components/TextInput/TextInputFlat.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ const TextInputFlat = ({
281281
maxFontSizeMultiplier: rest.maxFontSizeMultiplier,
282282
testID,
283283
contentStyle,
284-
theme,
285284
opacity:
286285
parentState.value || parentState.focused
287286
? parentState.labelLayout.measured

src/components/TextInput/TextInputOutlined.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ const TextInputOutlined = ({
210210
maxFontSizeMultiplier: rest.maxFontSizeMultiplier,
211211
testID,
212212
contentStyle,
213-
theme,
214213
opacity:
215214
parentState.value || parentState.focused
216215
? parentState.labelLayout.measured

0 commit comments

Comments
 (0)