# react-native-gifted-chat **Repository Path**: mirrors_jitsi/react-native-gifted-chat ## Basic Information - **Project Name**: react-native-gifted-chat - **Description**: 💬 The most complete chat UI for React Native - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2025-12-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

   react-native-gifted-chat

💬 Gifted Chat

The most complete chat UI for React Native
formerly known as Gifted Messenger

npm dowloads npm version build

 build  deployed


demo

## Sponsor

Sponsored by Pusher Chatkit:

Pusher Chatkit

## Features * Fully customizable components * Composer actions (to attach photos, etc.) * Load earlier messages * Copy messages to clipboard * Touchable links using [react-native-parsed-text](https://github.com/taskrabbit/react-native-parsed-text) * Avatar as user's initials * Localized dates * Multiline TextInput * InputToolbar avoiding keyboard * Redux support * System message ## Dependency * Use version `0.2.x` for RN `>= 0.44.0` * Use version `0.1.x` for RN `>= 0.40.0` * Use version `0.0.10` for RN `< 0.40.0` ## Installation * Using [npm](https://www.npmjs.com/#getting-started): `npm install react-native-gifted-chat --save` * Using [Yarn](https://yarnpkg.com/): `yarn add react-native-gifted-chat` ## Example ```jsx import React from 'react'; import { GiftedChat } from 'react-native-gifted-chat' class Example extends React.Component { state = { messages: [], } componentWillMount() { this.setState({ messages: [ { _id: 1, text: 'Hello developer', createdAt: new Date(), user: { _id: 2, name: 'React Native', avatar: 'https://placeimg.com/140/140/any', }, }, ], }) } onSend(messages = []) { this.setState(previousState => ({ messages: GiftedChat.append(previousState.messages, messages), })) } render() { return ( this.onSend(messages)} user={{ _id: 1, }} /> ) } } ``` ## Advanced example See [`example/App.js`](example/App.js) for a working demo! ## "Slack" example See the files in [`example-slack-message`](example-slack-message) for an example of how to override the default UI to make something that looks more like Slack -- with usernames displayed and all messages on the left. ## Message object e.g. Chat Message ```js { _id: 1, text: 'My message', createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)), user: { _id: 2, name: 'React Native', avatar: 'https://facebook.github.io/react/img/logo_og.png', }, image: 'https://facebook.github.io/react/img/logo_og.png', // Any additional custom parameters are passed through } ``` e.g. System Message ```js { _id: 1, text: 'This is a system message', createdAt: new Date(Date.UTC(2016, 5, 11, 17, 20, 0)), system: true, // Any additional custom parameters are passed through } ``` ## Props * **`messages`** _(Array)_ - Messages to display * **`text`** _(String)_ - Input text; default is `undefined`, but if specified, it will override GiftedChat's internal state (e.g. for redux; [see notes below](#notes-for-redux)) * **`placeholder`** _(String)_ - Placeholder when `text` is empty; default is `'Type a message...'` * **`messageIdGenerator`** _(Function)_ - Generate an id for new messages. Defaults to UUID v4, generated by [uuid](https://github.com/kelektiv/node-uuid) * **`user`** _(Object)_ - User sending the messages: `{ _id, name, avatar }` * **`onSend`** _(Function)_ - Callback when sending a message * **`locale`** _(String)_ - Locale to localize the dates * **`timeFormat`** _(String)_ - Format to use for rendering times; default is `'LT'` * **`dateFormat`** _(String)_ - Format to use for rendering dates; default is `'ll'` * **`isAnimated`** _(Bool)_ - Animates the view when the keyboard appears * **`loadEarlier`** _(Bool)_ - Enables the "Load earlier messages" button * **`onLoadEarlier`** _(Function)_ - Callback when loading earlier messages * **`isLoadingEarlier`** _(Bool)_ - Display an `ActivityIndicator` when loading earlier messages * **`renderLoading`** _(Function)_ - Render a loading view when initializing * **`renderLoadEarlier`** _(Function)_ - Custom "Load earlier messages" button * **`renderAvatar`** _(Function)_ - Custom message avatar; set to `null` to not render any avatar for the message * **`showUserAvatar`** _(Bool)_ - Whether to render an avatar for the current user; default is `false`, only show avatars for other users * **`showAvatarForEveryMessage`** _(Bool)_ - When false, avatars will only be displayed when a consecutive message is from the same user on the same day; default is `false` * **`onPressAvatar`** _(Function(`user`))_ - Callback when a message avatar is tapped * **`renderAvatarOnTop`** _(Bool)_ - Render the message avatar at the top of consecutive messages, rather than the bottom; default is `false` * **`renderBubble`** _(Function)_ - Custom message bubble * **`renderSystemMessage`** _(Function)_ - Custom system message * **`onLongPress`** _(Function(`context`, `message`))_ - Callback when a message bubble is long-pressed; default is to show an ActionSheet with "Copy Text" (see [example using `showActionSheetWithOptions()`](https://github.com/FaridSafi/react-native-gifted-chat/blob/master@%7B2017-09-25%7D/src/Bubble.js#L96-L119)) * **`inverted`** _(Bool)_ - Reverses display order of `messages`; default is `true` * **`renderMessage`** _(Function)_ - Custom message container * **`renderMessageText`** _(Function)_ - Custom message text * **`renderMessageImage`** _(Function)_ - Custom message image * **`imageProps`** _(Object)_ - Extra props to be passed to the [``](https://facebook.github.io/react-native/docs/image.html) component created by the default `renderMessageImage` * **`videoProps`** _(Object)_ - Extra props to be passed to the [`