@applicaster/zapp-react-native-utils 12.0.0-rc.25 → 12.0.0-rc.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,14 @@ function getPlayerConfiguration({ platform }) {
46
46
  label_tooltip:
47
47
  "Enable if you want to have adaptive background gradient based on audio background image.",
48
48
  },
49
+ {
50
+ key: "audio_player_background_image_query",
51
+ label: "Audio Player Image Query",
52
+ initial_value: "",
53
+ type: "text_input",
54
+ label_tooltip:
55
+ "Set the query params which control the size of the image e.g width, height. This will help to optimize the loading time, when magic background is enabled.",
56
+ },
49
57
  ],
50
58
  };
51
59
 
@@ -1,5 +1,7 @@
1
1
  import { cleanup, renderHook } from "@testing-library/react-hooks";
2
2
 
3
+ import * as ReactNative from "react-native";
4
+
3
5
  const mocked_return_value = (tv) => ({
4
6
  screen: tv
5
7
  ? { width: 50, height: 50, scale: 2, fontScale: 1 }
@@ -10,41 +12,31 @@ const mocked_return_value = (tv) => ({
10
12
  const platform = "android";
11
13
  let tv_flag = false;
12
14
 
13
- jest.mock("react-native-safe-area-context", () => ({
14
- useSafeAreaInsets: () => ({ top: 50 }),
15
- }));
15
+ ReactNative.Dimensions.get = jest.fn(
16
+ (context) => mocked_return_value(tv_flag)[context]
17
+ );
16
18
 
17
19
  const mockRemoveFn = jest.fn();
18
20
 
19
- jest.mock("react-native", () => {
20
- const RNMock = jest.genMockFromModule("react-native");
21
-
22
- const Dims = {
23
- get: jest.fn((context) => mocked_return_value(tv_flag)[context]),
24
- addEventListener: jest.fn().mockReturnValue({
25
- remove: mockRemoveFn,
26
- }),
27
- };
28
-
29
- const QuickBrickCommunicationModule = {
30
- initialProps: {
31
- is_tablet: false,
32
- },
33
- };
34
-
35
- return {
36
- ...RNMock,
37
- Dimensions: Dims,
38
- Platform: {
39
- OS: platform,
40
- },
41
- NativeModules: {
42
- ...RNMock.NativeModules,
43
- QuickBrickCommunicationModule,
44
- },
45
- };
21
+ ReactNative.Dimensions.addEventListener = jest.fn().mockReturnValue({
22
+ remove: mockRemoveFn,
46
23
  });
47
24
 
25
+ ReactNative.Platform.OS = platform;
26
+
27
+ const QuickBrickCommunicationModule = {
28
+ initialProps: {
29
+ is_tablet: false,
30
+ },
31
+ };
32
+
33
+ ReactNative.NativeModules.QuickBrickCommunicationModule =
34
+ QuickBrickCommunicationModule;
35
+
36
+ jest.mock("react-native-safe-area-context", () => ({
37
+ useSafeAreaInsets: () => ({ top: 50 }),
38
+ }));
39
+
48
40
  jest.mock("../../../reactUtils", () => ({
49
41
  platformSelect: jest.fn((specs) => specs[platform] || specs.default),
50
42
  isTV: jest.fn(() => tv_flag),
@@ -1,19 +1,14 @@
1
- let mockPlatformOS = "android";
1
+ import * as ReactNative from "react-native";
2
2
 
3
- jest.mock("react-native", () => {
4
- const mockDimensionsGet = jest.fn(
5
- (type) =>
6
- ({
7
- window: { width: 1, height: 1 },
8
- screen: { width: 360, height: 540 },
9
- }[type])
10
- );
3
+ const mockDimensionsGet = jest.fn(
4
+ (type) =>
5
+ ({
6
+ window: { width: 1, height: 1 },
7
+ screen: { width: 360, height: 540 },
8
+ }[type])
9
+ );
11
10
 
12
- return {
13
- Platform: jest.fn(() => ({ OS: mockPlatformOS })),
14
- Dimensions: { get: mockDimensionsGet },
15
- };
16
- });
11
+ ReactNative.Dimensions.get = mockDimensionsGet;
17
12
 
18
13
  const mockGetConstants = jest.fn().mockReturnValue({
19
14
  Dimensions: {
@@ -26,9 +21,10 @@ jest.mock("react-native/Libraries/Utilities/NativeDeviceInfo", () => ({
26
21
  getConstants: mockGetConstants,
27
22
  }));
28
23
 
29
- const { Platform, Dimensions } = require("react-native");
24
+ const { Platform, Dimensions } = ReactNative;
30
25
 
31
26
  Platform.OS = "android";
27
+
32
28
  const { getInitialDimensions } = require("../getInitialDimensions.native.ts");
33
29
 
34
30
  describe("useDimensions > helpers ( native )", () => {
@@ -48,7 +44,6 @@ describe("useDimensions > helpers ( native )", () => {
48
44
 
49
45
  it("should call NativeDeviceInfo.getConstants for ios when width === height", () => {
50
46
  Platform.OS = "ios";
51
- mockPlatformOS = "ios";
52
47
 
53
48
  jest.fn().mockReturnValue({
54
49
  Dimensions: {
@@ -1,21 +1,19 @@
1
- jest.mock("react-native", () => {
2
- const mockDimensionsGet = jest.fn(
3
- (type) =>
4
- ({
5
- window: { width: 1, height: 1 },
6
- screen: { width: 360, height: 540 },
7
- }[type])
8
- );
1
+ import * as ReactNative from "react-native";
9
2
 
10
- return {
11
- Platform: jest.fn(() => ({ OS: "web" })),
12
- Dimensions: { get: mockDimensionsGet },
13
- };
14
- });
3
+ const mockDimensionsGet = jest.fn(
4
+ (type) =>
5
+ ({
6
+ window: { width: 1, height: 1 },
7
+ screen: { width: 360, height: 540 },
8
+ }[type])
9
+ );
10
+
11
+ ReactNative.Dimensions.get = mockDimensionsGet;
15
12
 
16
- const { Platform, Dimensions } = require("react-native");
13
+ const { Platform, Dimensions } = ReactNative;
17
14
 
18
15
  Platform.OS = "web";
16
+
19
17
  const { getInitialDimensions } = require("../getInitialDimensions.ts");
20
18
 
21
19
  describe("useDimensions > helpers (web)", () => {
@@ -49,3 +49,11 @@ export function useScreenState(
49
49
  setSelectedEntry: (entryId) => setSelectedEntry(screenId, entryId),
50
50
  };
51
51
  }
52
+
53
+ export const useScreenScrollStore = create<{
54
+ scrollPosition: number;
55
+ scrollingVelocity: number;
56
+ }>(() => ({
57
+ scrollPosition: 0,
58
+ scrollingVelocity: 0,
59
+ }));