Skip to content

Commit 62f307d

Browse files
committed
fix: autogrow heigh for TextInput
1 parent a7976ea commit 62f307d

File tree

2 files changed

+3
-50
lines changed

2 files changed

+3
-50
lines changed

src/components/TextInput/BaseTextInput/implementation/index.native.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import useMarkdownStyle from '@hooks/useMarkdownStyle';
2525
import useStyleUtils from '@hooks/useStyleUtils';
2626
import useTheme from '@hooks/useTheme';
2727
import useThemeStyles from '@hooks/useThemeStyles';
28-
import getPlatform from '@libs/getPlatform';
2928
import isInputAutoFilled from '@libs/isInputAutoFilled';
3029
import variables from '@styles/variables';
3130
import CONST from '@src/CONST';
@@ -80,10 +79,6 @@ function BaseTextInput(
8079
}: BaseTextInputProps,
8180
ref: ForwardedRef<BaseTextInputRef>,
8281
) {
83-
// For iOS, we don't need to measure the text input because it already has auto grow behavior
84-
// See TextInputMeasurement.ios.tsx for more details
85-
const isExternalAutoGrowMeasurement = getPlatform() !== CONST.PLATFORM.IOS && autoGrow;
86-
8782
const InputComponent = InputComponentMap.get(type) ?? RNTextInput;
8883
const isMarkdownEnabled = type === 'markdown';
8984
const isAutoGrowHeightMarkdown = isMarkdownEnabled && autoGrowHeight;
@@ -253,7 +248,7 @@ function BaseTextInput(
253248
styles.textInputContainer,
254249
textInputContainerStyles,
255250
!!contentWidth && StyleUtils.getWidthStyle(textInputWidth),
256-
isExternalAutoGrowMeasurement && StyleUtils.getAutoGrowWidthInputContainerStyles(textInputWidth, autoGrowExtraSpace),
251+
autoGrow && StyleUtils.getAutoGrowWidthInputContainerStyles(textInputWidth, autoGrowExtraSpace),
257252
!hideFocusedState && isFocused && styles.borderColorFocus,
258253
(!!hasError || !!errorText) && styles.borderColorDanger,
259254
autoGrowHeight && {scrollPaddingTop: typeof maxAutoGrowHeight === 'number' ? 2 * maxAutoGrowHeight : undefined},
@@ -355,8 +350,8 @@ function BaseTextInput(
355350
placeholderTextColor={placeholderTextColor ?? theme.placeholderText}
356351
underlineColorAndroid="transparent"
357352
style={[
358-
!autoGrow && styles.flex1,
359-
!autoGrow && styles.w100,
353+
styles.flex1,
354+
styles.w100,
360355
inputStyle,
361356
(!hasLabel || isMultiline) && styles.pv0,
362357
inputPaddingLeft,

src/components/TextInput/TextInputMeasurement/index.ios.tsx

-42
This file was deleted.

0 commit comments

Comments
 (0)