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

onToggleWidget()

Open mschersten opened this issue 5 years ago • 7 comments

I would like to detect when the chat widget is toggled. We have a method to toggle the widget, toggleWidget(), and we can use isWidgetOpened() to find the status of the toggle, but there is no event to attach to to know when that happens.

One option is to add a onToggleWidget() property, and with a little direction I can put that into a pull request.

Another option might be to use a custom launcher that duplicates the default launcher in appearance, but that calls a function that first calls the supplied handleToggle method and then calls isWidgetOpened().

Any feedback would be appreciated.

mschersten avatar Jun 16 '20 20:06 mschersten

any update on this? i would really like to have this functionality too

HumayounBaig avatar Sep 08 '20 11:09 HumayounBaig

I figured this out on my own, but never put it into a PR. I'll try to get to that.

mschersten avatar Oct 26 '20 19:10 mschersten

@mschersten can you please share your workaround with me. Would really appreciate it.

HumayounBaig avatar Oct 27 '20 06:10 HumayounBaig

I just added a PR: https://github.com/Wolox/react-chat-widget/pull/231

I'll leave this open for now, but hopefully it will be merged into the project and we can close this.

mschersten avatar Oct 27 '20 15:10 mschersten

Hi @mschersten I want to use your PR changes on my project. I cloned your change branch and built it successfully. But when I use them, I have following error. 1 What is error?

yerycs avatar Dec 25 '20 15:12 yerycs

Have you tried cloning this main repo and including it in the same way, or have you used it only through npm and this is your first attempt at cloning the project? I don't think your errors have anything to do with my changes, I only changed a few lines.

mschersten avatar Jan 05 '21 17:01 mschersten

There is an issue with my PR, though, that the handleToggle() method is only called when the user clicks on the loader, not when toggleWidget() is called. If anyone more familiar with React/Redux can advise it would be appreciated.

mschersten avatar Jan 05 '21 17:01 mschersten