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
f56ae641
Commit
f56ae641
authored
Nov 25, 2017
by
Syan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.0.6 添加iOS圆形裁剪设置半径参数
parent
ec3e24d4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
23 deletions
+27
-23
README.md
README.md
+10
-9
index.js
index.js
+10
-9
RNSyanImagePicker.m
ios/RNSyanImagePicker.m
+6
-4
package.json
package.json
+1
-1
No files found.
README.md
View file @
f56ae641
...
@@ -85,15 +85,16 @@ import ImagePicker from 'react-native-syan-image-picker'
...
@@ -85,15 +85,16 @@ import ImagePicker from 'react-native-syan-image-picker'
*
默认参数
*
默认参数
*
/
*
/
const options = {
const options = {
imageCount: 6, // 最大选择图片数目,默认6
imageCount: 6, // 最大选择图片数目,默认6
isCamera: true, // 是否允许用户在内部拍照,默认true
isCamera: true, // 是否允许用户在内部拍照,默认true
isCrop: false, // 是否允许裁剪,默认false
isCrop: false, // 是否允许裁剪,默认false
CropW: ~~(width
*
0.6), // 裁剪宽度,默认屏幕宽度60%
CropW: ~~(width
*
0.6), // 裁剪宽度,默认屏幕宽度60%
CropH: ~~(width
*
0.6), // 裁剪高度,默认屏幕宽度60%
CropH: ~~(width
*
0.6), // 裁剪高度,默认屏幕宽度60%
isGif: false, // 是否允许选择GIF,默认false,暂无回调GIF数据
isGif: false, // 是否允许选择GIF,默认false,暂无回调GIF数据
showCropCircle: false, // 是否显示圆形裁剪区域,默认false
showCropCircle: false, // 是否显示圆形裁剪区域,默认false
showCropFrame: true, // 是否显示裁剪区域,默认true
circleCropRadius: width/2 // 圆形裁剪半径,默认屏幕宽度一半
showCropGrid: false // 是否隐藏裁剪区域网格,默认false
showCropFrame: true, // 是否显示裁剪区域,默认true
showCropGrid: false // 是否隐藏裁剪区域网格,默认false
};
};
/
**
/
**
...
...
index.js
View file @
f56ae641
...
@@ -10,15 +10,16 @@ const { width } = Dimensions.get('window');
...
@@ -10,15 +10,16 @@ const { width } = Dimensions.get('window');
* 默认参数
* 默认参数
*/
*/
const
defaultOptions
=
{
const
defaultOptions
=
{
imageCount
:
6
,
// 最大选择图片数目,默认6
imageCount
:
6
,
// 最大选择图片数目,默认6
isCamera
:
true
,
// 是否允许用户在内部拍照,默认true
isCamera
:
true
,
// 是否允许用户在内部拍照,默认true
isCrop
:
false
,
// 是否允许裁剪,默认false
isCrop
:
false
,
// 是否允许裁剪,默认false, imageCount 为1才生效
CropW
:
~~
(
width
*
0.6
),
// 裁剪宽度,默认屏幕宽度60%
CropW
:
~~
(
width
*
0.6
),
// 裁剪宽度,默认屏幕宽度60%
CropH
:
~~
(
width
*
0.6
),
// 裁剪高度,默认屏幕宽度60%
CropH
:
~~
(
width
*
0.6
),
// 裁剪高度,默认屏幕宽度60%
isGif
:
false
,
// 是否允许选择GIF,默认false,暂无回调GIF数据
isGif
:
false
,
// 是否允许选择GIF,默认false,暂无回调GIF数据
showCropCircle
:
false
,
// 是否显示圆形裁剪区域,默认false
showCropCircle
:
false
,
// 是否显示圆形裁剪区域,默认false
showCropFrame
:
true
,
// 是否显示裁剪区域,默认true
circleCropRadius
:
width
/
2
,
// 圆形裁剪半径,默认屏幕宽度一半
showCropGrid
:
false
// 是否隐藏裁剪区域网格,默认false
showCropFrame
:
true
,
// 是否显示裁剪区域,默认true
showCropGrid
:
false
// 是否隐藏裁剪区域网格,默认false
};
};
export
default
{
export
default
{
...
...
ios/RNSyanImagePicker.m
View file @
f56ae641
...
@@ -50,24 +50,26 @@ RCT_REMAP_METHOD(asyncShowImagePicker,
...
@@ -50,24 +50,26 @@ RCT_REMAP_METHOD(asyncShowImagePicker,
BOOL
showCropCircle
=
[
options
sy_boolForKey
:
@"showCropCircle"
];
BOOL
showCropCircle
=
[
options
sy_boolForKey
:
@"showCropCircle"
];
NSInteger
CropW
=
[
options
sy_integerForKey
:
@"CropW"
];
NSInteger
CropW
=
[
options
sy_integerForKey
:
@"CropW"
];
NSInteger
CropH
=
[
options
sy_integerForKey
:
@"CropH"
];
NSInteger
CropH
=
[
options
sy_integerForKey
:
@"CropH"
];
NSInteger
circleCropRadius
=
[
options
sy_integerForKey
:
@"circleCropRadius"
];
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
imageCount
delegate
:
nil
];
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
imageCount
delegate
:
nil
];
imagePickerVc
.
maxImagesCount
=
imageCount
;
imagePickerVc
.
maxImagesCount
=
imageCount
;
imagePickerVc
.
allowPickingGif
=
isGif
;
// 允许GIF
imagePickerVc
.
allowPickingGif
=
isGif
;
// 允许GIF
imagePickerVc
.
allowTakePicture
=
isCamera
;
// 允许用户在内部拍照
imagePickerVc
.
allowTakePicture
=
isCamera
;
// 允许用户在内部拍照
imagePickerVc
.
allowPickingVideo
=
NO
;
// 不允许视频
imagePickerVc
.
allowPickingVideo
=
NO
;
// 不允许视频
imagePickerVc
.
allowPickingOriginalPhoto
=
NO
;
// 允许原图
imagePickerVc
.
allowPickingOriginalPhoto
=
NO
;
// 允许原图
imagePickerVc
.
allowCrop
=
isCrop
;
// 裁剪
imagePickerVc
.
allowCrop
=
isCrop
;
// 裁剪
if
(
imageCount
==
1
)
{
if
(
imageCount
==
1
)
{
// 单选模式
// 单选模式
imagePickerVc
.
showSelectBtn
=
NO
;
imagePickerVc
.
showSelectBtn
=
NO
;
imagePickerVc
.
allowPreview
=
NO
;
imagePickerVc
.
allowPreview
=
NO
;
if
(
isCrop
){
if
(
isCrop
){
if
(
showCropCircle
)
{
if
(
showCropCircle
)
{
imagePickerVc
.
needCircleCrop
=
showCropCircle
;
//圆形裁剪
imagePickerVc
.
needCircleCrop
=
showCropCircle
;
//圆形裁剪
imagePickerVc
.
circleCropRadius
=
circleCropRadius
;
//圆形半径
}
else
{
}
else
{
CGFloat
x
=
([[
UIScreen
mainScreen
]
bounds
].
size
.
width
-
CropW
)
/
2
;
CGFloat
x
=
([[
UIScreen
mainScreen
]
bounds
].
size
.
width
-
CropW
)
/
2
;
CGFloat
y
=
([[
UIScreen
mainScreen
]
bounds
].
size
.
height
-
CropH
)
/
2
;
CGFloat
y
=
([[
UIScreen
mainScreen
]
bounds
].
size
.
height
-
CropH
)
/
2
;
...
...
package.json
View file @
f56ae641
{
{
"name"
:
"react-native-syan-image-picker"
,
"name"
:
"react-native-syan-image-picker"
,
"version"
:
"0.0.
5
"
,
"version"
:
"0.0.
6
"
,
"description"
:
""
,
"description"
:
""
,
"main"
:
"index.js"
,
"main"
:
"index.js"
,
"scripts"
:
{
"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