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

craftmusic-stream-chat-react-native-core

v0.4.0

Published

<a href="https://getstream.io/chat/react-native-chat/tutorial/"><img src="https://i.imgur.com/SRkDlFX.png" alt="react native chat" /></a>

Downloads

11

Readme

React Native Chat Components

The official React Native and Expo components for Stream Chat, a service for building chat applications.

NPM Build Status Component Reference

Quick Links

React Chat Tutorial

The best place to start is the React Native Chat Tutorial. It teaches you how to use this SDK and also shows how to make common changes.

Example Apps

This repo includes 2 example apps. One that's used with Expo, and one for native.

Expo example

  1. Make sure node version is >= v10.13.0
  2. yarn global add expo-cli
    git clone https://github.com/GetStream/stream-chat-react-native.git
    cd stream-chat-react-native/examples/ExpoMessaging
    yarn && yarn start

Native example

  1. Please make sure you have installed necessary dependencies depending on your development OS and target OS. Follow the guidelines given on official react native documentation for installing dependencies: https://facebook.github.io/react-native/docs/getting-started#

  2. Make sure node version is >= v10.13.0

  3. Start the simulator

  4. git clone https://github.com/GetStream/stream-chat-react-native.git
    cd stream-chat-react-native/examples/NativeMessaging
    yarn install
    • For iOS
      react-native run-ios
    • For android
      react-native run-android

    If you run into following error on android:

    Execution failed for task ':app:validateSigningDebug'.
    > Keystore file '/path_to_project/stream-chat-react-native/examples/NativeMessaging/android/app/debug.keystore' not found for signing config 'debug'.

    You can generate the debug keystore by running this command in the android/app/ directory: keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 - Reference

Docs

The styleguidist docs for stream-chat-react-native document how all the components work.

The React Native components are created using the stream-chat-js library. If you're customizing the components it's important to learn how the Chat Server API works. You'll want to review our JS chat API docs.

Keep in mind

  1. Navigation between different component is something we expect consumers to implement. You can checkout the example given in this repository

Library currently exposes following components:

  1. Avatar
  2. Chat
  3. Channel
  4. MessageList
  5. TypingIndicator
  6. MessageInput
  7. MessageSimple
  8. ChannelList
  9. Thread
  10. ChannelPreviewMessenger
  11. CloseButton
  12. IconBadge

You can see detailed documentation about the components at https://getstream.github.io/stream-chat-react-native

Usage (creating an example app)

Expo package

yarn global add expo-cli
# expo-cli supports following Node.js versions:
# * >=8.9.0 <9.0.0 (Maintenance LTS)
# * >=10.13.0 <11.0.0 (Active LTS)
# * >=12.0.0 (Current Release)
expo init StreamChatExpoExample
cd StreamChatExpoExample
yarn add stream-chat-expo

Please check Example to see usage of the components.

OR you can swap this file for your App.js in the root folder with additional following steps:

yarn add react-navigation

and finally

yarn start

Native package:

For react native < 0.60

react-native init StreamChatReactNativeExample
cd StreamChatReactNativeExample
yarn add stream-chat-react-native

# https://github.com/react-native-community/react-native-netinfo#react-native-compatibility
# For React native 0.59.x - use @react-native-community/[email protected]
# For React native <= 0.58.x - use @react-native-community/[email protected]
yarn add @react-native-community/[email protected]

# https://github.com/react-native-community/react-native-image-picker#react-native-compatibility
yarn add [email protected]
yarn add react-native-document-picker

react-native link @react-native-community/netinfo

# if you are plannign to use image picker or file picker or both
react-native link react-native-image-picker
react-native link react-native-document-picker

Please check Example to see usage of components.

OR you can swap this file for your App.js in root folder with additional following steps:

yarn add [email protected]
yarn add [email protected] react-native-reanimated
react-native link react-native-gesture-handler
react-native link react-native-reanimated

If you are planning to use image picker, there are some additional steps to be done. You can find them here - https://github.com/react-native-community/react-native-image-picker/blob/master/docs/Install.md

