Installation

Easily add chat to your app with the React Native SDK.

To install the React Native SDK, you can choose from either of two TalkJS modules, depending on whether you would like to build using Expo:

ModuleWorks with ExpoWorks with Expo Go
@talkjs/react-nativeNoNo
@talkjs/expoYesNo

Using @talkjs/react-native

The @talkjs/react-native module allows you to build React Native apps fast.

Because some of its dependencies are incompatible with Expo, @talkjs/react-native is not suited for building on Expo. If you would like to build React Native apps using Expo, you can use @talkjs/expo instead.

Installation

Install the React Native SDK into your app from the command line. To ensure that the module can be loaded correctly, make sure also to explicitly install the SDK's peer dependencies, as follows (with either your npm or yarn package manager):

npm:

1npm install @talkjs/react-native @notifee/react-native @react-native-community/push-notification-ios @react-native-firebase/app @react-native-firebase/messaging react-native-webview

yarn:

1yarn add @talkjs/react-native @notifee/react-native @react-native-community/push-notification-ios @react-native-firebase/app @react-native-firebase/messaging react-native-webview

Usage

To import the React Native library into your project, add one of the following statements to your app's code, depending on what module system you are using:

ES6/TypeScript:

1import * as TalkjsRn from '@talkjs/react-native';

CommonJS:

1const TalkjsRn = require('@talkjs/react-native');

Once you have imported the library, to start using TalkJS in your project, follow the React Native getting started guide.

Using @talkjs/expo

The @talkjs/expo module allows you to build React Native apps fast on Expo. The module does not contain native code and it relies on dependencies that support Expo. This means that you can use it to build with Expo.

Because some of its dependencies contain native code, @talkjs/expo does not work with Expo Go. Also, its support for push notification is currently limited. See: Push notifications.

Installation

Install the React Native SDK and its dependencies from the command line, as follows:

1expo install @talkjs/expo @notifee/react-native @react-native-firebase/app @react-native-firebase/messaging react-native-webview

Usage

To import the React Native library into your project, add one of the following statements to your code, depending on what module system you are using:

ES6/TypeScript:

1import * as TalkjsRn from '@talkjs/expo';

CommonJS:

1const TalkjsRn = require('@talkjs/expo');

Once you have imported the library, to start using TalkJS in your project, follow the React Native getting started guide.

Push notifications

The @talkjs/expo module currently only supports sending push notifications through Firebase. This is for both Android and iOS. It does not support sending push notifications to iOS devices via APNs.

Beta release

Both @talkjs/react-native and @talkjs/expo are released in a beta state. This is because currently, the React Native SDK does not yet have all the features that are available in the TalkJS JavaScript SDK. As soon as the React Native SDK parallels the features available in the JavaScript SDK, we will release version 1.0.0 of the packages.

That said, we always maintain backward compatibility, so both packages are stable for production use.