@applicaster/zapp-react-native-utils 14.0.0-alpha.4748018412 → 14.0.0-alpha.5431459455

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.
@@ -3,6 +3,7 @@ import { accessibilityManagerLogger as logger } from "./logger";
3
3
  import { TTSManager } from "../platform/platformUtils";
4
4
  import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
5
5
  import { AccessibilityRole } from "react-native";
6
+ import _ from "lodash";
6
7
 
7
8
  export class AccessibilityManager {
8
9
  private static _instance: AccessibilityManager | null = null;
@@ -135,7 +136,9 @@ export class AccessibilityManager {
135
136
  });
136
137
  }
137
138
 
138
- public getButtonAccessibilityProps(buttonName: string): AccessibilityProps {
139
+ public getButtonAccessibilityProps(name: string): AccessibilityProps {
140
+ const buttonName = _.toString(name);
141
+
139
142
  const buttonConfig = BUTTON_ACCESSIBILITY_KEYS[buttonName];
140
143
 
141
144
  if (!buttonConfig) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.0-alpha.4748018412",
3
+ "version": "14.0.0-alpha.5431459455",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "14.0.0-alpha.4748018412",
30
+ "@applicaster/applicaster-types": "14.0.0-alpha.5431459455",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -5,6 +5,7 @@ import { isFilledArray } from "@applicaster/zapp-react-native-utils/arrayUtils";
5
5
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
6
6
 
7
7
  import { getBoolFromConfigValue } from "../configurationUtils";
8
+ import { Dimensions } from "react-native";
8
9
 
9
10
  /**
10
11
  * Gets duration value from player manager, and from extensions
@@ -95,3 +96,53 @@ export const isAudioItem = (item: Option<ZappEntry>) => {
95
96
  export const isInlineTV = (screenData) => {
96
97
  return isTV() && isFilledArray(screenData?.ui_components);
97
98
  };
99
+
100
+ const isPercentage = (value: string | number): boolean => {
101
+ if (typeof value === "string") {
102
+ return value.includes("%");
103
+ }
104
+
105
+ return false;
106
+ };
107
+
108
+ const getPercentageOf = (percent: string, value: number) => {
109
+ const percentageValue = parseFloat(percent.replace("%", ""));
110
+
111
+ if (isNaN(percentageValue)) {
112
+ return value;
113
+ }
114
+
115
+ return (value * percentageValue) / 100;
116
+ };
117
+
118
+ type DimensionsT = {
119
+ width: number | string;
120
+ height: number | string | undefined;
121
+ aspectRatio?: number;
122
+ };
123
+
124
+ export const getTabletWidth = (
125
+ tablet_landscape_sidebar_width,
126
+ dimensions: DimensionsT
127
+ ) => {
128
+ const { width: SCREEN_WIDTH } = Dimensions.get("screen");
129
+
130
+ const { width } = dimensions;
131
+ let widthValue = Number(width);
132
+
133
+ if (isPercentage(width)) {
134
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
135
+ }
136
+
137
+ const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
138
+
139
+ if (tablet_landscape_sidebar_width?.includes("%")) {
140
+ return widthValue * (1 - sidebarWidth / 100);
141
+ }
142
+
143
+ if (Number.isNaN(sidebarWidth)) {
144
+ return widthValue * 0.65;
145
+ }
146
+
147
+ return widthValue - sidebarWidth;
148
+ };