From 7d82a3ec3b3fad8513b45e64c166259cc53867e6 Mon Sep 17 00:00:00 2001 From: AHMED Date: Tue, 18 Jul 2023 07:13:29 +0300 Subject: [PATCH 1/3] fix: text below the input flickers in ios. --- src/styles/styles.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/styles/styles.js b/src/styles/styles.js index 64fb3bc6b30a..14b6d013666c 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -855,10 +855,11 @@ const styles = { backgroundColor: themeColors.buttonDefaultBG, }, - autoGrowHeightInputContainer: (textInputHeight, maxHeight) => ({ - height: textInputHeight >= maxHeight ? maxHeight : textInputHeight, - minHeight: variables.componentSizeLarge, - }), + autoGrowHeightInputContainer: (textInputHeight, maxHeight) => { + const minHeight = variables.componentSizeLarge; + const height = Math.min(Math.max(minHeight, textInputHeight), maxHeight); + return {height, minHeight}; + }, autoGrowHeightHiddenInput: (maxWidth, maxHeight) => ({ maxWidth, From 57ff8091fecbc6be27011fc281682ad9f2ce9b8a Mon Sep 17 00:00:00 2001 From: AHMED Date: Wed, 19 Jul 2023 00:56:31 +0300 Subject: [PATCH 2/3] refactore --- src/styles/styles.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/styles/styles.js b/src/styles/styles.js index 14b6d013666c..601aa00ddbea 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -857,7 +857,12 @@ const styles = { autoGrowHeightInputContainer: (textInputHeight, maxHeight) => { const minHeight = variables.componentSizeLarge; - const height = Math.min(Math.max(minHeight, textInputHeight), maxHeight); + let height = textInputHeight; + if (height >= maxHeight) { + height = maxHeight; + } else if (height <= minHeight) { + height = minHeight; + } return {height, minHeight}; }, From 6c3ad475e0dec38b7220ea0f6fb69526f8d55f1f Mon Sep 17 00:00:00 2001 From: AHMED Date: Thu, 20 Jul 2023 00:00:43 +0300 Subject: [PATCH 3/3] use lodashClamp for calc textInput height --- src/components/TextInput/BaseTextInput.js | 6 +++++- src/styles/styles.js | 21 +++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index d1b67b52e19f..2e96aeb7b2b9 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -249,7 +249,11 @@ function BaseTextInput(props) { onPress={onPress} focusable={false} accessibilityLabel={props.label} - style={[props.autoGrowHeight && styles.autoGrowHeightInputContainer(textInputHeight, maxHeight), !isMultiline && styles.componentHeightLarge, ...props.containerStyles]} + style={[ + props.autoGrowHeight && styles.autoGrowHeightInputContainer(textInputHeight, variables.componentSizeLarge, maxHeight), + !isMultiline && styles.componentHeightLarge, + ...props.containerStyles, + ]} > { - const minHeight = variables.componentSizeLarge; - let height = textInputHeight; - if (height >= maxHeight) { - height = maxHeight; - } else if (height <= minHeight) { - height = minHeight; - } - return {height, minHeight}; - }, + /** + * @param {number} textInputHeight + * @param {number} minHeight + * @param {number} maxHeight + * @returns {object} + */ + autoGrowHeightInputContainer: (textInputHeight, minHeight, maxHeight) => ({ + height: lodashClamp(textInputHeight, minHeight, maxHeight), + minHeight, + }), autoGrowHeightHiddenInput: (maxWidth, maxHeight) => ({ maxWidth,