Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip line break in task title #31904

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Beamanator marked this conversation as resolved.
Show resolved Hide resolved
* @memberof BaseTextInput
*/
const setValue = (value) => {
const setValue = (val) => {
const value = isMultiline ? val : val.replace(/\n/g, ' ');

if (props.onInputChange) {
props.onInputChange(value);
}
Beamanator marked this conversation as resolved.
Show resolved Hide resolved
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
Loading