react-chat-elements icon indicating copy to clipboard operation
react-chat-elements copied to clipboard

messageBox props asking so many props

Open praveengopu0105 opened this issue 1 year ago • 3 comments

i didnt know while working with typescript messageBox component asking so many required props but in documentation it having less props so when i just copy paste it is showing props are missing

praveengopu0105 avatar Feb 21 '24 10:02 praveengopu0105

Did you resolve this? Im facing the same issue

bhattiasad99 avatar Apr 21 '24 22:04 bhattiasad99

I bypassed this problem with Partial type. In code it may looks like:

function message(id:string, text:string, position: string):Partial<MessageType>{
    return {
        position: position,
        type: 'text',
        text: text,
        // date: new Date(),
        title: position=="left" ? "AI" : "You" ,
        id: id,
        titleColor:"black",
        forwarded: false,
        focus: false,
        removeButton : false,
        replyButton : false,
        //status : "",
        notch : true,
        retracted : false,
    }
}

//example
let messages = [message("0", loremIpsum(), "right") ...];
<MessageList
                referance={messageListReferance}
                lockable={true}
                toBottomHeight={'50%'}
                dataSource={messages as MessageType[]}
            />

You can delete any fields in message function and it must be correct.

Sorbuscorp avatar Apr 22 '24 12:04 Sorbuscorp

same issue

george-eucare avatar Apr 11 '25 06:04 george-eucare