All Projects → PeterKottas → React Bell Chat

PeterKottas / React Bell Chat

Licence: mit
🔔 Easy to use chat user interface for React

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Bell Chat

Chat21 Ios Sdk
DEPRECATED
Stars: ✭ 15 (-60.53%)
Mutual labels:  chat, chat-application
Enigma
A full-fledged one-to-one chat app developed entirely in Flutter
Stars: ✭ 316 (+731.58%)
Mutual labels:  chat, chat-application
Stream Chat Swift
Official iOS SDK for Stream Chat
Stars: ✭ 277 (+628.95%)
Mutual labels:  chat, chat-application
Chattt
❯❯❯ Chat without leaving your terminal
Stars: ✭ 239 (+528.95%)
Mutual labels:  chat, chat-application
Rasa Webchat
A feature-rich chat widget for Rasa and Botfront
Stars: ✭ 507 (+1234.21%)
Mutual labels:  chat, chat-application
NIM iOS UIKit
网易云信 iOS UI 组件,提供聊天界面,文本消息,图片消息,语音消息,视频消息,地理位置消息,自定义消息(阅后即焚)等消息示例。#推荐客户得比特币/京东卡,现在推荐使用网易云信,最低得0.02BTC或3000元京东卡/单,点击参与:https://yunxin.163.com/promotion/recommend
Stars: ✭ 1,371 (+3507.89%)
Mutual labels:  chat, chat-application
Falconmessenger
🌟🌟🌟🌟🌟 Falcon Messenger is a Fast and Beautiful cloud-based messaging app. With iOS and IPadOS Support. Available on the App Store.
Stars: ✭ 310 (+715.79%)
Mutual labels:  chat, chat-application
Space
A real time chat app for developers built using React, Redux, Electron and Firebase
Stars: ✭ 161 (+323.68%)
Mutual labels:  chat, chat-application
Quaternion
A Qt5-based IM client for Matrix
Stars: ✭ 438 (+1052.63%)
Mutual labels:  chat, chat-application
Messenger
Open source, native iOS Messenger, with realtime chat conversations (full offline support).
Stars: ✭ 4,264 (+11121.05%)
Mutual labels:  chat, chat-application
Nio
💬 Nio is an upcoming matrix client for iOS.
Stars: ✭ 235 (+518.42%)
Mutual labels:  chat, chat-application
Chat
Instant messaging platform. Backend in Go. Clients: Swift iOS, Java Android, JS webapp, scriptable command line; chatbots
Stars: ✭ 8,238 (+21578.95%)
Mutual labels:  chat, chat-application
Chat21 Android Sdk
Android Chat SDK built on Firebase
Stars: ✭ 204 (+436.84%)
Mutual labels:  chat, chat-application
SocketIO Chat APP
This is the simple Chat Application in which user can join the room and continue chatting with others.
Stars: ✭ 50 (+31.58%)
Mutual labels:  chat, chat-application
Chatlayout
ChatLayout is an alternative solution to MessageKit. It uses custom UICollectionViewLayout to provide you full control over the presentation as well as all the tools available in UICollectionView. It supports dynamic cells and supplementary view sizes.
Stars: ✭ 184 (+384.21%)
Mutual labels:  chat, chat-application
Mercurius
Real-time Messenger for Laravel
Stars: ✭ 309 (+713.16%)
Mutual labels:  chat, chat-application
Igdm
Desktop application for Instagram DMs
Stars: ✭ 1,880 (+4847.37%)
Mutual labels:  chat, chat-application
Webapp
Tinode web chat using React
Stars: ✭ 156 (+310.53%)
Mutual labels:  chat, chat-application
Vue Advanced Chat
A beautiful chat rooms component made with Vue.js - compatible with Vue, React & Angular
Stars: ✭ 351 (+823.68%)
Mutual labels:  chat, chat-application
Darkwire.io
End-to-end encrypted instant web chat
Stars: ✭ 594 (+1463.16%)
Mutual labels:  chat, chat-application

🔔 react-bell-chat

A library of React components for building chat UIs.

DEMO

Live demo

NPM

Features

  • Chat like scroll behavior (eg. automatic scroll to bottom)
  • Load more messages on scrolling to the top (with custom threshold)
  • SUPER easy to use
  • Customize anything
  • Author avatars
  • Last seen messages for each author
  • Show if authors are typing or not
  • Automatic date rows (when the following message is from a different date than the preceding one)

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.

Installation

npm install react-bell-chat --save

OR

yarn add react-bell-chat

Basic Usage

