Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
react-native-syan-image-picker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenSource
react-native-syan-image-picker
Commits
0265c1ae
Commit
0265c1ae
authored
Jul 14, 2019
by
Syan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.3.7
parent
d1ba0ba6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
7 deletions
+21
-7
README.md
README.md
+5
-0
RNSyanImagePickerModule.java
...src/main/java/com/syanpicker/RNSyanImagePickerModule.java
+12
-6
index.js
index.js
+3
-0
package.json
package.json
+1
-1
No files found.
README.md
View file @
0265c1ae
...
...
@@ -200,6 +200,11 @@ showCropGrid | bool | 是 | false | 是否隐藏裁剪区域网格
quality | int | 是 | 90 | 压缩质量(安卓无效,固定鲁班压缩)
minimumCompressSize | int | 是 | 100 | 小于100kb的图片不压缩(Android)
enableBase64 | bool | 是 | false | 是否返回base64编码,默认不返回
freeStyleCropEnabled | bool | 是 | false | 裁剪框是否可拖拽(Android)
rotateEnabled | bool | 是 | true | 裁剪是否可旋转图片(Android)
scaleEnabled | bool | 是 | true | 裁剪是否可放大缩小图片(Android)
## 返回结果说明
以 `Callback` 形式调用时,返回的第一个参数为错误对象,第二个才是图片数组:
...
...
android/src/main/java/com/syanpicker/RNSyanImagePickerModule.java
View file @
0265c1ae
...
...
@@ -154,6 +154,9 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
boolean
showCropFrame
=
this
.
cameraOptions
.
getBoolean
(
"showCropFrame"
);
boolean
showCropGrid
=
this
.
cameraOptions
.
getBoolean
(
"showCropGrid"
);
boolean
compress
=
this
.
cameraOptions
.
getBoolean
(
"compress"
);
boolean
freeStyleCropEnabled
=
this
.
cameraOptions
.
getBoolean
(
"freeStyleCropEnabled"
);
boolean
rotateEnabled
=
this
.
cameraOptions
.
getBoolean
(
"rotateEnabled"
);
boolean
scaleEnabled
=
this
.
cameraOptions
.
getBoolean
(
"scaleEnabled"
);
int
minimumCompressSize
=
this
.
cameraOptions
.
getInt
(
"minimumCompressSize"
);
int
quality
=
this
.
cameraOptions
.
getInt
(
"quality"
);
...
...
@@ -183,7 +186,7 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
.
withAspectRatio
(
CropW
,
CropH
)
// int 裁剪比例 如16:9 3:2 3:4 1:1 可自定义
.
hideBottomControls
(
isCrop
)
// 是否显示uCrop工具栏,默认不显示 true or false
.
isGif
(
isGif
)
// 是否显示gif图片 true or false
.
freeStyleCropEnabled
(
true
)
// 裁剪框是否可拖拽 true or false
.
freeStyleCropEnabled
(
freeStyleCropEnabled
)
// 裁剪框是否可拖拽 true or false
.
circleDimmedLayer
(
showCropCircle
)
// 是否圆形裁剪 true or false
.
showCropFrame
(
showCropFrame
)
// 是否显示裁剪矩形边框 圆形裁剪时建议设为false true or false
.
showCropGrid
(
showCropGrid
)
// 是否显示裁剪矩形网格 圆形裁剪时建议设为false true or false
...
...
@@ -191,8 +194,8 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
.
cropCompressQuality
(
quality
)
// 裁剪压缩质量 默认90 int
.
minimumCompressSize
(
minimumCompressSize
)
// 小于100kb的图片不压缩
.
synOrAsy
(
true
)
//同步true或异步false 压缩 默认同步
.
rotateEnabled
(
true
)
// 裁剪是否可旋转图片 true or false
.
scaleEnabled
(
true
)
// 裁剪是否可放大缩小图片 true or false
.
rotateEnabled
(
rotateEnabled
)
// 裁剪是否可旋转图片 true or false
.
scaleEnabled
(
scaleEnabled
)
// 裁剪是否可放大缩小图片 true or false
.
selectionMedia
(
selectList
)
// 当前已选中的图片 List
.
forResult
(
PictureConfig
.
CHOOSE_REQUEST
);
//结果回调onActivityResult code
}
...
...
@@ -208,6 +211,9 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
boolean
showCropFrame
=
this
.
cameraOptions
.
getBoolean
(
"showCropFrame"
);
boolean
showCropGrid
=
this
.
cameraOptions
.
getBoolean
(
"showCropGrid"
);
boolean
compress
=
this
.
cameraOptions
.
getBoolean
(
"compress"
);
boolean
freeStyleCropEnabled
=
this
.
cameraOptions
.
getBoolean
(
"freeStyleCropEnabled"
);
boolean
rotateEnabled
=
this
.
cameraOptions
.
getBoolean
(
"rotateEnabled"
);
boolean
scaleEnabled
=
this
.
cameraOptions
.
getBoolean
(
"scaleEnabled"
);
int
minimumCompressSize
=
this
.
cameraOptions
.
getInt
(
"minimumCompressSize"
);
int
quality
=
this
.
cameraOptions
.
getInt
(
"quality"
);
...
...
@@ -220,7 +226,7 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
.
glideOverride
(
160
,
160
)
// int glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
.
withAspectRatio
(
CropW
,
CropH
)
// int 裁剪比例 如16:9 3:2 3:4 1:1 可自定义
.
hideBottomControls
(
isCrop
)
// 是否显示uCrop工具栏,默认不显示 true or false
.
freeStyleCropEnabled
(
true
)
// 裁剪框是否可拖拽 true or false
.
freeStyleCropEnabled
(
freeStyleCropEnabled
)
// 裁剪框是否可拖拽 true or false
.
circleDimmedLayer
(
showCropCircle
)
// 是否圆形裁剪 true or false
.
showCropFrame
(
showCropFrame
)
// 是否显示裁剪矩形边框 圆形裁剪时建议设为false true or false
.
showCropGrid
(
showCropGrid
)
// 是否显示裁剪矩形网格 圆形裁剪时建议设为false true or false
...
...
@@ -228,8 +234,8 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
.
cropCompressQuality
(
quality
)
// 裁剪压缩质量 默认90 int
.
minimumCompressSize
(
minimumCompressSize
)
// 小于100kb的图片不压缩
.
synOrAsy
(
true
)
//同步true或异步false 压缩 默认同步
.
rotateEnabled
(
true
)
// 裁剪是否可旋转图片 true or false
.
scaleEnabled
(
true
)
// 裁剪是否可放大缩小图片 true or false
.
rotateEnabled
(
rotateEnabled
)
// 裁剪是否可旋转图片 true or false
.
scaleEnabled
(
scaleEnabled
)
// 裁剪是否可放大缩小图片 true or false
.
forResult
(
PictureConfig
.
CHOOSE_REQUEST
);
//结果回调onActivityResult code
}
...
...
index.js
View file @
0265c1ae
...
...
@@ -21,6 +21,9 @@ const defaultOptions = {
circleCropRadius
:
~~
(
width
/
4
),
// 圆形裁剪半径,默认屏幕宽度一半
showCropFrame
:
true
,
// 是否显示裁剪区域,默认true
showCropGrid
:
false
,
// 是否隐藏裁剪区域网格,默认false
freeStyleCropEnabled
:
false
,
// 裁剪框是否可拖拽
rotateEnabled
:
true
,
// 裁剪是否可旋转图片
scaleEnabled
:
true
,
// 裁剪是否可放大缩小图片
compress
:
true
,
minimumCompressSize
:
100
,
// 小于100kb的图片不压缩
quality
:
90
,
// 压缩质量
...
...
package.json
View file @
0265c1ae
{
"name"
:
"react-native-syan-image-picker"
,
"version"
:
"0.3.
6
"
,
"version"
:
"0.3.
7
"
,
"description"
:
"React-Native 多图片选择 支持裁剪 压缩"
,
"main"
:
"index.js"
,
"scripts"
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment