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
2f476c2d
Commit
2f476c2d
authored
Jul 09, 2019
by
Koppel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix-bug: 补充Android遗漏的asyncOpenCamera方法
parent
1add21ce
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
README.md
README.md
+21
-1
RNSyanImagePickerModule.java
...src/main/java/com/syanpicker/RNSyanImagePickerModule.java
+8
-0
index.js
index.js
+8
-0
No files found.
README.md
View file @
2f476c2d
...
...
@@ -284,7 +284,27 @@ STImagePicke.removeAllPhoto()
```
### 调用相机
相机功能调用 `openCamera` 方法,一样支持 Callback 和 Promise 两种形式,结果参数也保持一致。
相机功能调用方法,一样支持 Callback 和 Promise 两种形式,结果参数也保持一致。
```
javascript
//Callback方式
SyanImagePicker.openCamera(options, (err, photos) => {
if (err) {
// 取消选择
return;
}
// 选择成功,渲染图片
// ...
})
//Promise方式
SYImagePicker.asyncOpenCamera(options)
.then(()=>{
...
})
.catch(()=>{
...
})
```
### 删除缓存
```
javascript
...
...
android/src/main/java/com/syanpicker/RNSyanImagePickerModule.java
View file @
2f476c2d
...
...
@@ -84,6 +84,14 @@ public class RNSyanImagePickerModule extends ReactContextBaseJavaModule {
this
.
openCamera
();
}
@ReactMethod
public
void
asyncOpenCamera
(
ReadableMap
options
,
Promise
promise
)
{
this
.
cameraOptions
=
options
;
this
.
mPickerCallback
=
null
;
this
.
mPickerPromise
=
promise
;
this
.
openCamera
();
}
/**
* 缓存清除
* 包括裁剪和压缩后的缓存,要在上传成功后调用,注意:需要系统sd卡权限
...
...
index.js
View file @
2f476c2d
...
...
@@ -104,6 +104,14 @@ export default {
RNSyanImagePicker
.
openCamera
(
optionObj
,
callback
)
},
asyncOpenCamera
(
options
)
{
const
optionObj
=
{
...
defaultOptions
,
...
options
,
};
return
RNSyanImagePicker
.
asyncOpenCamera
(
optionObj
);
},
/**
* 清除缓存
*/
...
...
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