Skip to content

Commit

Permalink
cleanup 1
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodyHughes committed Nov 10, 2023
1 parent c50e504 commit 94163fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/components/qrcode-scanner/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import lang from 'i18n-js';
import React from 'react';
import { Camera } from 'react-native-vision-camera';
import { Camera, CodeScanner } from 'react-native-vision-camera';
import Animated from 'react-native-reanimated';
import { ErrorText } from '../text';
import QRCodeScannerNeedsAuthorization from './QRCodeScannerNeedsAuthorization';
import { deviceUtils } from '@/utils';
import { Box, Cover, Rows, Row } from '@/design-system';
import { CameraMaskSvg } from '../svg/CameraMaskSvg';
import { IS_ANDROID } from '@/env';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { getSoftMenuBarHeight } from 'react-native-extra-dimensions-android';

// Display.getRealMetrics

const deviceWidth = deviceUtils.dimensions.width;
const deviceHeight = deviceUtils.dimensions.height;

Expand All @@ -21,9 +20,9 @@ const androidSoftMenuHeight = getSoftMenuBarHeight();
interface QRCodeScannerProps {
flashEnabled?: boolean;
isActive: boolean;
codeScanner: any;
codeScanner: CodeScanner;
hasPermission: boolean;
requestPermission: any;
requestPermission: () => Promise<boolean>;
}

export const QRCodeScanner: React.FC<QRCodeScannerProps> = ({
Expand Down Expand Up @@ -64,7 +63,7 @@ export const QRCodeScanner: React.FC<QRCodeScannerProps> = ({
audio={false}
video={false}
photo={false}
// onError={() => setCameraState(CameraState.Error)}
onError={() => requestPermission}
/>
</Box>
<Rows>
Expand Down
11 changes: 5 additions & 6 deletions src/screens/QRScannerScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import { usePagerPosition } from '@/navigation/ScrollPositionContext';
import styled from '@/styled-thing';
import { position } from '@/styles';
import { useTheme } from '@/theme';
import { useFocusEffect, useIsFocused } from '@react-navigation/native';
import { useIsFocused } from '@react-navigation/native';
import { useIsForeground } from '@/hooks/useIsForeground';
import {
useCameraPermission,
useCodeScanner,
} from 'react-native-vision-camera';
import { addActionAfterClosingSheet } from '@/navigation/Navigation';
import { IS_ANDROID, IS_IOS } from '@/env';

const Background = styled(View)({
backgroundColor: 'black',
Expand Down Expand Up @@ -71,7 +71,7 @@ export default function QRScannerScreen() {
const isActive = isFocused && isForeground && hasPermission;
const navigation = useNavigation();

const [flashEnabled, setFlashEnabled] = React.useState(false);
const [flashEnabled, setFlashEnabled] = useState(false);

const hideCamera = useCallback(() => {
setFlashEnabled(false);
Expand Down Expand Up @@ -111,7 +111,6 @@ export default function QRScannerScreen() {
const handleCloseScanner = useCallback(() => {
setFlashEnabled(false);
setCameraActive(false);
console.log('rannnnnnnn caslkdl;asdjf;ja');
setTimeout(() => {
navigate(Routes.WALLET_SCREEN);
}, 0);
Expand Down Expand Up @@ -206,7 +205,7 @@ export default function QRScannerScreen() {
<ScannerContainer>
<Background />
<CameraDimmer cameraVisible={true}>
{android && (
{IS_ANDROID && (
<ScannerHeader>
<EmulatorPasteUriButton />
</ScannerHeader>
Expand All @@ -221,7 +220,7 @@ export default function QRScannerScreen() {
/>
)}
</CameraDimmer>
{ios && (
{IS_IOS && (
<ScannerHeader>
<EmulatorPasteUriButton />
</ScannerHeader>
Expand Down

0 comments on commit 94163fa

Please sign in to comment.