Installation
There are two ways to consume the document picker package:
Premium Version
This version offers many improvements over the public version. Full list of changes is here. To mention a few:
✅ New: saveDocuments
function
✅ New: isKnownType
utility
✅ New: open
mode support for both platforms
✅ New: long-term file access permissions on both platforms
✅ New: keepLocalCopy
function that separates picking a file and copying it to a local directory, which makes your app more responsive.
... and more
Your support enables continued maintenance and development of the module. Thank you! ❤️
Public Version
Available on the public npm registry, this version does not include the new features, updates and improvements found in the premium version.
Accessing the premium version
Access is provided via GitHub Sponsors: upon sponsoring you will get access to the private packages and to the private monorepo with the sources and examples (please use specifically the tiers that mention this package!).
Three steps are needed to access the premium packages, which are hosted on GitHub npm packages registry.
-
Become a sponsor and accept private repository invitation - it takes just a few clicks.
-
Obtain here a Personal Access Token with
packages:read
permission. -
Set up your package manager so that it fetches the packages from the GH packages registry. In this example, we're using an
NPM_TOKEN
environment variable.
- npm / yarn v1
- yarn v3+
create a .npmrc
file in your project root with the following content:
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@react-native-documents:registry=https://npm.pkg.github.com/
create a .yarnrc.yml
file in your project root with the following content:
npmScopes:
react-native-documents:
npmRegistryServer: https://npm.pkg.github.com
npmAuthToken: '${NPM_TOKEN}'
If you use another package manager (such as bun), please refer to its documentation on how to set up a custom registry.
Installing
- For sponsors
- Public package
yarn add @react-native-documents/picker
yarn add @react-native-documents/viewer
The viewer
package is not available in the public version.
yarn add react-native-document-picker
Setting up
The premium document picker package requires iOS 14 or later. If you use Expo, use Expo build properties to update the deploymentTarget
to 14
.
In regular React Native projects, update the settings in Xcode.
Expo
This package cannot be used in "Expo Go" because it requires custom native code.
However, you can add custom native code to Expo through a development build. That is the approach taken below.
# install the package first
# Build the app locally
expo prebuild --clean
expo run:ios
expo run:android
React Native
Install the package and then run pod install
from the ios directory. Then rebuild your project with Xcode.
The packages support last 3 stable releases of RN, but very likely work with RN 0.73 an up.
If you're using the New Architecture, it's strongly recommended to use the latest stable release.