For RN < 0.60, you need to link the dependency using react-native link:
react-native link react-native-document-pickerThen run pod install from the ios directory and rebuild your project.
Manually Link Native Modules
- Run
npm install react-native-document-picker --save - Open your project in XCode, right click on
Librariesand clickAdd Files to "Your Project Name"(Screenshot) then (Screenshot). - Add
libRNDocumentPicker.atoBuild 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.