Skip to content

A package you can use to build with XMTP in a React Native or Expo app.

License

Notifications You must be signed in to change notification settings

xmtp/xmtp-react-native

Repository files navigation

xmtp-react-native

Lint Status

This repo provides a package you can use to build with XMTP in a React Native or Expo app.

Is there a feature you need that's currently supported? Please open an issue.

Or better yet, open a PR and we'll get it reviewed and merged as soon as possible. If you contribute a PR that gets merged into this repo, you'll be eligible to claim this XMTP contributor POAP.

Documentation

To learn how to use the XMTP React Native SDK and get answers to frequently asked questions, see the XMTP documentation.

SDK reference

Access the XMTP React Native SDK reference documentation.

Example app

Use the XMTP React Native example app as a tool to start building an app with XMTP. This basic messaging app has an intentionally unopinionated UI to help make it easier for you to build with. See example/README.md for more instructions.

Example app quickstart

Follow the React Native guide to set up a CLI environment.

yarn
cd example
yarn
yarn run [ios or android]

Install in a managed Expo project

npx expo prebuild

Install in a bare React Native project

  1. Install and configure the expo package.

  2. Add the required babel plugin.

    yarn add @babel/plugin-proposal-export-namespace-from -D
  3. Add the plugin to your babel.config.js.

    module.exports = {
      presets: ['module:@react-native/babel-preset'],
      plugins: [
        '@babel/plugin-proposal-export-namespace-from',
        // ... other plugins
      ],
    };

Add the package to your dependencies

yarn add @xmtp/react-native-sdk

Configure for iOS

  1. In the ios directory, update your Podfile file to set this value: platform :ios, '16.0'. This is required by XMTP.

  2. Run:

    npx pod-install

If you get the error The SQLCipher Sqlite extension is not present, but an encryption key is given, at the project configuration level in XCode, ensure that xmtpV3 is loaded before all other packages by setting Other Linker Flags first item to -l"xmtpv3".

Configure for Android

Your app must use Android minSdkVersion = 22 to work with the xmtp-react-native SDK.

🏗 Breaking revisions

Because xmtp-react-native is in active development, you should expect breaking revisions that might require you to adopt the latest SDK release to enable your app to continue working as expected.

XMTP communicates about breaking revisions in the XMTP Discord community, providing as much advance notice as possible. Additionally, breaking revisions in an xmtp-react-native release are described on the Releases page.

Deprecation

Older versions of the SDK will eventually be deprecated, which means:

  1. The network will not support and eventually actively reject connections from clients using deprecated versions.
  2. Bugs will not be fixed in deprecated versions.

The following table provides the deprecation schedule.

Announced Effective Minimum Version Rationale
No more support for V2 March 1, 2025 3.0.0 In a move towards better security with MLS and the ability to decentralize we will be shutting down V2 and moving entirely to V3 MLS. You can see the legacy branch here: https://github.com/xmtp/xmtp-react-native/tree/xmtp-legacy

Issues and PRs are welcome in accordance with our contribution guidelines.