/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow */ import React, { useCallback, useState } from 'react'; import { View, Dimensions, Button, Text } from 'react-native'; import { RNCamera } from 'react-native-camera'; const App: () => React$Node = () => { const [showCamera, setShowCamera] = useState(); const CAM_VIEW_HEIGHT = Dimensions.get('screen').width * 1.5; const CAM_VIEW_WIDTH = Dimensions.get('screen').width; // The following are based on landscape orientation with home button to the right // left const leftMargin = 100; // top const topMargin = 50; // width (height of portrait orientation) const frameWidth = 200; // height (width of portrait orientation) const frameHeight = 250; const scanAreaX = leftMargin / CAM_VIEW_HEIGHT; const scanAreaY = topMargin / CAM_VIEW_WIDTH; const scanAreaWidth = frameWidth / CAM_VIEW_HEIGHT; const scanAreaHeight = frameHeight / CAM_VIEW_WIDTH; const onBarCodeRead = useCallback((result) => { if (result) { const { type, data } = result; if (data) { console.log('code', data); } } }, []); return (