Ecosyste.ms: Awesome

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

https://github.com/papercups-io/chat-widget-native

Papercups chat widget for React Native/Expo
https://github.com/papercups-io/chat-widget-native

chat chat-widget expo react-native

Last synced: 3 months ago
JSON representation

Papercups chat widget for React Native/Expo

Lists

README

        

# @papercups-io/chat-widget-native

> Papercups chat widget for React Native

[![NPM](https://img.shields.io/npm/v/@papercups-io/chat-widget-native.svg)](https://www.npmjs.com/package/@papercups-io/chat-widget-native) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Demo

Screen Shot 2020-08-16 at 8 57 25 PM

Try it out! https://snack.expo.io/@reichertjalex/papercups

## Install

```bash
npm install --save @papercups-io/chat-widget-native
```

## Usage

First, sign up at https://app.papercups.io/register to get your account token. Your account token is what you will use to pass in as the `accountId` prop below.

***NB**: make sure to pass in an `external_id` with the `customer` prop so that we can identify the person you're chatting with and load their message history if you've chatted with them before! (See below for an example)*

You can render the chat widget however you like. Here's how you might do it in a modal:

```tsx
import React from 'react';
import {StyleSheet, Button, View} from 'react-native';
import Modal from 'react-native-modal';
import ChatWidget from '@papercups-io/chat-widget-native';

export default function App() {
const [isModalVisible, setModalVisible] = React.useState(false);

return (

setModalVisible(true)} />

setModalVisible(false)}
>





);
}

const styles = StyleSheet.create({
modal: {
flex: 1,
borderRadius: 4,
overflow: 'hidden',
},
});
```

## License

MIT © Papercups