@applicaster/zapp-react-native-utils 14.0.0-alpha.6931095759 → 14.0.0-alpha.7104619551
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(
|
|
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) {
|
|
@@ -8,7 +8,6 @@ const {
|
|
|
8
8
|
conditional_horizontal_type,
|
|
9
9
|
conditional_vertical_type,
|
|
10
10
|
conditional_horizontal_type_item_fixed,
|
|
11
|
-
conditional_horizontal_type_item_dynamic,
|
|
12
11
|
conditional_horizontal_asset_on,
|
|
13
12
|
conditional_horizontal_display_type_fixed,
|
|
14
13
|
} = require("./utils");
|
|
@@ -48,7 +47,7 @@ const componentConfigurationFields = [
|
|
|
48
47
|
{ text: "Right", value: "right" },
|
|
49
48
|
{ text: "Center", value: "center" },
|
|
50
49
|
],
|
|
51
|
-
...
|
|
50
|
+
...conditional_horizontal_type,
|
|
52
51
|
},
|
|
53
52
|
{
|
|
54
53
|
type: "select",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.7104619551",
|
|
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.
|
|
30
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.7104619551",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
package/playerUtils/index.ts
CHANGED
|
@@ -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
|
+
};
|