Stream React Native Activity Feed Components
Clone or download
Latest commit b37f3f4 Jan 10, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Hopefully better issue template Dec 12, 2018
bin Publish as non beta Dec 17, 2018
custom-definitions ReactionList: Support reverse ordering and loading oldest to newest Jan 10, 2019
docs 0.8.5 Jan 10, 2019
dotgit Add pre-commit hooks Jul 18, 2018
example ReactionList: Support reverse ordering and loading oldest to newest Jan 10, 2019
expo-package 0.8.5 Jan 10, 2019
flow-typed/npm Make SinglePostScreen functional Aug 9, 2018
native-example Update getstream more Jan 9, 2019
native-package 0.8.5 Jan 10, 2019
src ReactionList: Support reverse ordering and loading oldest to newest Jan 10, 2019
.babelrc Support expo with expo-activity-feed repo Aug 20, 2018
.editorconfig Add some basic flow stuff profile screen code Jul 17, 2018
.eslintignore add missing js build Aug 23, 2018
.eslintrc.json Update getstream definitions Nov 28, 2018
.flowconfig rename pager into NewActivitiesNotification Aug 24, 2018
.gitignore Merge branch 'master' into stream-js-4 Dec 14, 2018
.ignore Docs: Update docs slightly Oct 17, 2018
.prettierignore add missing js build Aug 23, 2018
.prettierrc Add eslint support and better prettier support as well Jul 17, 2018
.watchmanconfig first commit Jun 13, 2018
CHANGELOG.md Update CHANGELOG Jan 8, 2019
README.md rename session vars and props into client to avoid confusion Nov 26, 2018
package.json 0.8.5 Jan 10, 2019
styleguide.config.js Update eslint and prettier Dec 14, 2018
yarn.lock Update getstream library Jan 9, 2019

README.md

Stream React Native Activity Feed Components

react native activity feed

The official React Native integration library for Stream, a web service for building scalable newsfeeds and activity streams.

TL;DR built-in components for social networks and regular apps

  • Flat feeds
  • Notification feed
  • Likes
  • Comments
  • Activity detail view
  • Realtime notifications

Useful links

Get Started

Example app

Component reference docs

Installation

The components provided by this package are available for apps built with Expo (created with create-react-native-app), but also for apps with native code (created with react-native init). You should install the package that matches your situation:

# For Expo apps
npm i expo-activity-feed --save

# For apps with native code
npm i react-native-activity-feed --save

Both packages export the same components (which they re-export from the underlying react-native-activity-feed-core package).

Final setup steps for the react-native-activity-feed package

If you use the package for apps with native code you need to do some more steps to get the image upload functionality working. If you don't need that feel free to skip these steps.

  1. Run the following command:
react-native link react-native-image-picker

Add the following permissions to android/app/src/main/AndroidManifest.xml:

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

Add the following key/value pairs to ios/{app-name-here}/Info.plist:

	<key>NSPhotoLibraryUsageDescription</key>
	<string>$(PRODUCT_NAME) would like access to your photo gallery</string>
	<key>NSCameraUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to use your camera</string>
	<key>NSPhotoLibraryAddUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to save photos to your photo gallery</string>
	<key>NSMicrophoneUsageDescription</key>
	<string>$(PRODUCT_NAME) would like to your microphone (for videos)</string>
  1. Make sure that the gradle version inside android/build.gradle is 2.2.0 or higher:
buildscript {
    // ....
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }
}

Usage & Activity Feed setup

Setup StreamApp component

In order to use Stream React Components in your application, you first need to initialize the StreamApp component. StreamApp holds your application config and acts as a service/data provider.

<StreamApp
  apiKey="{API_KEY}"
  appId="{APP_ID}"
  userId="{USER_ID}"
  token="{TOKEN}"
  analyticsToken="{ANALYTICS_TOKEN}"
>
{/* everything from your application interacting with Stream should be nested here */}
</StreamApp>
  1. API_KEY your Stream application API_KEY
  2. API_ID your Stream application ID
  3. USER_ID current user's ID
  4. TOKEN the authentication token for current user
  5. ANALYTICS_TOKEN [optional] the Analytics auth token

You can find your API_KEY and APP_ID on Stream's dashboard.

Generating user token

The authentication user token cannot be generated client-side (that would require sharing your API secret). You should provision a user token as part of the sign-up / login flow to your application from your backend.

var client = stream.connect(API_KEY, API_SECRET);
var userToken = client.createUserToken(userId);

Generating analytics token

React components have analytics instrumentation built-in, this simplifies the integration with Stream. In order to enable analytics tracking, you need to initialize StreamApp with a valid analytics token. You can generate this server-side as well.

var client = stream.connect(API_KEY, API_SECRET);
var userToken = client.getAnalyticsToken();

Copyright and License Information

Copyright (c) 2015-2018 Stream.io Inc, and individual contributors. All rights reserved.

See the file "LICENSE" for information on the history of this software, terms & conditions for usage, and a DISCLAIMER OF ALL WARRANTIES.