Giter Club home page Giter Club logo

react-chat-ui's Introduction

react-chat-ui logo

๐Ÿ™Š react-chat-ui

A library of React components for building chat UI's.

NPM

Sponsor

Sponsored by Pusher Chatkit:

Pusher Chatkit

Features

  • Auto scroll to bottom
  • SUPER easy to use
  • Multiple user grouping (try it out in the demo)

Keep in mind that this project is still in the early stages of development. If you encounter a bug or have a feature request, please create an issue and/or tweet at me here.

Installation

npm install react-chat-ui --save

Basic Usage

import { ChatFeed, Message } from 'react-chat-ui'

// Your code stuff...

render() {

  return (

    // Your JSX...

    <ChatFeed
      messages={this.state.messages} // Array: list of message objects
      isTyping={this.state.is_typing} // Boolean: is the recipient typing
      hasInputField={false} // Boolean: use our input, or use your own
      showSenderName // show the name of the user who sent the message
      bubblesCentered={false} //Boolean should the bubbles be centered in the feed?
      // JSON: Custom bubble styles
      bubbleStyles={
        {
          text: {
            fontSize: 30
          },
          chatbubble: {
            borderRadius: 70,
            padding: 40
          }
        }
      }
    />

    // Your JSX...

  )

}

Make sure to keep a list of proper message objects in your class state. Like so:

//...
this.state = {
  messages: [
    new Message({
      id: 1,
      message: "I'm the recipient! (The person you're talking to)",
    }), // Gray bubble
    new Message({ id: 0, message: "I'm you -- the blue bubble!" }), // Blue bubble
  ],
  //...
};
//...

API

Contributing!ยก1 ๐Ÿ”ง

Contributions are always welcomed and encouraged. If you don't want to write a feature request yourself, let ya boi know (either on Twitter or by creating a Pull Request) and I'll get that shit coded right up.

TODO

  • documentation
  • documentation
  • documentation

Development

yarn dev

react-chat-ui's People

Contributors

bookercodes avatar brandonmowat avatar cchalfan1 avatar jfrumar-infinitusai avatar josowsky avatar moondef avatar ohing504 avatar sibelius avatar tpisto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-chat-ui's Issues

ChatFeed Overflow

Please change the overflow rule to auto, as is, the scrollbars look quite bad.

related to #6

React 16

I am experiencing an issue for the ChatInput when generated automatically.
In React 16.2 the "default" property is not available you can directly call createElement on react_1.

Is that right?

hasInputField no longer working

Setting hasInputField on the component results in an error

Cannot read property 'createElement' of undefined
/react-chat-ui/lib/ChatInput/index.js:24:28

Links

Passing a plain string object doesn't let us do very much! I know someone requested images, but links would be a good place to start? Maybe allow HTML objects?

Gonna modify your existing code to support these :)

chat and user text style properties inside bubble

I really enjoy your library.
However, the only option to overwrite the properties of a text is global for both 'blue' and 'grey' bubbles (in my case I want different text colors for each bubble). It would be better if we have the option to override text properties for each case alone.
Another solution could be to not set properties for the

inside bubbles, and let them inherit the properties of the bubble.
Thanks

Failed prop type: Cannot call a class as a function in ChatFeed

Hi,

I've recently upgraded my react-chat-ui to 0.1.0 and now it returns an error
Warning: Failed prop type: Cannot call a class as a function

Here is my code

import React, { Component } from 'react';
import { ChatFeed, Message } from 'react-chat-ui';

class ChatBox extends Component {
  constructor(props) {
    super(props);

    this.state = {
      messages : [
        (new Message({ id: 1, message: "This is the recipient!" })),
        (new Message({ id: 0, message: "This is me" }))
      ],
    }
  }
  render() {
    return (
      <ChatFeed
        messages={this.state.messages}
        isTyping={true}
        hasInputField={false}
        bubblesCentered={false}
        bubbleStyles={
          {
            text: {
              fontSize: 14
            },
            chatbubble: {
              borderRadius: 70,
              padding: 18
            }
          }
        }
      />
    )
  }
}

export default ChatBox;

Any solution with this? Thank you.

TypeScript

My plan is to re-write the project into TypeScript. This should not impact anyone that plans to or already uses react-chat-ui.

My reasoning for this is for code readability and type safety.

pagination

how to implement pagination with this library

Is this library active and still mantained?

Last commit for this project was 8 months back and no issues are also being replied to?

I really like this library and intend to use it if it is still actively maintained? Does any one have experience with using it long term, so you can shed some light into how well is it supported?

[Warning] Out of bound warning from MobX

When using react-chat-ui with MobX, it shows warning messages about out of bound.

Warning Messages:

...
[mobx.array] Attempt to read an array index (34) that is out of bounds (34). Please check length first. Out of bound indices will not be tracked by MobX
[mobx.array] Attempt to read an array index (35) that is out of bounds (35). Please check length first. Out of bound indices will not be tracked by MobX

Some Queries

Is this compatible with ReactJS and React Native both or either? Which one?

Does this support managing app state and reconnection logic? Can a feature supporting that be made if it doesn't.

Centered chat bubbles

It would be great to customize a chat bubble to be centered. Sometimes you don't want to have the classical chat view, especially if you want to build public chat rooms. Then it's nice to have all the chat bubbles in the middle of the page.

Thank you very much for implementing this improvement!

Input field not working, autoscroll not working

<ChatFeed
messages={messages} // Array: list of message objects
isTyping={false} // Boolean: is the recipient typing
/* hasInputField={} */
showSenderName // show the name of the user who sent the message
bubblesCentered={true} //Boolean should the bubbles be centered in the feed?
// JSON: Custom bubble styles
bubbleStyles={{
text: {
fontSize: 16,
},
chatbubble: {
borderRadius: 70,
padding: 10,
},
}}
/>

ChatBubble showing sending status

It would be great to have a visual component showing while sending and when sending failed (with the error message) or succeeded.

Custom bubble style for sender and myself

Hi, thank you for the cool simple library. Just wondering, can you point me to the implementation of custom bubble style for the sender. Example, if the background color of sender is other than gray and also a custom background color bubble for myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.