mirror of
https://github.com/status-im/react-native-image-crop-picker.git
synced 2025-02-23 10:58:16 +00:00
Merge pull request #289 from ollija/master
(android) Add 'hideBottomControls' & 'enableRotationGesture' -options
This commit is contained in:
commit
34d80f2327
@ -92,6 +92,8 @@ ImagePicker.clean().then(() => {
|
||||
| mediaType | string (default any) | Accepted mediaType for image selection, can be one of: 'photo', 'video', or 'any' |
|
||||
| showsSelectedCount (ios only) | bool (default true) | Whether to show the number of selected assets |
|
||||
| showCropGuidelines (android only) | bool (default true) | Whether to show the 3x3 grid on top of the image during cropping |
|
||||
| hideBottomControls (android only) | bool (default false) | Whether to display bottom controls |
|
||||
| enableRotationGesture (android only) | bool (default false) | Whether to enable rotating the image by hand gesture |
|
||||
#### Response Object
|
||||
|
||||
| Property | Type | Description |
|
||||
|
@ -31,6 +31,7 @@ import com.facebook.react.bridge.WritableNativeMap;
|
||||
import com.facebook.react.modules.core.PermissionAwareActivity;
|
||||
import com.facebook.react.modules.core.PermissionListener;
|
||||
import com.yalantis.ucrop.UCrop;
|
||||
import com.yalantis.ucrop.UCropActivity;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@ -68,6 +69,8 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
|
||||
private boolean cropping = false;
|
||||
private boolean cropperCircleOverlay = false;
|
||||
private boolean showCropGuidelines = true;
|
||||
private boolean hideBottomControls = false;
|
||||
private boolean enableRotationGesture = false;
|
||||
private ReadableMap options;
|
||||
|
||||
|
||||
@ -112,6 +115,8 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
|
||||
cropperTintColor = options.hasKey("cropperTintColor") ? options.getString("cropperTintColor") : cropperTintColor;
|
||||
cropperCircleOverlay = options.hasKey("cropperCircleOverlay") ? options.getBoolean("cropperCircleOverlay") : cropperCircleOverlay;
|
||||
showCropGuidelines = options.hasKey("showCropGuidelines") ? options.getBoolean("showCropGuidelines") : showCropGuidelines;
|
||||
hideBottomControls = options.hasKey("hideBottomControls") ? options.getBoolean("hideBottomControls") : hideBottomControls;
|
||||
enableRotationGesture = options.hasKey("enableRotationGesture") ? options.getBoolean("enableRotationGesture") : enableRotationGesture;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@ -554,6 +559,15 @@ class PickerModule extends ReactContextBaseJavaModule implements ActivityEventLi
|
||||
options.setCompressionQuality(100);
|
||||
options.setCircleDimmedLayer(cropperCircleOverlay);
|
||||
options.setShowCropGrid(showCropGuidelines);
|
||||
options.setHideBottomControls(hideBottomControls);
|
||||
if (enableRotationGesture) {
|
||||
// UCropActivity.ALL = enable both rotation & scaling
|
||||
options.setAllowedGestures(
|
||||
UCropActivity.ALL, // When 'scale'-tab active
|
||||
UCropActivity.ALL, // When 'rotate'-tab active
|
||||
UCropActivity.ALL // When 'aspect ratio'-tab active
|
||||
);
|
||||
}
|
||||
configureCropperColors(options);
|
||||
|
||||
UCrop.of(uri, Uri.fromFile(new File(this.getTmpDir(activity), UUID.randomUUID().toString() + ".jpg")))
|
||||
|
Loading…
x
Reference in New Issue
Block a user