From 94163fab8e9942bde5b4d543feeecd1c8ad64d0a Mon Sep 17 00:00:00 2001 From: BrodyHughes <41711440+BrodyHughes@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:56:56 -0600 Subject: [PATCH] cleanup 1 --- src/components/qrcode-scanner/QRCodeScanner.tsx | 11 +++++------ src/screens/QRScannerScreen.tsx | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/qrcode-scanner/QRCodeScanner.tsx b/src/components/qrcode-scanner/QRCodeScanner.tsx index 3b65b0b2afc..11101b8ae7b 100644 --- a/src/components/qrcode-scanner/QRCodeScanner.tsx +++ b/src/components/qrcode-scanner/QRCodeScanner.tsx @@ -1,6 +1,6 @@ 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'; @@ -8,11 +8,10 @@ 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; @@ -21,9 +20,9 @@ const androidSoftMenuHeight = getSoftMenuBarHeight(); interface QRCodeScannerProps { flashEnabled?: boolean; isActive: boolean; - codeScanner: any; + codeScanner: CodeScanner; hasPermission: boolean; - requestPermission: any; + requestPermission: () => Promise; } export const QRCodeScanner: React.FC = ({ @@ -64,7 +63,7 @@ export const QRCodeScanner: React.FC = ({ audio={false} video={false} photo={false} - // onError={() => setCameraState(CameraState.Error)} + onError={() => requestPermission} /> diff --git a/src/screens/QRScannerScreen.tsx b/src/screens/QRScannerScreen.tsx index ea102fadb63..42af1fe4d20 100644 --- a/src/screens/QRScannerScreen.tsx +++ b/src/screens/QRScannerScreen.tsx @@ -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', @@ -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); @@ -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); @@ -206,7 +205,7 @@ export default function QRScannerScreen() { - {android && ( + {IS_ANDROID && ( @@ -221,7 +220,7 @@ export default function QRScannerScreen() { /> )} - {ios && ( + {IS_IOS && (