Skip to content

Commit

Permalink
feat: Close camera after recognizing QR code
Browse files Browse the repository at this point in the history
After recognizing a QR code, the camera is now closed to improve the user experience. If the QR code is a test code for Pushy, the camera is closed and no further scanning is performed. For other business logic, the scanning process continues.

Co-authored-by: dependabot[bot] <[email protected]>
  • Loading branch information
sunnylqm and dependabot[bot] committed Jul 29, 2024
1 parent 2f5b28d commit 1f188a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions site/pages/docs/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,11 @@ interface PushyContext {
```js
<Camera
onReadCode={({ nativeEvent: { codeStringValue } }) => {
// 识别到二维码后先关闭相机
setShowCamera(false);
// 先解析是否是pushy的测试二维码
if (parseTestQrCode(codeStringValue)) {
// 如果是pushy的测试二维码,则不再继续扫描
setShowCamera(false);
// 如果是pushy的测试二维码,则不再做其他业务扫码逻辑
return;
}
// 如果不是,继续处理其他业务扫码逻辑
Expand Down

0 comments on commit 1f188a6

Please sign in to comment.