From 633a881bbc8eeebfaeb741f63343380588471f21 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 27 Nov 2023 18:13:47 +0700 Subject: [PATCH 1/4] strip line break in task title --- src/components/TextInput/BaseTextInput/index.native.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/TextInput/BaseTextInput/index.native.js b/src/components/TextInput/BaseTextInput/index.native.js index 60863cfb5771..867bc21152cc 100644 --- a/src/components/TextInput/BaseTextInput/index.native.js +++ b/src/components/TextInput/BaseTextInput/index.native.js @@ -172,10 +172,12 @@ function BaseTextInput(props) { /** * Set Value & activateLabel * - * @param {String} value + * @param {String} val * @memberof BaseTextInput */ - const setValue = (value) => { + const setValue = (val) => { + const value = val.replace(/\n/g, ' '); + if (props.onInputChange) { props.onInputChange(value); } From 6fe6bfbf7bb36e59343ec0325f42501355ce97b4 Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 28 Nov 2023 01:44:12 +0700 Subject: [PATCH 2/4] check in non-multiline cases only --- src/components/TextInput/BaseTextInput/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/BaseTextInput/index.native.js b/src/components/TextInput/BaseTextInput/index.native.js index 867bc21152cc..3276b7e4746f 100644 --- a/src/components/TextInput/BaseTextInput/index.native.js +++ b/src/components/TextInput/BaseTextInput/index.native.js @@ -176,7 +176,7 @@ function BaseTextInput(props) { * @memberof BaseTextInput */ const setValue = (val) => { - const value = val.replace(/\n/g, ' '); + const value = isMultiline ? val : val.replace(/\n/g, ' '); if (props.onInputChange) { props.onInputChange(value); From 59f1f3bad5822947155003b60f8fed22ac6d90d7 Mon Sep 17 00:00:00 2001 From: tienifr Date: Tue, 28 Nov 2023 01:52:07 +0700 Subject: [PATCH 3/4] fix lint --- src/components/TextInput/BaseTextInput/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/BaseTextInput/index.native.js b/src/components/TextInput/BaseTextInput/index.native.js index 3276b7e4746f..918f8e78aa9f 100644 --- a/src/components/TextInput/BaseTextInput/index.native.js +++ b/src/components/TextInput/BaseTextInput/index.native.js @@ -28,6 +28,7 @@ function BaseTextInput(props) { const styles = useThemeStyles(); const initialValue = props.value || props.defaultValue || ''; const initialActiveLabel = props.forceActiveLabel || initialValue.length > 0 || Boolean(props.prefixCharacter); + const isMultiline = props.multiline || props.autoGrowHeight; const [isFocused, setIsFocused] = useState(false); const [passwordHidden, setPasswordHidden] = useState(props.secureTextEntry); @@ -229,7 +230,6 @@ function BaseTextInput(props) { (props.hasError || props.errorText) && styles.borderColorDanger, props.autoGrowHeight && {scrollPaddingTop: 2 * maxHeight}, ]); - const isMultiline = props.multiline || props.autoGrowHeight; return ( <> From a4b5a58f57ec7ea73ca00b31359375c49d4d772e Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 30 Nov 2023 17:01:02 +0700 Subject: [PATCH 4/4] fix typo in comment --- src/components/TextInput/BaseTextInput/index.native.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TextInput/BaseTextInput/index.native.js b/src/components/TextInput/BaseTextInput/index.native.js index 918f8e78aa9f..c30f932fb3a6 100644 --- a/src/components/TextInput/BaseTextInput/index.native.js +++ b/src/components/TextInput/BaseTextInput/index.native.js @@ -187,7 +187,7 @@ function BaseTextInput(props) { if (value && value.length > 0) { hasValueRef.current = true; - // When the componment is uncontrolled, we need to manually activate the label: + // When the component is uncontrolled, we need to manually activate the label if (props.value === undefined) { activateLabel(); }