useBarcodeRead hook is not working
See original GitHub issueHi there,
I am trying to use the useBarcodeRead
hook, but it is not triggering anything. I have created a pretty simple camera component.
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { RNCamera } from 'react-native-camera';
import {
BarcodeMaskWithOuterLayout,
useBarcodeRead,
} from '@nartc/react-native-barcode-mask';
import { getColor } from '../assets/style/style.constants';
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
preview: {
flex: 1,
justifyContent: 'flex-end',
alignItems: 'center',
},
});
export const Camera = () => {
const {
barcodeRead,
onBarcodeRead,
onBarcodeFinderLayoutChange,
} = useBarcodeRead(
true,
barcodeData => {
console.log(barcodeData);
return barcodeData;
},
processedBarcodeData => {
console.log(processedBarcodeData);
return processedBarcodeData;
},
);
console.log(1, barcodeRead);
console.log(2, onBarcodeRead);
console.log(3, onBarcodeFinderLayoutChange);
return (
<View style={styles.container}>
<RNCamera
barCodeTypes={barcodeRead ? [] : [RNCamera.Constants.BarCodeType.qr]}
onBarCodeRead={onBarcodeRead}
captureAudio={false}
style={styles.preview}
type={RNCamera.Constants.Type.back}
>
<BarcodeMaskWithOuterLayout
edgeColor={getColor().PRIMARY}
animatedLineColor={getColor().PRIMARY}
maskOpacity={0.7}
height="80%"
width="80%"
showAnimatedLine
onLayoutChange={onBarcodeFinderLayoutChange}
/>
</RNCamera>
</View>
);
};
The console.log
are not being triggered. Am I doing something wrong or is there something wrong with the lib?
Issue Analytics
- State:
- Created 4 years ago
- Comments:31 (16 by maintainers)
Top Results From Across the Web
How do i solve this Hook error in React Native? - Stack Overflow
Im Trying to make this app as a Project because i just learned React Native and i've gotten this far without problems but...
Read more >BarcodeMask Component for RNCamera - Morioh
To use this feature, you need to import and use useBarcodeRead custom hook: const { barcodeRead, onBarcodeRead, onBarcodeFinderLayoutChange, } = useBarcodeRead( ...
Read more >Automationproduction systems and cim groover - Academia.edu
Complexity of cyclic scheduling problems: A state-of-the-art survey ... nut much of the hook was very similar to the 191';0lex I. By the...
Read more >Introduction to Material Handling - IE473
Problem. Solutions,' paper presented at the MHI 1994 Imanafionll/. Research Colloquium. Grand ... from the trolleys are hooks, baskets, or other receptacles.
Read more >Shop Vehicles Scanner with great discounts and prices online - Aug ...
... Engine Auto Diagnostic Reset Tool V301 Use Barcode Read Information ... for Android Devices Bluetooth Obd2 Scanner W/cd Driver for Most 1996 ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @nartc Sorry due sickness I wasn’t able to test it yet. I’m back at the office today, I’ll try to test it this week ASAP and will get back to you.
Thanks for the information