Skip to content

Commit a30a87b

Browse files
committed
chore: update library and changelog
1 parent 89059d4 commit a30a87b

5 files changed

Lines changed: 8 additions & 28 deletions

File tree

packages/pluggableWidgets/barcode-scanner-native/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
- We migrated to react-native-vision-camera from react-native-camera.
10+
911
## [4.1.0] - 2024-12-3
1012

1113
### Changed

packages/pluggableWidgets/barcode-scanner-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "barcode-scanner-native",
33
"widgetName": "BarcodeScanner",
4-
"version": "4.1.0",
4+
"version": "4.2.0",
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",

packages/pluggableWidgets/barcode-scanner-native/src/__tests__/BarcodeScanner.spec.tsx

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ import { actionValue, EditableValueBuilder } from "@mendix/piw-utils-internal";
22
import { createElement } from "react";
33
import { fireEvent, render, RenderAPI } from "@testing-library/react-native";
44

5-
import { BarcodeScanner, Props, throttle } from "../BarcodeScanner";
5+
import { BarcodeScanner, Props } from "../BarcodeScanner";
66
import { RNCamera } from "./__mocks__/RNCamera";
77

8-
jest.mock("react-native-camera", () => jest.requireActual("./__mocks__/RNCamera"));
9-
10-
jest.useFakeTimers();
8+
jest.mock("react-native-vision-camera", () => jest.requireActual("./__mocks__/RNCamera"));
119

1210
describe("BarcodeScanner", () => {
1311
let defaultProps: Props;
@@ -71,26 +69,6 @@ describe("BarcodeScanner", () => {
7169
expect(defaultProps.barcode.setValue).toHaveBeenCalledWith("value2");
7270
expect(onDetectAction.execute).toHaveBeenCalledTimes(3);
7371
});
74-
75-
describe("throttling", () => {
76-
const func: (...args: any) => void = jest.fn();
77-
const args = ["argument", { prop: "arguments" }];
78-
79-
it("should execute function in correct time intervals", () => {
80-
const throttleFunc = throttle(func, 100);
81-
82-
throttleFunc(...args);
83-
expect(func).toHaveBeenCalledTimes(1);
84-
jest.advanceTimersByTime(100);
85-
throttleFunc(...args);
86-
jest.advanceTimersByTime(99);
87-
throttleFunc(...args);
88-
throttleFunc(...args);
89-
expect(func).toHaveBeenCalledTimes(2);
90-
jest.advanceTimersByTime(100);
91-
expect(func).toHaveBeenCalledTimes(2);
92-
});
93-
});
9472
});
9573

9674
function detectBarcode(component: RenderAPI, barcode: string): void {

packages/pluggableWidgets/barcode-scanner-native/src/__tests__/__mocks__/RNCamera.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, createElement } from "react";
22
import { View, ViewProps } from "react-native";
3-
import { RNCameraProps } from "react-native-camera";
3+
import { CameraProps } from "react-native-vision-camera";
44

5-
export class RNCamera extends Component<RNCameraProps & ViewProps> {
5+
export class RNCamera extends Component<CameraProps & ViewProps> {
66
static constants = {
77
Aspect: {},
88
BarCodeType: {},

packages/pluggableWidgets/barcode-scanner-native/src/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<package xmlns="http://www.mendix.com/package/1.0/">
3-
<clientModule name="BarcodeScanner" version="4.1.0" xmlns="http://www.mendix.com/clientModule/1.0/">
3+
<clientModule name="BarcodeScanner" version="4.2.0" xmlns="http://www.mendix.com/clientModule/1.0/">
44
<widgetFiles>
55
<widgetFile path="BarcodeScanner.xml" />
66
</widgetFiles>

0 commit comments

Comments
 (0)