1
I have an input, and I need it to break line by pressing Enter and Shift + Enter, and only send the message by clicking the button. But he doesn’t break the line
handleChatInputPress = (e) => {
if ((e.key === "Enter" && e.shiftKey) || e.key === "Enter") {
return "\n";
} else {
this.handleSendButtonClick();
}
return (
<div className="chat-input-container d-flex justify-content-between align-items-center">
<Input
className="form-control flex-grow-1"
type="text"
placeholder={placeholder}
value={messageInput}
onKeyPress={(e) => {
if (enableSendMessage) {
handleChatInputPress(e);
}
}}
onChange={(e) => handleChatInputChange(e)}
/>
<div>
Inputs do not support line breaks even, will what you are looking for is not a
textarea
?– Andre