npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-xchat

v1.2.7

Published

Chat implementation in react native environment

Downloads

69

Readme

react-native-chat

Getting started

$ npm install react-native-xchat --save

Mostly automatic installation

$ react-native link react-native-xchat

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-chat and add RNChat.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNChat.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import eu.codlab.chat.RNChatPackage; to the imports at the top of the file
  • Add new RNChatPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-chat'
    project(':react-native-chat').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-chat/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      implementation project(':react-native-chat')

Usage

The Library provides 4 differents components

import {
	ConversationManager,
	ChatView,
	Message,
	User
} from 'react-native-chat';

ConversationManager

The ConversationManager provides accessors to create, list and save the followings :

  • users
    • conversations
    • messages (save only)
import {
	ConversationManager
} from 'react-native-chat';

//a manager ca
const conversationManager: ConversationManager = new ConversationManager();

getUsers

Returns : Promise<User[]> the list of users internally known by the library

createUser

Parameters :

  • user User a valid User to save into the library (or update)

Returns : Promise the saved instance of the User

getConversations

Returns : Promise<Conversation[]> the list of Conversation known to the library

createConversation

Parameters :

  • uuid string the unique identifier of the conversation to create (or update)
  • name string the name of the conversation

Returns : Promise the saved instance of the Conversation

addUserToConversation

Parameters :

  • user User the instance of User descriptor to save in the conversation
  • conversation Conversation the Conversation to bind the user in

Returns : Promise the success of the operation (normally true)

saveMessage

Parameters :

  • user User the sender of the message
  • conversation Conversation the conversation in which the message has been sent
  • message Message the message to register for both User/Conversation

Returns : Promise the saved Message

requery

Returns : Promise the query state

ChatView

The ChatView is a simple view which will display automatically messages as soon as they are sent or managed by the library. Any props modification will lead to :

  • reloading the conversation if the uuid is the same
  • loading the new conversation if it changed

Props managed by the View :

  • conversationUUID number the Conversation's uuid

Note that in the future, it'll be possible to directly pass the Conversation object

Usage

<ChatView conversationUUId="someUUID" />

Conversation

Conversations are simple interfaces with the following properties :

  • id number the internal identifier of the conversation
  • uuid string the onversation's uuid
  • name string the conversation's name
  • users User[] The list of Users in the conversation

User

Users are simple interfaces with the following properties :

  • uuid string the unique identifier
  • avatar string the user's avatar URL
  • name string the user's name
  • additionnal string? optionnal information about the user
  • sent_at number? optionnal Date number representation
  • additionnal number? optionnal Date number representation

Message

Messages are simple interfaces bound to various types :

Message

  • uuid string the unique identifier
  • content string the actual message content
  • additionnal string? optionnal information about the message
  • local boolean optional is this message local? (for instance sent by the user)

MessageImage

(inherits every properties of Message)

  • image string the url of the image to load

(additional is not used)

MessageIoT

(inherits every properties of Message)

  • image string? optional image to load as the product (for instance)
  • state_1 string information about the first specific state of the IoT
  • state_2 string information about the second specific state of the IoT
  • state_connectivity_1 string information about the connectivity for the first info
  • state_connectivity_2 string information about the connectivity for the second info

MessageSystem

(inherits every properties of Message)

  • image string? optional image to load
  • system boolean indicates if the message is a proper system message
  • error boolean is this message an error ?