Installation
Our React Native SDK provides pre-built chat UI components for your React Native application.
You can use the React Native SDK with React Native versions 0.64 and higher.
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:
Module | Works with Expo | Works with Expo Go |
---|---|---|
@talkjs/react-native | No | No |
@talkjs/expo | Yes | No |
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.
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
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.
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.
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
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.
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.
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.