Blog Post

How to Use PSPDFKit for React Native with Expo

Julius Kato Mutumba
Illustration: How to Use PSPDFKit for React Native with Expo

Expo is a React Native platform that significantly simplifies the process of developing, building, and testing React Native apps.

But there’s one major downside with Expo, which is that it’s optimized to be used purely with JavaScript out of the box. Therefore, additional steps are needed for a developer to use any package that depends on native code. In fact, the native code isn’t even included in the project from the initial setup. To be able to run on the respective platform, the Expo Go app is used to provide the necessary platform base.

PSPDFKit for React Native is implemented on top of the existing native PSPDFKit Android and iOS SDKs. This means it won’t work in a project that runs in the Expo Go app.

In this blog post, you’ll learn how to add native module support to an Expo project by setting up a development build using the Expo Application Services (EAS) CLI to be able to use the PSPDFKit React Native package.


To get started, set up your environment by installing the following tools if you don’t have them installed already:

Creating an Expo Project

You’ll start by creating a normal Expo project that can run in Expo Go. If you’re new to Expo, consider familiarizing yourself with the official Expo documentation.

Use the command below to create a new project:

npx create-expo-app pspdpfkit-expo

In this example, the project is named pspdfkit-expo, but you can change it to one of your choice. Test that your app is correctly set up by running npx expo start to launch the application.

Development Build

A development build allows you to run a React Native app outside the Expo Go client. It generates the respective platform modules with all the native code required for the app to run independently.

EAS configurations are stored in the eas.json file. Run the command below in your project’s root folder to generate and configure the file:

eas build:configure

You’ll be presented with a list of platforms to choose from. Select the option that best suits your app’s platforms. Then press Enter.

If you selected All, you’ll now have the eas.json file in your project. It looks like this:

	"cli": {
		"version": ">= 2.1.0"
	"build": {
		"development": {
			"distribution": "internal",
			"android": {
				"gradleCommand": ":app:assembleDebug"
			"ios": {
				"buildConfiguration": "Debug"
		"preview": {
			"distribution": "internal"
		"production": {}
	"submit": {
		"production": {}

Now the development build has been set up in your Expo project, and you can run the app outside Expo Go. To verify that the setup runs correctly, launch your app locally on an Android emulator that doesn’t have the Expo Go client installed:

npx expo run:android

When launching the app for the first time, you’ll need to confirm the application ID in the command-line prompt by pressing Enter on Windows or Command on macOS. Wait for the installation to complete, and you’ll see the app launched on the emulator. To run the app on iOS, you’ll find details in the Expo documentation.

Now that your project is set with native modules, you’ll add the PSPDFKit for React Native package.

Adding PSPDFKit for React Native

Install PSPDFKit for React Native from the official public GitHub repository:

npm install github:PSPDFKit/react-native

Alternatively, you can use this:

yarn add github:PSPDFKit/react-native

A few more platform-specific setups are needed for the PSPDFKit native modules on Android and iOS.


For Android, open android/build.gradle and add the following lines:

allprojects {
repositories {
+ maven {
+ url ''
+ }

Set the compileSDKVersion to 32 and the minSdkVersion to 21.


For iOS, open the Podfile in your iOS module and set the target SDK to iOS 14:

platform :ios, '14.0'

Add the PSPDFKit dependency to the iOS project by adding the following line to the Podfile under the target section:

+ pod 'PSPDFKit', podspec: ''

Navigate to <project>/ios and install the iOS dependencies with the following:

pod install

For a detailed setup, including information on setting the license, please refer to the getting started guides for PSPDFKit for React Native.

Opening a PDF

Now, you’ll open a PDF. To prepare the PDF, add a test PDF file to your Android’s android/app/src/main/assets folder. This folder usually doesn’t exist, so if it doesn’t, you’ll need to create it first.

Next, to load the PDF, replace the entire contents in App.js with the following code snippet:

import React, { Component } from 'react';
import { Platform } from 'react-native';
import PSPDFKitView from 'react-native-pspdfkit';

const DOCUMENT =

export default class PSPDFKitDemo extends Component<{}> {
	render() {
		return (
					showThumbnailBar: 'scrollable',
					pageTransition: 'scrollContinuous',
					scrollDirection: 'vertical',
				style={{ flex: 1 }}

Now you can run your app using npx expo run:android, and the PDF will be loaded from the path you provided.


PSPDFKit won’t work when you run the project using expo start because the Expo Go app will be used and the PSPDFKit package native modules won’t be accessible.


This post showed how to integrate the PSPDFKit for React Native library into an Expo project using a development build. For detailed documentation of PSPDFKit for React Native, check out the official PSPDFKit for React Native guides.

Related Products
PSPDFKit for React Native

Product Page
Example Projects

Share Post
Free 60-Day Trial Try PSPDFKit in your app today.
Free Trial

Related Articles

Explore more
CUSTOMER STORIES  |  Case Study • React Native • iOS • Android

Case Study: How Trinoor Uses PSPDFKit to Drive Operational Excellence with Flexible, Mobile Applications for the Energy and Utilities Market

PRODUCTS  |  React Native • Releases

PSPDFKit 2.7 for React Native Adds Annotation Preset Customization

CUSTOMER STORIES  |  Case Study • React Native • PDF Viewer

HIPAA Compliance without Compromise: Northwoods’ Journey to Modern PDF Experiences