New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-livechat

Package Overview
Dependencies
Maintainers
59
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-livechat

React Native component to integrate LiveChat with your application

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
54
decreased by-21.74%
Maintainers
59
Weekly downloads
 
Created
Source

⚠️ 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 <LICENSE_ID> string with your LiveChat's license id.

<WebView
  source={{
    uri: 'https://secure.livechatinc.com/customer/action/open_chat?license_id=<LICENSE_ID>',
  }}
/>

LiveChat for React Native

This is a React Native component to easily add LiveChat widget to your application.

It works for both iOS and Android.

LiveChat for React Native demo

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 documentation.

  • client_id - identifies the application, you will receive it after creating a new application in Developer Console
  • redirect_uri - it must be one of the URLs that you entered when creating the new app in the Developer Console

LiveChat license ID

If you don't have an account, you can create one here.

Installation

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

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:

import LiveChat from 'react-native-livechat'

...

<LiveChat license="<LICENSE_ID>" redirectUri="https://example.org" clientId="<APP_CLIENT_ID>" />

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

<LiveChat
  group={2}
  license="<LICENSE_ID>"
  redirectUri="https://example.org"
  clientId="<APP_CLIENT_ID>"
  region="dal" // optional, dal is the default
/>

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:

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

;<LiveChat
  license="<LICENSE_ID>"
  redirectUri="https://example.org"
  clientId="<APP_CLIENT_ID>"
  bubbleStyles={styles.bubbleStyles}
/>
Color

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

<LiveChat
  bubbleColor="red"
  license="<LICENSE_ID>"
  redirectUri="https://example.org"
  clientId="<APP_CLIENT_ID>"
/>
Custom bubble

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

<LiveChat
  license="<LICENSE_ID>"
  redirectUri="https://example.org"
  clientId="<APP_CLIENT_ID>"
  bubble={<View style={{ width: 60, height: 60, backgroundColor: 'green' }} />}
/>
Chat widget

This module uses 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:

<LiveChat license="<LICENSE_ID>" onPressAvatar={(info) => console.warn(info)} />

You can find all props in the official react-native-gifted-chat documentation.

Support

If you need any help, you can chat with us here.

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

Keywords

FAQs

Package last updated on 26 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc