Git Product home page Git Product logo

stream-chat-react-native's Introduction

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

You can sign up for a Stream account at https://getstream.io/chat/get_started/.

You can find detailed and set-by-step tutorial at https://getstream.io/chat/react-native-chat/tutorial/

You can find the design kit for this project at https://getstream.io/chat/ui-kit/

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 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:

react-native init StreamChatReactNativeExample
cd StreamChatReactNativeExample
yarn add stream-chat-react-native
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 react-navigation
yarn add react-native-gesture-handler
react-native link react-native-gesture-handler

and finally

react-native run-ios

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

Enable iCloud capability

How to run example

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
    make
    cd examples/one
    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
    make
    cd examples/two
    • For iOS
      react-native run-ios
    • For android
      react-native run-android

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

stream-chat-react-native's People

Contributors

vishalnarkhede avatar jeltef avatar tbarbugli avatar

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.