react-chat-widget
react-chat-widget copied to clipboard
Request - "typing" / loading indication
hi guys, I think a method to render typing/loading indication will be great here. it'll make the chat process nicer.
Thanks!
Hi Sahar ! We've been working on this as a new feature. I think you already saw the pull request, but I'll leave the link here anyway
https://github.com/Wolox/react-chat-widget/pull/101#issue-246422184
Thanks!
I followed your example, but it didnt work.
handleNewUserMessage = async newMessage => { toggleMsgLoader(); let { error, data } = await this.postChat(newMessage); if (!error) { toggleMsgLoader(); addResponseMessage(data.resposta); this.setState({ pergunta: newMessage, resposta: data.resposta }); } };
I get this error in console:
App.js:42 Uncaught (in promise) TypeError: Object(...) is not a function
Line 42 indicates the toggleMsgLoader function.
Did you do an import statement before using the toggleMsgLoader
function ?
Yes. import { Widget, addResponseMessage, toggleWidget, toggleMsgLoader } from "react-chat-widget";
Including toggleMsgLoader through error.
Unhandled Rejection (TypeError): Object(...) is not a function
.
Any work around.
Below is the snippet.
componentDidMount() {
toggleMsgLoader();
setTimeout(() => {
toggleMsgLoader();
console.log("Executed")
}, 2000)
}
Same error here. Is there any solution for this?
I have the same problem. It seem like the function toggleMsgLoader can't be found in the: ...\react-chat-widget\lib\index.js
Ah of course the lastest release v2.1.4 is from 25 Jul 2018 didn't have toggleMsgLoader so importing it would lead to error msg.
We can only hope that this project is not abandoned and there will be a new release including all new stuff in near future.
Hi all,
importing and using toggleMsgLoader
, works without error in v3.0.5, but it persists in the open conversation and the typing indicator does not disappear. The simplest usecase:
const handleNewUserMessage = (newMessage) => {
console.log(newMessage);
toggleMsgLoader();
addResponseMessage('This is a test.');
}
- No error and the indicator appears in the chat window, but just stays there and does not disappear when "This is a test." is printed in chat window...