diff --git a/example/App.js b/example/App.js index f5db3396..b3da9dad 100644 --- a/example/App.js +++ b/example/App.js @@ -21,44 +21,59 @@ import { import {RNCamera} from 'react-native-camera'; import { BarcodeMaskWithOuterLayout, - useCustomBarcodeRead, + useBarcodeRead, } from './@nartc/react-native-barcode-mask/react-native-barcode-mask.esm'; const App = () => { const rnCamera = useRef(null); const [barcodeReadCount, setBarcodeReadCount] = useState(0); const [barcodeReadAware, setBarcodeReadAware] = useState(false); - const [barcodeRead, setBarcodeRead] = useState(false); - const {onBarcodeFinderLayoutChange, onBarcodeRead} = useCustomBarcodeRead( + // const [barcodeRead, setBarcodeRead] = useState(false); + // const {onBarcodeFinderLayoutChange, onBarcodeRead} = useCustomBarcodeRead( + // true, + // data => data, + // processed => { + // console.log(processed, {barcodeReadCount}); + // setBarcodeReadCount(prev => prev + 1); + // }, + // { + // beforeScan: () => { + // setBarcodeRead(true); + // }, + // afterScan: () => {}, + // }, + // (a, b, c) => { + // return event => { + // c(event.data); + // }; + // }, + // ); + const { + barcodeRead, + onBarcodeRead, + onBarcodeFinderLayoutChange, + } = useBarcodeRead( true, data => data, processed => { - console.log(processed, {barcodeReadCount}); - setBarcodeReadCount(prev => prev + 1); - }, - { - beforeScan: () => { - setBarcodeRead(true); - }, - afterScan: () => {}, - }, - (a, b, c) => { - return event => { - c(event.data); - }; + console.log(processed); }, ); return ( <> - +