An open API service indexing awesome lists of open source software.

https://github.com/livechat/react-native-livechat

React Native component to integrate LiveChat with your application.
https://github.com/livechat/react-native-livechat

Last synced: 5 months ago
JSON representation

React Native component to integrate LiveChat with your application.

Awesome Lists containing this project

README

          

### ⚠️ DEPRECATED ⚠️

This project is no longer maintained. In order to implement the LiveChat Chat Widget inside your React Native application, please use Webview to embed the web Chat Widget using a direct chat link.

To do it, use the `react-native-webview` library and add a `Webview` component as shown below. Remember to replace the `` string with your LiveChat's license id.

```javascript
',
}}
/>
```

# LiveChat for React Native

This is a React Native component to easily add [LiveChat widget](https://www.livechatinc.com/) to your application.

It works for both iOS and Android.

![LiveChat for React Native demo](https://raw.githubusercontent.com/venits/react-native-router-flux/master/livechatdemo.gif)

## Getting Started

### Prerequisites

To use LiveChat in your React application, you will need the LiveChat license ID.

To obtain authorization data (redirect_uri and client_id), you need to create a new LiveChat app. See our [Creating LiveChat apps](https://developers.livechatinc.com/docs/getting-started/guides/#creating-livechat-apps) documentation.

- `client_id` - identifies the application, you will receive it after creating a new application in [Developer Console](https://developers.livechatinc.com/console/apps)
- `redirect_uri` - it must be one of the URLs that you entered when creating the new app in the [Developer Console](https://developers.livechatinc.com/console/apps)

![LiveChat license ID](react-native-app-details.png)

If you don't have an account, you can create one [here](https://www.livechatinc.com/).

### Installation

To import LiveChat for React Native, run the following command to install required dependency (react-native-webview) and react-native-livechat library:

```javascript
npm install react-native-webview react-native-livechat --save
```

### Supported LiveChat features

- chatting
- sneak-peek
- rich messages: single cards with images, title, subtitle and quick replies
- agent's attachments
- system messages

### Unsupported LiveChat features

- pre-chat and post-chat forms
- rating
- transcript
- ticket forms
- queues
- translations
- card masking
- chat boosters
- customer's attachments
- sound notfifications
- updating customer info

If you would like to use unsupported features in your React Native app, read about the Alternative React Native installation method.

## User Guide

### Start

Having imported LiveChat for React Native, put it in your render method:

```javascript
import LiveChat from 'react-native-livechat'

...

```

You can also pass 'group' as a prop, to assign chat to chosen LiveChat group.

```javascript

```

### Customization

#### Chat bubble

The chat bubble is the round icon (chat trigger) in the bottom right corner of the screen.

##### Position

You can control the position of the bubble with `bubbleStyles` prop:

```javascript
const styles = StyleSheet.create({
bubbleStyles: {
position: 'absolute',
left: 24,
bottom: 24,
},
})

;
```

##### Color

You can change the color of the bubble by passing `bubbleColor` prop:

```javascript

```

##### Custom bubble

If you don't like the default bubble, you can send `bubble` prop with your own component:

```javascript
}
/>
```

#### Chat widget

This module uses [react-native-gifted-chat](https://github.com/FaridSafi/react-native-gifted-chat) for chat UI.

You can customise your chat widget by sending props to LiveChat component (like you would normally do with GiftedChat component).

For example, if you want `onPressAvatar` to show agent's details, you can do it like this:

```javascript
console.warn(info)} />
```

You can find all props in the official [react-native-gifted-chat documentation](https://github.com/FaridSafi/react-native-gifted-chat).

## Support

If you need any help, you can chat with us [here](https://livechatinc.com/).

I hope you will find this module useful. Happy coding!