Skip to content

Commit

Permalink
🐛(llm): camera doesn't refocus when scanning for LS on IOS (#7821)
Browse files Browse the repository at this point in the history
🐛(llm): camera doesn't refocus when scanning for LS
  • Loading branch information
LucasWerey authored Sep 16, 2024
1 parent d18ec03 commit eb052c4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/tiny-pigs-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

fix camera not re focus when scanning LS qr code
6 changes: 6 additions & 0 deletions apps/ledger-live-mobile/__tests__/jest-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ jest.mock("expo-barcode-scanner", () => ({
},
}));

jest.mock("expo-camera/next", () => {
return {
CameraView: jest.fn(() => null),
};
});

// Mock of Native Modules
jest.mock("react-native-localize", () => ({
getTimeZone: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Flex, Icons, Text } from "@ledgerhq/native-ui";
import { Trans, useTranslation } from "react-i18next";
import styled, { useTheme } from "styled-components/native";
import BottomContainer from "./BottomContainer";
import { BarCodeScanningResult, Camera, CameraType } from "expo-camera";
import { BarCodeScanner } from "expo-barcode-scanner";
import { CameraView } from "expo-camera/next";
import ScanTargetSvg from "./ScanTargetSvg";
import RequiresCameraPermissions from "~/components/RequiresCameraPermissions";
import { BarCodeScanningResult } from "expo-camera";

type Props = {
onQrCodeScanned: (data: string) => void;
Expand Down Expand Up @@ -73,17 +73,16 @@ const ScanQrCode = ({ onQrCodeScanned }: Props) => {
justifyContent={"center"}
alignItems={"center"}
>
<Camera
<CameraView
style={{
backgroundColor: colors.neutral.c50,
width: 280,
height: 280,
}}
type={CameraType.back}
barCodeScannerSettings={{
barCodeTypes: [BarCodeScanner.Constants.BarCodeType.qr],
barcodeScannerSettings={{
barcodeTypes: ["qr"],
}}
onBarCodeScanned={onBarCodeScanned}
onBarcodeScanned={onBarCodeScanned}
/>
<ScanTargetSvg style={{ position: "absolute" }} />
</Flex>
Expand Down

0 comments on commit eb052c4

Please sign in to comment.