Farid from Safi ad7ac63697 fix camera roll
2016-07-30 21:00:24 +02:00
2016-07-30 21:00:24 +02:00
2016-07-30 21:00:24 +02:00
2016-07-30 20:26:26 +02:00
2016-07-30 18:19:42 +02:00
2016-07-30 18:19:42 +02:00
2016-07-30 18:19:42 +02:00
2016-07-29 14:22:26 +02:00
2016-07-29 14:22:26 +02:00
2016-07-17 21:47:23 +02:00
2016-07-30 18:19:42 +02:00
2016-07-30 21:00:24 +02:00

Gifted Chat

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

Installation

  • npm install react-native-gifted-chat --save

Android installation

  • Add windowSoftInputMode in your Android Manifest android/app/src/main/AndroidManifest.xml
<!-- ... -->
  android:label="@string/app_name"
  android:windowSoftInputMode="adjustResize" // <!-- add this -->
  android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<!-- ... -->

Minimal example

import React, { Component } from 'react';
import { GiftedChat } from 'react-native-gifted-chat';

class Example extends Component {
  constructor(props) {
    super(props);
    this.state = {messages: []};
    this.onSend = this.onSend.bind(this);
  }
  componentWillMount() {
    this.setState({
      messages: [
        {
          _id: 1,
          text: 'Hello developer',
          createdAt: new Date(Date.UTC(2016, 5, 11, 17, 10, 0)),
          user: {
            _id: 2,
            name: 'React Native',
            avatar: 'https://facebook.github.io/react/img/logo_og.png',
          },
        },
      ],
    });
  }
  onSend(messages = []) {
    this.setState((previousState) => {
      return {
        messages: GiftedChat.append(previousState.messages, messages),
      };
    });
  }
  render() {
    return (
      <GiftedChat
        messages={this.state.messages}
        onSend={this.onSend}
        user={{
          _id: 1,
        }}
      />
    );
  }
}

Advanced example

See example project

Props documentation

  • Work in progress

LICENSE

Feel free to ask me questions on Twitter @FaridSafi !

Description
No description provided
Readme MIT 42 MiB
Languages
JavaScript 88.9%
Objective-C 6.1%
Starlark 2.5%
Java 2.1%
Shell 0.4%