From 9acb38ed63e4170d8b25cbc01f28f6e37c853f4d Mon Sep 17 00:00:00 2001 From: bartoszwolski Date: Thu, 25 Oct 2018 11:23:24 +0200 Subject: [PATCH] Update PickerModule.java (#862) Fix for default values being kept when calling cropPicker from multiple locations. Now default values if not passed will be reverted to default. --- .../ivpusic/imagepicker/PickerModule.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java b/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java index 420ac38ef..48e9e36db 100644 --- a/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java +++ b/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java @@ -115,23 +115,23 @@ public String getName() { } private void setConfiguration(final ReadableMap options) { - mediaType = options.hasKey("mediaType") ? options.getString("mediaType") : mediaType; - multiple = options.hasKey("multiple") && options.getBoolean("multiple"); - includeBase64 = options.hasKey("includeBase64") && options.getBoolean("includeBase64"); - includeExif = options.hasKey("includeExif") && options.getBoolean("includeExif"); - width = options.hasKey("width") ? options.getInt("width") : width; - height = options.hasKey("height") ? options.getInt("height") : height; - cropping = options.hasKey("cropping") ? options.getBoolean("cropping") : cropping; - cropperActiveWidgetColor = options.hasKey("cropperActiveWidgetColor") ? options.getString("cropperActiveWidgetColor") : cropperActiveWidgetColor; - cropperStatusBarColor = options.hasKey("cropperStatusBarColor") ? options.getString("cropperStatusBarColor") : cropperStatusBarColor; - cropperToolbarColor = options.hasKey("cropperToolbarColor") ? options.getString("cropperToolbarColor") : cropperToolbarColor; + mediaType = options.hasKey("mediaType") ? options.getString("mediaType") : "any"; + multiple = options.hasKey("multiple") ? options.getBoolean("multiple") : false; + includeBase64 = options.hasKey("includeBase64") ? options.getBoolean("includeBase64") : false; + includeExif = options.hasKey("includeExif") ? options.getBoolean("includeExif") : false; + width = options.hasKey("width") ? options.getInt("width") : 200; + height = options.hasKey("height") ? options.getInt("height") : 200; + cropping = options.hasKey("cropping") ? options.getBoolean("cropping") : false; + cropperActiveWidgetColor = options.hasKey("cropperActiveWidgetColor") ? options.getString("cropperActiveWidgetColor") : DEFAULT_TINT; + cropperStatusBarColor = options.hasKey("cropperStatusBarColor") ? options.getString("cropperStatusBarColor") : DEFAULT_TINT; + cropperToolbarColor = options.hasKey("cropperToolbarColor") ? options.getString("cropperToolbarColor") : DEFAULT_TINT; cropperToolbarTitle = options.hasKey("cropperToolbarTitle") ? options.getString("cropperToolbarTitle") : null; - cropperCircleOverlay = options.hasKey("cropperCircleOverlay") ? options.getBoolean("cropperCircleOverlay") : cropperCircleOverlay; - freeStyleCropEnabled = options.hasKey("freeStyleCropEnabled") ? options.getBoolean("freeStyleCropEnabled") : freeStyleCropEnabled; - showCropGuidelines = options.hasKey("showCropGuidelines") ? options.getBoolean("showCropGuidelines") : showCropGuidelines; - hideBottomControls = options.hasKey("hideBottomControls") ? options.getBoolean("hideBottomControls") : hideBottomControls; - enableRotationGesture = options.hasKey("enableRotationGesture") ? options.getBoolean("enableRotationGesture") : enableRotationGesture; - disableCropperColorSetters = options.hasKey("disableCropperColorSetters") ? options.getBoolean("disableCropperColorSetters") : disableCropperColorSetters; + cropperCircleOverlay = options.hasKey("cropperCircleOverlay") ? options.getBoolean("cropperCircleOverlay") : false; + freeStyleCropEnabled = options.hasKey("freeStyleCropEnabled") ? options.getBoolean("freeStyleCropEnabled") : false; + showCropGuidelines = options.hasKey("showCropGuidelines") ? options.getBoolean("showCropGuidelines") : true; + hideBottomControls = options.hasKey("hideBottomControls") ? options.getBoolean("hideBottomControls") : false; + enableRotationGesture = options.hasKey("enableRotationGesture") ? options.getBoolean("enableRotationGesture") : false; + disableCropperColorSetters = options.hasKey("disableCropperColorSetters") ? options.getBoolean("disableCropperColorSetters") : false; this.options = options; }