diff --git a/src/components/TextInput/BaseTextInput/implementation/index.native.tsx b/src/components/TextInput/BaseTextInput/implementation/index.native.tsx index 3f191ccb2764..1c495c5f3365 100644 --- a/src/components/TextInput/BaseTextInput/implementation/index.native.tsx +++ b/src/components/TextInput/BaseTextInput/implementation/index.native.tsx @@ -25,7 +25,6 @@ import useMarkdownStyle from '@hooks/useMarkdownStyle'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import getPlatform from '@libs/getPlatform'; import isInputAutoFilled from '@libs/isInputAutoFilled'; import variables from '@styles/variables'; import CONST from '@src/CONST'; @@ -80,10 +79,6 @@ function BaseTextInput( }: BaseTextInputProps, ref: ForwardedRef, ) { - // For iOS, we don't need to measure the text input because it already has auto grow behavior - // See TextInputMeasurement.ios.tsx for more details - const isExternalAutoGrowMeasurement = getPlatform() !== CONST.PLATFORM.IOS && autoGrow; - const InputComponent = InputComponentMap.get(type) ?? RNTextInput; const isMarkdownEnabled = type === 'markdown'; const isAutoGrowHeightMarkdown = isMarkdownEnabled && autoGrowHeight; @@ -253,7 +248,7 @@ function BaseTextInput( styles.textInputContainer, textInputContainerStyles, !!contentWidth && StyleUtils.getWidthStyle(textInputWidth), - isExternalAutoGrowMeasurement && StyleUtils.getAutoGrowWidthInputContainerStyles(textInputWidth, autoGrowExtraSpace), + autoGrow && StyleUtils.getAutoGrowWidthInputContainerStyles(textInputWidth, autoGrowExtraSpace), !hideFocusedState && isFocused && styles.borderColorFocus, (!!hasError || !!errorText) && styles.borderColorDanger, autoGrowHeight && {scrollPaddingTop: typeof maxAutoGrowHeight === 'number' ? 2 * maxAutoGrowHeight : undefined}, @@ -355,8 +350,8 @@ function BaseTextInput( placeholderTextColor={placeholderTextColor ?? theme.placeholderText} underlineColorAndroid="transparent" style={[ - !autoGrow && styles.flex1, - !autoGrow && styles.w100, + styles.flex1, + styles.w100, inputStyle, (!hasLabel || isMultiline) && styles.pv0, inputPaddingLeft, diff --git a/src/components/TextInput/TextInputMeasurement/index.ios.tsx b/src/components/TextInput/TextInputMeasurement/index.ios.tsx deleted file mode 100644 index 5d2bdaefb825..000000000000 --- a/src/components/TextInput/TextInputMeasurement/index.ios.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import type {ViewStyle} from 'react-native'; -import {View} from 'react-native'; -import Text from '@components/Text'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type TextInputMeasurementProps from './types'; - -function TextInputMeasurement({ - value, - placeholder, - contentWidth, - inputStyle, - inputPaddingLeft, - onSetTextInputWidth, - onSetTextInputHeight, - isPrefixCharacterPaddingCalculated, -}: TextInputMeasurementProps) { - const styles = useThemeStyles(); - - // On iOS, we don't need to measure for the auto grow size since iOS supports auto grow - return ( - !!contentWidth && - isPrefixCharacterPaddingCalculated && ( - { - if (e.nativeEvent.layout.width === 0 && e.nativeEvent.layout.height === 0) { - return; - } - onSetTextInputWidth(e.nativeEvent.layout.width); - onSetTextInputHeight(e.nativeEvent.layout.height); - }} - > - {value ? `${value}${value.endsWith('\n') ? '\u200B' : ''}` : placeholder} - - ) - ); -} - -TextInputMeasurement.displayName = 'TextInputMeasurement'; - -export default TextInputMeasurement;