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.
This commit is contained in:
parent
51ed43f511
commit
407ffdf837
|
@ -115,23 +115,23 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue