Skip to content

Commit

Permalink
Merge pull request #410 from cultuurnet/bugfix/UIT-73-camera-fixes
Browse files Browse the repository at this point in the history
QR code detection fix
  • Loading branch information
chennara authored Mar 5, 2024
2 parents 70574c2 + 2a3d126 commit 2302c82
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/scan/camera/Camera.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const Camera = ({ navigation }: TProps) => {
codeTypes: ['qr'],
onCodeScanned: (codes, frame) => {
runAtTargetFps(5, () => {
onBarCodeDetected(codes[0], frame);
if (isActive && !isLoading && codes.length > 0) {
onBarCodeDetected(codes[0], frame);
}
});
},
});
Expand Down Expand Up @@ -115,9 +117,13 @@ const Camera = ({ navigation }: TProps) => {
<Analytics screenName="Camera" />
<View onLayout={handleLayoutChange} style={StyleSheet.absoluteFill}>
<FocusAwareStatusBar backgroundColor={theme.palette.neutral['900']} barStyle="light-content" />
{overlayDimensions.width !== 0 && (
<VisionCamera codeScanner={codeScanner} device={device} format={format} isActive={isActive} style={overlayDimensions} />
)}
<VisionCamera
codeScanner={codeScanner}
device={device}
format={format}
isActive={isActive && overlayDimensions.width !== 0}
style={overlayDimensions}
/>
<CameraOverlay config={overlay} isLoading={isLoading} settings={overlaySettings} />
</View>
</>
Expand Down

0 comments on commit 2302c82

Please sign in to comment.