react-native-image-crop-picker icon indicating copy to clipboard operation
react-native-image-crop-picker copied to clipboard

[android] 'enableRotationGesture' option for cropping doesn't work properly

Open Hesowcharov opened this issue 4 years ago • 1 comments

Version

  • react-native-image-crop-picker v0.37.2
  • react-native v0.64.1

Platform

  • Android

Expected behaviour

It should disable the rotation gesture but cropper anyways allows to do rotate in the 'crop' tab. It seems that UCrop has own the default options of allowed gestures if not set any: https://github.com/ivpusic/react-native-image-crop-picker/blob/2b95b88f0b45025cccea0d39be582ff4cf311d1e/android/src/main/java/com/reactnative/ivpusic/imagepicker/PickerModule.java#L673-L680

Actual behaviour

Perhaps it's expected that only the 'crop' tab wouldn't allow to rotate the image with the disabled option. In code it could be something like this:

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
            );
} else {
            // it seems UCrop has the default options of allowed gestures which allow all gestures in all tabs
            options.setAllowedGestures(
                    UCropActivity.SCALE,  // When 'scale'-tab active
                    UCropActivity.ROTATE, // When 'rotate'-tab active
                    UCropActivity.SCALE   // When 'aspect ratio'-tab active
            );
}

Love react-native-image-crop-picker? Please consider supporting our collective: 👉 https://opencollective.com/react-native-image-crop-picker/donate

Hesowcharov avatar Dec 08 '21 06:12 Hesowcharov

by adding hideBottomControls: true for some reason it disables rotation gesture

vladanzlatar avatar Mar 16 '25 13:03 vladanzlatar