# appmienviochat

appmienviochat is a react native typescript library that implements a customizable Chat that uses
[react-native-gifted-chat](https://www.npmjs.com/package/react-native-gifted-chat)

## Installation

```bash
npm i appmienviochat
```

## Usage

User is the original repository user data
ChatUser is used locally in the state of the package
Messages is to pre-load existing messages into the chat component.
onAddMessage is a function that takes a message as a parameter is called when the user sends a message to the chat.
onRefresh is a funcition that is called when the user clicks on the refresh icon

```react-native
<Chat user={{}} chatUser={{
                            _id: 1,
                            name: 'Developer',
                        }} messages={[{
                            _id: 9,
                            text: "#awesome 3",
                            createdAt: new Date(),
                            user: {
                              _id: 1,
                              name: "Developer",
                            },
                          },
                          {
                            _id: 8,
                            text: "#awesome 2",
                            createdAt: new Date(),
                            user: {
                              _id: 1,
                              name: "Developer",
                            },
                          }]}

                          onAddMessage={onAddMessageHandler}
                          onRefresh = {onRefreshHandler}
                          />
```
