Skip to content

Commit

Permalink
Merge pull request Expensify#31904 from tienifr/fix/31440
Browse files Browse the repository at this point in the history
Strip line break in task title
  • Loading branch information
Beamanator authored Nov 30, 2023
2 parents d565caa + a4b5a58 commit 0389d5b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/TextInput/BaseTextInput/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -172,10 +173,12 @@ function BaseTextInput(props) {
/**
* Set Value & activateLabel
*
* @param {String} value
* @param {String} val
* @memberof BaseTextInput
*/
const setValue = (value) => {
const setValue = (val) => {
const value = isMultiline ? val : val.replace(/\n/g, ' ');

if (props.onInputChange) {
props.onInputChange(value);
}
Expand All @@ -184,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();
}
Expand Down Expand Up @@ -227,7 +230,6 @@ function BaseTextInput(props) {
(props.hasError || props.errorText) && styles.borderColorDanger,
props.autoGrowHeight && {scrollPaddingTop: 2 * maxHeight},
]);
const isMultiline = props.multiline || props.autoGrowHeight;

return (
<>
Expand Down

0 comments on commit 0389d5b

Please sign in to comment.