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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-awesome-chat

v1.0.4

Published

An easy to integrate library to create flexible, customizable chat UIs for React Native

Downloads

18

Readme

Features

  • Auto-scroll animation as more messages are sent
  • Image uploading
  • Image backgrounds
  • Tap to resend a message
  • Swipe message to see timestamp
  • React Native 0.60+ support

Installation

npm install --save react-native-awesome-chat OR

yarn add react-native-awesome-chat

Dependencies

This project uses 2 native libraries : react-native-image-picker and react-native-vector-icons

If these libraries aren't already linked in your project, you need to link them. React Native 0.60+ has the handy auto-linking feature which makes this easier.

iOS

Just make sure your Info.plist has FontAwesome as one of its UIAppFonts :

<key>UIAppFonts</key>
    <array>
        <string>FontAwesome.ttf</string>
    </array>
</dict>
</plist>

Then, in your project's root directory, run :

cd ios && pod install

Android

Just add this line to android/app/build.gradle :

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

And these permissions to AndroidManifest.xml :

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

That's it - this will make sure the libraries are properly linked.

If you're using React Native < 0.60, then you will need to refer to the docs for react-native-image-picker and react-native-vector-icons to understand how to link the libraries, but it's still a pretty simple process.

Usage

import AwesomeChat from 'react-native-awesome-chat';

class App extends Component {
    constructor(props){
        super(props);
        this.state = {
            messages : [
                {body : "Hello", id : 1,
                timestamp : 1581418856, type : "sent", image_uri : ""},
                {body : "Hi", id : 2, 
                timestamp : 1581418856, type : "received", image_uri : ""}
            ],
        }
    }
    
    //AwesomeChat will pass the message object to this function
    sendMessage = async (message) => {
        let response = await axios.post(/*POST request to your DB*/)
        if(response.ok){
            return true;  
        } else {
            return false; //AwesomeChat will flag the message as unsent
        }
    }

    render(){
        return (
        <>
            <StatusBar barStyle="dark-content" />
            <SafeAreaView>
            <View style={{height : '100%'}}>
                <AwesomeChat 
                    onSendMessage={this.sendMessage} 
                    messages={this.state.messages}
                    //If new messages come in, just update this.state.messages
                />
            </View>
            </SafeAreaView>
        </>
        );
    }
};

Message Object

{
    body : "", /* Contents of message */
    id : "", /* Unique ID for the message - AwesomeChat will generate one for you for new messages */
    timestamp : 0, /* UNIX timestamp -  Can be retrieved from .getTime() on a Javascript Date Object */
    type : "", /* "sent" or "received" */
    image_uri : "" /* image uri if message is an image. Otherwise, can be left as an empty string. 
    AwesomeChat will populate this with the uri
    returned by ImagePicker for newly sent messages
    */
}

Props

Prop | Type | Description
---- | ---- | ----------- | messages| Array| messages to render
| onSendMessage| function | Callback function for when a message is sent. Should return true if the message was successfully sent and false otherwise for "Tap to Resend" to work (See example above)
| sentMessageStyle| Object| (optional) Style for sent messages
| receivedMessageStyle| Object| (optional) Style for received messages
| unsentMessageStyle| Object| (optional) Style for unsent messages | sentTextStyle| Object| (optional) Style for text of sent messages | receivedTextStyle| Object| (optional) Style for text of received messages
| unsentTextStyle| Object| (optional) Style for text of unsent messages
| backgroundColor| string| (optional) Background color
| backgroundImage| Object | (optional) Background image - the same object passed to the source prop of Image | timestampColor| string| (optional) Timestamp color
| errorColor| string| (optional) Color of 'Tap to resend' | placeholderTextColor| string| (optional) Color of input bar placeholder text
| leftIcon|Icon| (optional) Left icon of input bar
| rightIcon| Icon| (optional) Right icon of input bar
| inputContainerStyle| Object| (optional) Style of input bar container
| inputStyle| Object| (optional) Style of input in input bar

Some other notes

  • This library is a great choice if you're looking to quickly add some type of aesthetic chat UI to your project as an add-on feature, because it's very easy to integrate. But if you're looking to build an entire messaging app, you might find react-native-gifted-chat a better choice.
  • The message object this library uses doesn't include a field for the messager's identity - you will need to add any other additional context to this object (which shouldn't be difficult). I decided to stick with these simple fields because they're really all that's required for the UI.
  • AwesomeChat doesn't generate a timestamp for a message because it's assumed that the timestamp is only official once the server records the message. AwesomeChat will render timestamps for messages that have the timestamp field filled. For newly sent messages, the timestamp will become visible once the message finishes a round-trip to and then from the server.

License

Author

You can email me at [email protected] if you have any questions!