If you are planning to use file/document picker, you need to enable iCloud capability in your app - https://github.com/Elyx0/react-native-document-picker#reminder

and finally

react-native run-ios

For react native >= 0.60

react-native init StreamChatReactNativeExample
cd StreamChatReactNativeExample
yarn add stream-chat-react-native
yarn add @react-native-community/netinfo react-native-image-picker react-native-document-picker
cd ios && pod install && cd ..

Just to be sure, please verify you are using appropriate version of following packages as per your react-native version.

  • netinfo : https://github.com/react-native-community/react-native-netinfo#react-native-compatibility

  • react-native-image-picker : https://github.com/react-native-community/react-native-image-picker#react-native-compatibility

Please check Example to see usage of components.

OR you can swap this file for your App.js in root folder with additional following steps:

yarn add [email protected]
yarn add react-native-gesture-handler react-native-reanimated
cd ios && pod install && cd ..

If you are planning to use image picker, there are some additional steps to be done. You can find them here - https://github.com/react-native-community/react-native-image-picker/blob/master/docs/Install.md

If you are planning to use file/document picker, you need to enable iCloud capability in your app - https://github.com/Elyx0/react-native-document-picker#reminder

and finally

iOS:

react-native run-ios

Note for Android:

If you are using androidx app:

AndroidX is a major step forward in the Android ecosystem, and the old support library artifacts are being deprecated. For 0.60, React Native has been migrated over to AndroidX. This is a breaking change, and your native code and dependencies will need to be migrated as well.

(reference: https://facebook.github.io/react-native/blog/2019/07/03/version-60#androidx-support)

In current context, dependencies such as react-native-document-picker and (if you are using react-navigation) react-native-gesture-handler, react-native-reanimated don't have androidx support. But awesome tool named jetifier is quite usefull to patch these dependencies with androidx support.

NOTE If you are planning to use file picker functionality, make sure you enable iCloud capability in your app

Enable iCloud capability

Upgrade

  • Upgrade from 0.1.x to 0.2.x:

    • 0.2.x added support for react native 0.60. Dependencies like react-native-image-picker, react-native-document-picker and netinfo have been taken out of hard dependencies and moved to peer dependencies and thus will have to be installed manually on consumer end (Reference)

    • React native 0.60 came with autolinking functionality, that means if some native libraries are linked manually before upgrade, they will have to be unliked so that react native can autolink them (Reference)

      react-native unlink react-native-image-picker
      react-native unlink react-native-document-picker
      react-native unlink @react-native-community/netinfo
    • React native 0.60 has been migrated over to AndroidX. In current context, dependencies such as react-native-document-picker and (if you are using react-navigation) react-native-gesture-handler, react-native-reanimated don't have androidx support. But awesome tool named jetifier is quite usefull to patch these dependencies with androidx support.

    • CocoaPods are not part of React Native's iOS project (ref). Thus make sure to install all the pod dependencies.

      cd ios && pod install && cd ..

Common issues

While running native example, you may (not necessarily) run into following issues:

  1. When you execute react-native run-ios for the first time, it starts a metro bundler in parallel. It can result into some errors, since build process isn't complete yet. Try the following to fix this:

    1. Close/stop the metro bundler process.
    2. Let the build process finish completely, it can take usually around 2-3 minutes for the first time.
    3. Start the metro bundler manually by executing yarn start inside stream-chat-react-native/examples/two directory.
  2. When you execute react-native run-android, you may (not necessarily) run into following error:

    info Starting JS server...
    info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
    Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':@react-native-community_netinfo'.
    > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 13s
    error Could not install the app on the device, read the error above for details.
    Make sure you have an Android emulator running or a device connected and have
    set up your Android development environment:
    https://facebook.github.io/react-native/docs/getting-started.html
    error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

    To resolve this, do the following

    1. Craete a file named local.properties inside stream-chat-react-native/examples/two/android directory
    2. Put the this line in that file. Make sure sdk path is correctly mentioned as per your system:
      sdk.dir=/Users/{user_name}/Library/Android/sdk/
    3. Rerun react-native run-android in stream-chat-react-native/examples/two directory