File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed
Channel/components/MessageInput
Thread/components/ThreadMessageInput Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -599,6 +599,7 @@ declare module "SendbirdUIKitGlobal" {
599599 export type MessageInputProps = {
600600 // value is removed when channelURL changes
601601 value?: string;
602+ disabled?: boolean;
602603 ref?: React.MutableRefObject<any>;
603604 renderFileUploadIcon?: () => React.ReactElement;
604605 renderVoiceMessageIcon?: () => React.ReactElement;
@@ -1060,6 +1061,7 @@ declare module "SendbirdUIKitGlobal" {
10601061
10611062 export interface ThreadMessageInputProps {
10621063 className?: string;
1064+ disabled?: boolean;
10631065 renderFileUploadIcon?: () => React.ReactElement;
10641066 renderVoiceMessageIcon?: () => React.ReactElement;
10651067 renderSendMessageIcon?: () => React.ReactElement;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import VoiceMessageInputWrapper from './VoiceMessageInputWrapper';
1414
1515export type MessageInputWrapperProps = {
1616 value ?: string ;
17+ disabled ?: boolean ;
1718 renderFileUploadIcon ?: ( ) => React . ReactElement ;
1819 renderVoiceMessageIcon ?: ( ) => React . ReactElement ;
1920 renderSendMessageIcon ?: ( ) => React . ReactElement ;
@@ -29,6 +30,7 @@ const MessageInputWrapper = (
2930 renderVoiceMessageIcon,
3031 renderSendMessageIcon,
3132 } = props ;
33+ const propDisabled = props . disabled ;
3234 const {
3335 currentGroupChannel,
3436 initialized,
@@ -62,7 +64,8 @@ const MessageInputWrapper = (
6264 const [ ableMention , setAbleMention ] = useState ( true ) ;
6365 const [ messageInputEvent , setMessageInputEvent ] = useState ( null ) ;
6466 const [ showVoiceMessageInput , setShowVoiceMessageInput ] = useState ( false ) ;
65- const disabled = ! initialized
67+ const disabled = propDisabled
68+ || ! initialized
6669 || utils . isDisabledBecauseFrozen ( channel )
6770 || utils . isDisabledBecauseMuted ( channel )
6871 || ! isOnline ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { Role } from '../../../../lib/types';
1414
1515export interface ThreadMessageInputProps {
1616 className ?: string ;
17+ disabled ?: boolean ;
1718 renderFileUploadIcon ?: ( ) => React . ReactElement ;
1819 renderVoiceMessageIcon ?: ( ) => React . ReactElement ;
1920 renderSendMessageIcon ?: ( ) => React . ReactElement ;
@@ -29,6 +30,7 @@ const ThreadMessageInput = (
2930 renderVoiceMessageIcon,
3031 renderSendMessageIcon,
3132 } = props ;
33+ const propsDisabled = props . disabled ;
3234 const { config } = useSendbirdStateContext ( ) ;
3335 const { stringSet } = useLocalization ( ) ;
3436 const {
@@ -49,7 +51,9 @@ const ThreadMessageInput = (
4951 } = useThreadContext ( ) ;
5052 const messageInputRef = useRef ( ) ;
5153
52- const disabled = isMuted || ( ! ( currentChannel ?. myRole === Role . OPERATOR ) && isChannelFrozen ) || parentMessage === null ;
54+ const disabled = propsDisabled
55+ || isMuted
56+ || ( ! ( currentChannel ?. myRole === Role . OPERATOR ) && isChannelFrozen ) || parentMessage === null ;
5357
5458 // mention
5559 const [ mentionNickname , setMentionNickname ] = useState ( '' ) ;
You can’t perform that action at this time.
0 commit comments