From 6775b5bf4af2c923c280fe2d9ebf503951af1da4 Mon Sep 17 00:00:00 2001 From: Fernando Escobar Date: Tue, 8 Sep 2020 17:51:53 -0300 Subject: [PATCH] Adding a max length for the input --- .../components/Conversation/components/Sender/index.tsx | 4 +++- src/components/Widget/components/Conversation/index.tsx | 5 ++++- src/components/Widget/index.tsx | 3 +++ src/components/Widget/layout.tsx | 3 +++ src/index.tsx | 4 ++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/Widget/components/Conversation/components/Sender/index.tsx b/src/components/Widget/components/Conversation/components/Sender/index.tsx index 045e28c73..f9426fef8 100644 --- a/src/components/Widget/components/Conversation/components/Sender/index.tsx +++ b/src/components/Widget/components/Conversation/components/Sender/index.tsx @@ -14,9 +14,10 @@ type Props = { sendMessage: (event: any) => void; buttonAlt: string; onTextInputChange?: (event: any) => void; + maxLength: number; } -function Sender({ sendMessage, placeholder, disabledInput, autofocus, onTextInputChange, buttonAlt }: Props) { +function Sender({ sendMessage, placeholder, disabledInput, autofocus, onTextInputChange, buttonAlt, maxLength }: Props) { const showChat = useSelector((state: GlobalState) => state.behavior.showChat); const inputRef = useRef(null); // @ts-ignore @@ -34,6 +35,7 @@ function Sender({ sendMessage, placeholder, disabledInput, autofocus, onTextInpu autoFocus={autofocus} autoComplete="off" onChange={onTextInputChange} + maxLength={maxLength} />