
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-native-document-picker-fx
Advanced tools
A react native interface to access Documents from dropbox google drive, iCloud
A React Native wrapper for:
UIDocumentMenuViewControllerIntent.ACTION_OPEN_DOCUMENT / Intent.ACTION_PICKWindows.Storage.Pickersnpm i --save react-native-document-picker
Automatically Link Native Modules
Link native packages via the following command:
react-native link
Manually Link Native Modules
npm install react-native-document-picker --saveLibraries and click Add Files to "Your Project Name" (Screenshot) then (Screenshot).libRNDocumentPicker.a to Build Phases -> Link Binary With Libraries
(Screenshot).CocoaPods
Add the following to your podfile:
pod 'react-native-document-picker', :path => '../node_modules/react-native-document-picker`
// file: android/settings.gradle
...
include ':react-native-document-picker'
project(':react-native-document-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-document-picker/android')
// file: android/app/build.gradle
...
dependencies {
...
compile project(':react-native-document-picker')
}
// file: MainApplication.java
...
import io.github.elyx0.reactnativedocumentpicker.DocumentPickerPackage; // Import package
public class MainApplication extends Application implements ReactApplication {
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new DocumentPickerPackage() // Add package
);
}
...
}
Follow the instructions in the 'Linking Libraries' documentation on the react-native-windows GitHub repo. For the first step of adding the project to the Visual Studio solution file, the path to the project should be ../node_modules/react-native-document-picker/windows/RNDocumentPicker/RNDocumentPicker.csproj.
DocumentPicker.pick(opts) and DocumentPicker.pickMultiple(opts)Use pick or pickMultiple to open a document picker for the user to select file(s). Both methods return a Promise. pick will only allow a single selection and the Promise will resolve to that single result. pickMultiple will allow multiple selection and the Promise returned will always resolve to an array of results.
Options:
type:string|Array<string>: The type or types of documents to allow selection of. May be an array of types as single type string.
text/plain or partial MIME types such as image/*.type is omitted it will be treated as */* or public.content.*/* if you provide an array with more than one value.Result:
The object a pick Promise resolves to or the objects in the array a pickMultiple Promise resolves to will contain the following keys.
uri: The URI representing the document picked by the user. On iOS this will be a file:// URI for a temporary file in your app's container. On Android this will be a content:// URI for a document provided by a DocumentProvider that must be accessed with a ContentResolver.type: The MIME type of the file. On Android some DocumentProviders may not provide MIME types for their documents. On iOS this MIME type is based on the best MIME type for the file extension according to Apple's internal "Uniform Type Identifiers" database.name: The display name of the file. This is normally the filename of the file, but Android does not guarantee that this will be a filename from all DocumentProviders.size: The file size of the document. On Android some DocumentProviders may not provide this information for a document.DocumentPicker.types.*DocumentPicker.types.* provides a few common types for use as type values, these types will use the correct format for each platform (MIME types on Android, UTIs on iOS).
DocumentPicker.types.allFiles: All document types, on Android this is */*, on iOS is is public.content (note that some binary and archive types do not inherit from public.content)DocumentPicker.types.images: All image types (image/* or public.image)DocumentPicker.types.plainText: Plain text files ie: .txt (text/plain or public.plain-text)DocumentPicker.types.audio: All audio types (audio/* or public.audio)DocumentPicker.types.pdf: PDF documents (application/pdf or com.adobe.pdf)DocumentPicker.isCancel(err)If the user cancels the document picker without choosing a file (by pressing the system back button on Android or the Cancel button on iOS) the Promise will be rejected with a cancellation error. You can check for this error using DocumentPicker.isCancel(err) allowing you to ignore it and cleanup any parts of your interface that may not be needed anymore.
import DocumentPicker from 'react-native-document-picker';
// Pick a single file
try {
const res = await DocumentPicker.pick({
type: [DocumentPicker.types.images],
});
console.log(
res.uri,
res.type, // mime type
res.name,
res.size
);
} catch ( err ) {
if ( DocumentPicker.isCancel(err) ) {
// User cancelled the picker, exit any dialogs or menus and move on
} else {
throw err;
}
}
// Pick multiple files
try {
const results = await DocumentPicker.pickMultiple({
type: [DocumentPicker.types.images],
});
for ( const res of results ) {
console.log(
res.uri,
res.type, // mime type
res.name,
res.size
);
}
} catch ( err ) {
if ( DocumentPicker.isCancel(err) ) {
// User cancelled the picker, exit any dialogs or menus and move on
} else {
throw err;
}
}

I recommend using https://github.com/johanneslumpe/react-native-fs
I had to modify Uploader.m so it would use NSFileCoordinator with NSFileCoordinatorReadingForUploading option.
I added a check for file length that would be thrown into RNFS catch block.
if ([fileData length] == 0) {
NSError *errorUp = [NSError errorWithDomain:@"com.whatever.yourapp" code:77 userInfo:[NSDictionary dictionaryWithObject:@"empty" forKey:NSLocalizedDescriptionKey]];
_params.errorCallback(errorUp);
return;
}
let url = "file://whatever/com.bla.bla/file.ext"; //The url you received from the DocumentPicker
// I STRONGLY RECOMMEND ADDING A SMALL SETTIMEOUT before uploading the url you just got.
const split = url.split('/');
const name = split.pop();
const inbox = split.pop();
const realPath = `${RNFS.TemporaryDirectoryPath}${inbox}/${name}`;
const uploadBegin = (response) => {
const jobId = response.jobId;
console.log('UPLOAD HAS BEGUN! JobId: ' + jobId);
};
const uploadProgress = (response) => {
const percentage = Math.floor((response.totalBytesSent/response.totalBytesExpectedToSend) * 100);
console.log('UPLOAD IS ' + percentage + '% DONE!');
};
RNFS.uploadFiles({
toUrl: uploadUrl,
files: [{
name,
filename:name,
filepath: realPath,
}],
method: 'POST',
headers: {
'Accept': 'application/json',
},
begin: uploadBegin,
beginCallback: uploadBegin, // Don't ask me, only way I made it work as of 1.5.1
progressCallback: uploadProgress,
progress: uploadProgress
})
.then((response) => {
console.log(response,"<<< Response");
if (response.statusCode == 200) { //You might not be getting a statusCode at all. Check
console.log('FILES UPLOADED!');
} else {
console.log('SERVER ERROR');
}
})
.catch((err) => {
if (err.description) {
switch (err.description) {
case "cancelled":
console.log("Upload cancelled");
break;
case "empty"
console.log("Empty file");
default:
//Unknown
}
} else {
//Weird
}
console.log(err);
});
You need to enable iCloud Documents to access iCloud

FAQs
A react native interface to access Documents from dropbox google drive, iCloud
We found that react-native-document-picker-fx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.