Open Epick362 opened 2 years ago
I tried downgrading and this issue is happening since version 10.0.0
Never found that happening. Can you describe further ?
Callback function onScan()
passed to prop onReadCode
is only fired on the first detection of a QR code and then stops working. This is happening only on Android devices. After downgrading to 10.0.0 the callback works as expected multiple times.
We are experiencing this as well. Same smartphone model Samsung Galaxy A12.
Anyone able to solve this issue?
Experiencing this issue as well, Galaxy Note 9 & S21.
Anyone had any luck on this?
Also experiencing this, tried to force reload the component and set a navigation focus listener but still doesn't work
Hi guys, I think I found some workaround. In my case the onReadCode
callback was also fired once. I'm using React Navigation and I have a barcode scanning feature on one screen. So I decided to use the useIsFocused
hook and unmount the camera when I leave the screen. Now the scan works as expected.
It seems like Camera Screen lost the reference to onReadCode
callback after scanning/refreshing the state. Maybe this will be a clue that will help you.
export const Camera = ({navigation}: any) => {
const isFocused = useIsFocused();
const [barcode, setBarcode] = useState<string>('');
const handleBarcodeScan = (e: any) => {
setBarcode(e.nativeEvent.codeStringValue);
};
return isFocused ? (
<Layout>
<CameraContainer>
<CameraScreen
style={{flex: 1}}
scanBarcode={true}
onReadCode={handleBarcodeScan}
showFrame={true}
laserColor="darkorange"
frameColor="darkorange"
hideControls={true}
/>
</CameraContainer>
</Layout>
) : null;
};
@DamianJudek , worked for me, thanks a lot! :)
Thanks @DamianJudek! This seems like a good workaround in the meantime.
Describe the bug Barcode scanning callback only runs once on Android. Works just fine on iOS. Library version: 12.1.0
To Reproduce Steps to reproduce the behavior:
Expected behavior Callback gets executed multiple times.
Smartphone (please complete the following information):