Installation
There are two ways to consume the document picker package:
Sponsor-Only Version
Available only to GitHub sponsors, this version offers a ton of improvements over the public version. Full list of changes is here. To mention a few:
✅ 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 much more
Your sponsorship enables continued maintenance and development of the module. Thank you for supporting this project! ❤️
Public Version
Available on the public npm registry, this version does not include the new features, updates and bugfixes found in the sponsor-only version.
Accessing the private packages for sponsors
Upon sponsoring (please use specifically the tiers that mention this project!), you will get immediate access * to the private packages and to the private monorepo with the sources and examples.
Three steps are needed to access the sponsored 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 sponsor-only 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 the "Expo Go" app because it requires custom native code. However, you can add custom native code to Expo by following the commands below.
Read Expo's "Adding custom native code" guide for detailed information.
# install the package first
# Build the app locally
expo prebuild --clean
expo run:ios
expo run:android
# Or create a development build (provided you have expo-dev-client installed and set up)
eas build
React Native
Install the package and then run pod install
from the ios directory. Then rebuild your project with Xcode.
The packages were tested with RN 0.73 but they most likely support older RN versions as well, all the way to 0.60.
If you're using the New Architecture, you need to be on React Native 0.72 or higher.
Invitation Note
As a sponsor, you will be added automatically if you sponsor from a personal account. If you sponsor from an organization account, please let me know and I'll invite you manually. This is because of how GitHub handles this case.