@sdcx/image-crop 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,7 @@ pod install
14
14
 
15
15
  ```
16
16
  <ImageCropView
17
+ ref={imageCropViewRef}
17
18
  style={'your style'}
18
19
  fileUri={'your file uri'}
19
20
  cropStyle={'circular' | 'default'}
@@ -33,3 +34,8 @@ objectRect的四个属性分别是(单位都是像素px):
33
34
  3. width: 裁剪区域的宽度;
34
35
  4. height: 裁剪区域的高度;
35
36
 
37
+ #### 裁剪
38
+ ```
39
+ imageCropViewRef.crop()
40
+ ```
41
+ 然后裁剪成功后会在onCropped属性中回调裁剪后图片的uri;
@@ -62,6 +62,7 @@ public class RNImageCropView extends FrameLayout {
62
62
  mGestureCropImageView.setImageUri(Uri.parse(fileUri), mOutputUri);
63
63
  } catch (Exception e) {
64
64
  FLog.i(TAG, "设置初始图片失败:" + e.getMessage());
65
+ return;
65
66
  }
66
67
 
67
68
  try {
@@ -8,8 +8,8 @@ interface SupperProps extends ViewProps {
8
8
  cropStyle?: 'circular' | 'default';
9
9
  }
10
10
  interface CropViewProps extends SupperProps {
11
+ style?: ViewStyle;
11
12
  onCropped: (uri: string) => void;
12
- style: ViewStyle;
13
13
  }
14
14
  declare const ImageCropView: React.ForwardRefExoticComponent<CropViewProps & React.RefAttributes<ImageCropViewRef>>;
15
15
  export default ImageCropView;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sdcx/image-crop",
3
3
  "description": "A React Native ui component for image crop.",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",
@@ -16,8 +16,8 @@ interface CropViewNativeComponentProps extends SupperProps {
16
16
  }
17
17
 
18
18
  interface CropViewProps extends SupperProps {
19
+ style?: ViewStyle
19
20
  onCropped: (uri: string) => void
20
- style: ViewStyle
21
21
  }
22
22
 
23
23
  const ImageCropView = forwardRef<ImageCropViewRef, CropViewProps>(