Getting started with the Knock React Native SDK

Get started with the Knock React Native SDK to build in-app notification experiences.

To get started, you will need the following:

  • A Knock Account
  • A public API key for the Knock environment (which you'll use in the publishableKey)
  • An in-app feed channel with a workflow that produces in-app feed messages (optional)
  • An APNS channel with a workflow that produces push notifications (optional)

Installation

  • Via NPM: npm install @knocklabs/react-native
  • Via Yarn: yarn add @knocklabs/react-native

Configuration

To configure the feed you will need:

  1. A public API key (found in the Knock dashboard)
  2. A user ID, and optionally an auth token for production environments
  3. If integrating an in-app feed, a feed channel ID (found in the Knock dashboard)
  4. If integrating push notifications, an Expo channel ID (found in the Knock dashboard)

Usage

You can integrate the feed into your app as follows:

Headless usage

Alternatively, if you don't want to use our components you can render the feed in a headless mode using our hooks: