Skip to content

Commit

Permalink
ImagePicker: Change dependency of image-picker.
Browse files Browse the repository at this point in the history
This commit replaces react-native-image-picker in favor of
react-native-image-crop-picker.

It solves a few key issues like being able to -
1) Select multiple images
2) Being able to downsample image quality.  See issue zulip#2749
3) Being able to scale down images.
4) Being faster at processing images.

The removal of react-native-image-picker was done by:
1) Removing dependency from yarn
2) Running react-native unlink react-native-image-picker
3) Checking the initial commit and removing any code that may
not be covered by unlink. For reference the initial commit that
introduced changes was 515436a.

The addition of react-native-image-crop-picker is done by following the installation
instructions at
https://github.com/ivpusic/react-native-image-crop-picker/blob/07d321e3bc279b0ad218817245264cda6a7c77cb/README.md

This involved:
1) Adding the dependency via yarn
2) Running react-native link react-native-image-crop-picker
3) Adding the frameworks under embedded binaries as described by this comment
   ivpusic/react-native-image-crop-picker#61 (comment)
   and also under the "Manual" section of the PostInstall steps.

Note: We are ignoring a few of the PostInstall steps described in the Readme namely:

1) Changing the deployment target to 8.0 - We already have a higher target set.
2) The steps described in "To localizate the camera / gallery text buttons" -
   I dont believe this is required and the instructions seem vague.
3) Adding "useSupportLibrary" as described in a previous commit -
   This is required for cropping images and we don't have that feature enabled currently.
   When we enable that feature we will want to add this as well.

Note: We want to test this commit is working by archiving the project and uploading to
TestFlight.
  • Loading branch information
armaanahluwalia committed Dec 7, 2018
1 parent 03930f8 commit de7b69f
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 73 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ repositories {
dependencies {
implementation project(':react-native-text-input-reset')
implementation project(':react-native-notifications')
implementation project(':react-native-image-picker')
implementation project(':react-native-image-crop-picker')
implementation project(':react-native-orientation')
implementation project(':react-native-sentry')
implementation project(':@remobile_react-native-toast')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import com.facebook.react.ReactApplication;
import com.nikolaiwarner.RNTextInputReset.RNTextInputResetPackage;
import com.wix.reactnativenotifications.RNNotificationsPackage;
import com.imagepicker.ImagePickerPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.github.yamill.orientation.OrientationPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
Expand Down Expand Up @@ -53,7 +53,7 @@ protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNTextInputResetPackage(),
new ImagePickerPackage(),
new PickerPackage(),
new OrientationPackage(),
new RNSentryPackage(MainApplication.this),
new PhotoViewPackage(),
Expand Down
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ include ':react-native-text-input-reset'
project(':react-native-text-input-reset').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-text-input-reset/android')
include ':react-native-notifications'
project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-orientation'
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
include ':react-native-sentry'
Expand Down
Loading

0 comments on commit de7b69f

Please sign in to comment.