vision-camera-code-scanner
vision-camera-code-scanner copied to clipboard
stop continuous scanning qrcode and display the frame image
Hi, is there any way to stop the camera and set the captured image fixed on screen after the qrcode is scanned and stop scanning qrcode again only when manually reactivated it?
I guess if you use the active on the <Camera active={isActive}> property you can achieve this? You would then in the frameprocessor do setActive(false) and the camera will stop (and the frame will lock)
The solution is to use useSharedValue
hook from react-native-reanimated
to sync frame processors.
@infastin can you please describe how to do it with this hook?
@fdelavra Something like this:
const barcodeScanned = useSharedValue(false);
const frameProcessor = useFrameProcessor((frame) => {
"worklet"
...
if (barcodeScanned.value) {
return;
}
barcodeScanned.value = true;
...
});
@infastin Thanks ;)