Skip to content

Commit 2a254c9

Browse files
authored
fix(ios): add button to start QR code scanner (#1125)
1 parent b08171c commit 2a254c9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ios/ReactTestApp/ContentView.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ final class ContentViewController: UITableViewController {
6060

6161
title = manifest.displayName
6262

63+
navigationItem.rightBarButtonItem = UIBarButtonItem(
64+
image: UIImage(systemName: "qrcode.viewfinder"),
65+
style: .plain,
66+
target: self,
67+
action: #selector(scanForQRCode)
68+
)
69+
6370
let components = manifest.components ?? []
6471
if components.isEmpty {
6572
NotificationCenter.default.addObserver(
@@ -113,7 +120,7 @@ final class ContentViewController: UITableViewController {
113120

114121
NotificationCenter.default.addObserver(
115122
self,
116-
selector: #selector(scanForQRCode(_:)),
123+
selector: #selector(scanForQRCode),
117124
name: ReactInstance.scanForQRCodeNotification,
118125
object: nil
119126
)
@@ -255,7 +262,7 @@ final class ContentViewController: UITableViewController {
255262

256263
extension ContentViewController {
257264
@objc
258-
private func scanForQRCode(_: Notification) {
265+
private func scanForQRCode() {
259266
switch AVCaptureDevice.authorizationStatus(for: .video) {
260267
case .notDetermined:
261268
AVCaptureDevice.requestAccess(for: .video) { [weak self] granted in

0 commit comments

Comments
 (0)