|
1 | 1 | import {Str} from 'expensify-common';
|
2 | 2 | import type {ForwardedRef, MutableRefObject} from 'react';
|
3 |
| -import React, {forwardRef, useCallback, useEffect, useMemo, useRef, useState} from 'react'; |
| 3 | +import React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'; |
4 | 4 | import type {GestureResponderEvent, LayoutChangeEvent, NativeSyntheticEvent, StyleProp, TextInput, TextInputFocusEventData, ViewStyle} from 'react-native';
|
5 | 5 | import {ActivityIndicator, StyleSheet, View} from 'react-native';
|
6 | 6 | import {useSharedValue, withSpring} from 'react-native-reanimated';
|
@@ -98,7 +98,6 @@ function BaseTextInput(
|
98 | 98 | const [passwordHidden, setPasswordHidden] = useState(inputProps.secureTextEntry);
|
99 | 99 | const [textInputWidth, setTextInputWidth] = useState(0);
|
100 | 100 | const [textInputHeight, setTextInputHeight] = useState(0);
|
101 |
| - const [height, setHeight] = useState<number>(variables.componentSizeLarge); |
102 | 101 | const [width, setWidth] = useState<number | null>(null);
|
103 | 102 |
|
104 | 103 | const labelScale = useSharedValue<number>(initialActiveLabel ? styleConst.ACTIVE_LABEL_SCALE : styleConst.INACTIVE_LABEL_SCALE);
|
@@ -187,7 +186,6 @@ function BaseTextInput(
|
187 | 186 | const layout = event.nativeEvent.layout;
|
188 | 187 |
|
189 | 188 | setWidth((prevWidth: number | null) => (autoGrowHeight ? layout.width : prevWidth));
|
190 |
| - setHeight((prevHeight: number) => (!multiline ? layout.height : prevHeight)); |
191 | 189 | },
|
192 | 190 | [autoGrowHeight, multiline],
|
193 | 191 | );
|
@@ -263,25 +261,6 @@ function BaseTextInput(
|
263 | 261 | ]);
|
264 | 262 | const isMultiline = multiline || autoGrowHeight;
|
265 | 263 |
|
266 |
| - /** |
267 |
| - * To prevent text jumping caused by virtual DOM calculations on Safari and mobile Chrome, |
268 |
| - * make sure to include the `lineHeight`. |
269 |
| - * Reference: https://github.com/Expensify/App/issues/26735 |
270 |
| - * For other platforms, explicitly remove `lineHeight` from single-line inputs |
271 |
| - * to prevent long text from disappearing once it exceeds the input space. |
272 |
| - * See https://github.com/Expensify/App/issues/13802 |
273 |
| - */ |
274 |
| - const lineHeight = useMemo(() => { |
275 |
| - if (Browser.isSafari() || Browser.isMobileChrome()) { |
276 |
| - const lineHeightValue = StyleSheet.flatten(inputStyle).lineHeight; |
277 |
| - if (lineHeightValue !== undefined) { |
278 |
| - return lineHeightValue; |
279 |
| - } |
280 |
| - } |
281 |
| - |
282 |
| - return undefined; |
283 |
| - }, [inputStyle]); |
284 |
| - |
285 | 264 | const inputPaddingLeft = !!prefixCharacter && StyleUtils.getPaddingLeft(StyleUtils.getCharacterPadding(prefixCharacter) + styles.pl1.paddingLeft);
|
286 | 265 | const inputPaddingRight = !!suffixCharacter && StyleUtils.getPaddingRight(StyleUtils.getCharacterPadding(suffixCharacter) + styles.pr1.paddingRight);
|
287 | 266 |
|
@@ -330,7 +309,6 @@ function BaseTextInput(
|
330 | 309 | />
|
331 | 310 | </>
|
332 | 311 | ) : null}
|
333 |
| - |
334 | 312 | <View style={[styles.textInputAndIconContainer, isMultiline && hasLabel && styles.textInputMultilineContainer, styles.pointerEventsBoxNone]}>
|
335 | 313 | {!!iconLeft && (
|
336 | 314 | <View style={[styles.textInputLeftIconContainer, !isReadOnly ? styles.cursorPointer : styles.pointerEventsNone]}>
|
@@ -380,10 +358,6 @@ function BaseTextInput(
|
380 | 358 | inputPaddingRight,
|
381 | 359 | inputProps.secureTextEntry && styles.secureInput,
|
382 | 360 |
|
383 |
| - // Explicitly remove `lineHeight` from single line inputs so that long text doesn't disappear |
384 |
| - // once it exceeds the input space (See https://github.com/Expensify/App/issues/13802) |
385 |
| - !isMultiline && {height, lineHeight}, |
386 |
| - |
387 | 361 | // Explicitly change boxSizing attribute for mobile chrome in order to apply line-height
|
388 | 362 | // for the issue mentioned here https://github.com/Expensify/App/issues/26735
|
389 | 363 | // Set overflow property to enable the parent flexbox to shrink its size
|
|
0 commit comments