Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions LiveChat/Chat/Chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ export default class Chat extends React.Component {
};

closeChat = () => {
this.chat.lightSpeedOut(500).then(() => {
this.props.closeChat();
});
if (this.props.animateOnClose) {
this.chat.lightSpeedOut(500).then(() => {
this.props.closeChat();
});
} else {
this.props.closeChat();
}
};

renderFooter = () => {
Expand All @@ -135,7 +139,7 @@ export default class Chat extends React.Component {
if (this.props.isChatOn) {
return (
<View
animation="lightSpeedIn"
animation={(this.props.animateOnOpen) ? "lightSpeedIn" : ""}
style={styles.container}
ref={(ref) => { this.chat = ref; }}
>
Expand Down
3 changes: 2 additions & 1 deletion LiveChat/LiveChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class LiveChat extends Component {
bubble={this.state.bubble}
disabled={this.props.movable}
/>
<Chat {...this.props} isChatOn={this.state.isChatOn} closeChat={this.closeChat} />
<Chat {...this.props} isChatOn={this.state.isChatOn} closeChat={this.props.closeChat || this.closeChat} />
</View>
);
}
Expand All @@ -85,6 +85,7 @@ LiveChat.propTypes = {
greeting: PropTypes.string,
noAgents: PropTypes.string,
onLoaded: PropTypes.func,
closeChat: PropTypes.func,
};

LiveChat.defaultProps = {
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,33 @@ Let's say you want to close the current chat. You can do it in two ways:
// is the same as:
GLOBAL.visitorSDK.closeChat();
```
#### Props

|Name|Type|Required|Note|
|---|---|---|---|
| animateOnOpen | Bool | No | Chat will open with an animation. |
| animateOnClose | Bool | No | Chat will close with an animation. |
| license | Int | Yes | License number for livechat. |
| group | Int | No | Description goes here. |
| movable | Bool | No | Description goes here. |
| bubble | Element | No | Description goes here. |
| bubbleColor | String | No | Description goes here. |
| bubbleLeft | Number | No | Description goes here. |
| bubbleTop | Number | No | Description goes here. |
| chatTitle | String | No | Description goes here. |
| greeting | String | No | Description goes here. |
| noAgents | String | No | Description goes here. |
| onLoaded | Func | No | Description goes here. |
| closeChat | Func | No | Overrides the default function to run when user clicks the "Back" button, closing the chat. |



#### Available methods

|Name|Note|
|---|---|
| closeChat | Closes the chat. |
| openChat | Opens the chat. |
| sendMessage | Sends a message. More information about message format you can find [here](https://docs.livechatinc.com/visitor-sdk/#sendmessage). |
| rateChat | Enables chat ratings. More info [here](https://docs.livechatinc.com/visitor-sdk/#ratechat). |
|setSneakPeek | Enables sneak peeks to see what the visitor is typing in before they actually send the message. More info [here](https://docs.livechatinc.com/visitor-sdk/#setsneakpeek). |
Expand Down