$ npm install react-native-multi-image-picker --save
$ react-native link react-native-multi-image-picker
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-multi-image-pickerand addRNMultiImagePicker.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNMultiImagePicker.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.siyukok.RNMultiImagePickerPackage;to the imports at the top of the file - Add
new RNMultiImagePickerPackage()to the list returned by thegetPackages()method
-
Append the following lines to
android/settings.gradle:include ':react-native-multi-image-picker' project(':react-native-multi-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-multi-image-picker/android') -
Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-multi-image-picker') -
Insert the following lines inside the repositories block in
android/build.gradle:maven { url "https://jitpack.io" } -
Create xml directory under
android/app/src/main/res/,and create filefile_paths_public.xml -
Insert the following lines inside the label in
android/app/src/main/AndroidManifest.xml:<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.sample.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths_public"></meta-data> </provider>
import RNMultiImagePicker from 'react-native-multi-image-picker';
RNMultiImagePicker.openPicker({
maxNum: 1,
cropping: true
});