Open tmyers101 opened 1 year ago
Has been proposed here #71 , guess it's not a thing yet
Seems like the it updates the visibility of the widget when the prop is changed here
Maybe changing the visibility prop of the LiveChatWidget will help, something like;
import { FunctionComponent, useState } from 'react';
import { LiveChatWidget, WidgetState, useWidgetIsReady } from '@livechat/widget-react';
const LiveChatWidgetSection: FunctionComponent = () => {
const isWidgetReady = useWidgetIsReady();
const [liveChatWidgetVisibility, setLiveChatWidgetVisibility] = useState<WidgetState['visibility']>('hidden');
if (!isWidgetReady) {
return null;
}
return (
<>
<button onClick={() => setLiveChatWidgetVisibility('maximized')}>
Change LiveChat Widget Visibility
</button>
<LiveChatWidget
license='your_license_here'
visibility={liveChatWidgetVisibility}
/>
</>
);
};
export default LiveChatWidgetSection;
This is more of a question. Is there a way to programmatically start a chat in the React Chat Widget? I want to start a chat when a user clicks on a button that I created.