import { ChatFeed } from 'react-bell-chat'

// Your code stuff...

render() {

  return (

    // Your JSX...

    <ChatFeed
      messages={this.state.messages} // Array: list of message objects
      authors={this.state.authors} // Array: list of authors
      yourAuthorId={2} // Number: Your author id (corresponds with id from list of authors)
    />

    // Your JSX...

  )

}

The bare minimum is to provide a list of messages and authors, check this out for an example:

//...
this.state = {
  messages: [
    {
      id: 1,
      authorId: 1,
      message: "Sample message",
      createdOn: new Date(),
      isSend: true
    },
    {
      id: 2,
      authorId: 2,
      message: "Second sample message",
      createdOn: new Date(),
      isSend: false
    },
  ],
  authors: [
    {
      id: 1,
      name: 'Mark',
      isTyping: true,
      lastSeenMessageId: 1,
      bgImageUrl: undefined
    },
    {
      id: 2,
      name: 'Peter',
      isTyping: false,
      lastSeenMessageId: 2,
      bgImageUrl: undefined
    }
  ]
};
//...

Complete props for author:

typescript

export interface Author {
    id: number;
    name: string;
    avatarName?: string;
    lastSeenAvatarName?: string;
    isTyping?: boolean;
    lastSeenMessageId?: number;
    bgImageUrl?: number;
}

Complete props for message:

typescript

export interface Message {
  id?: number;
  authorId?: number; // If undefined, message is considered to be "System message"
  message: string;
  createdOn?: Date;
  isSend?: boolean;
}

API

Api is obtained as ref of the ChatFeed component. It's divided in 2 parts, feedApi and scrollApi. Ref gives you and object like this:

interface ChatFeedApi {
  onMessageSend: () => void; // Should be called when user sends a message (this scrolls the component down)
  scrollApi: ChatScrollAreaApi;
}

Where scroll api is

interface ChatScrollAreaApi {
  scrollToBottom: (behavior?: ScrollBehavior) => void;
  scrollTo: (top: number) => void;
  scrolledToBottom: () => boolean; // Check if we are scrolled to bottom
  scrolledToLoadThreshold: () => boolean; // Check if we are scrolled to threshold where we need to load messages
}

Whole list of properties

export interface ChatFeedProps {
  // Structural props
  className?: string;

  // Functional props
  messages: Message[];
  authors: Author[];
  yourAuthorId: number;
  hasOldMessages?: boolean;
  loadOldMessagesThreshold?: number;

  // Visual props
  bubblesCentered?: boolean;
  bubbleStyles?: ChatBubbleStyles;
  maxHeight?: string | number;
  minHeight?: string | number;

  // Switches
  showDateRow?: boolean;
  showRecipientAvatar?: boolean;
  showRecipientLastSeenMessage?: boolean;
  showIsTyping?: boolean;
  showLoadingMessages?: boolean;

  // Extra container styles for custom components
  showRecipientAvatarChatMessagesStyle?: React.CSSProperties;
  showRecipientLastSeenMessageChatMessagesStyle?: React.CSSProperties;
  showIsTypingChatMessagesStyle?: React.CSSProperties;

  // Custom components
  customLoadingMessages?: (props: LoadingMessagesProps) => JSX.Element;
  customChatBubble?: (props: ChatBubbleProps) => JSX.Element;
  customSystemChatBubble?: (props: ChatBubbleProps) => JSX.Element;
  customAvatar?: (props: AvatarProps) => JSX.Element;
  customScrollArea?: (props: ChatScrollAreaProps) => JSX.Element;
  customIsTyping?: (props: ChatScrollAreaProps) => JSX.Element;
  customLastSeenAvatar?: (props: LastSeenAvatarProps) => JSX.Element;
  customDateRow?: (props: DateRowProps) => JSX.Element;

  // Callbacks
  onLoadOldMessages?: () => Promise<void>; // Make sure to return promise that only resolves after state is updated.

  ref?: (api: ChatFeedApi) => void;
}

Custom components

Most of the UI is customizable via injecting custom components. These are pure components, the library injects props to them so that you can customize pretty much anything.

FAQ

Q: My chat is scrolling up/down automatically every time I use setState on parent component.

A: Make sure to provide const expressions for custom components. Not inline functions.

Created and sponsored by

  • GuestBell - Customer centric online POS for Hotels and short terms stays.

Contributing 🔧

Contributions are always welcomed and encouraged.

Development

npm run start

Acknowledgments

This lib started as a fork from https://github.com/brandonmowat/react-chat-ui

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].