@applicaster/zapp-react-native-utils 13.0.0-alpha.8490438700 → 13.0.0-alpha.8620112557
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.
- package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +1 -0
- package/appUtils/focusManager/index.ts +9 -0
- package/appUtils/platform/platformUtils.ts +24 -3
- package/focusManager/FocusManager.ts +27 -3
- package/package.json +2 -2
- package/reactHooks/navigation/useGetTabBarHeight.ts +1 -3
|
@@ -345,6 +345,14 @@ export const focusManager = (function () {
|
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
function pressIn() {
|
|
349
|
+
const currentFocusable = getCurrentFocus();
|
|
350
|
+
|
|
351
|
+
if (currentFocusable) {
|
|
352
|
+
currentFocusable.pressIn(null);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
348
356
|
/**
|
|
349
357
|
* calls the `press` method on the current focus component
|
|
350
358
|
* @public
|
|
@@ -552,6 +560,7 @@ export const focusManager = (function () {
|
|
|
552
560
|
invokeHandler,
|
|
553
561
|
removeHandler,
|
|
554
562
|
longPress,
|
|
563
|
+
pressIn,
|
|
555
564
|
pressOut,
|
|
556
565
|
enableFocus,
|
|
557
566
|
setInitialFocus,
|
|
@@ -81,9 +81,12 @@ export class ClosedCaptioningManager {
|
|
|
81
81
|
|
|
82
82
|
static getInstance(): ClosedCaptioningManager {
|
|
83
83
|
if (!ClosedCaptioningManager.ccManagerInstance) {
|
|
84
|
+
log_debug("ClosedCaptioningManager: Creating new instance");
|
|
84
85
|
ClosedCaptioningManager.ccManagerInstance = new ClosedCaptioningManager();
|
|
85
86
|
}
|
|
86
87
|
|
|
88
|
+
log_debug("ClosedCaptioningManager: Returning existing instance");
|
|
89
|
+
|
|
87
90
|
return ClosedCaptioningManager.ccManagerInstance;
|
|
88
91
|
}
|
|
89
92
|
|
|
@@ -92,23 +95,41 @@ export class ClosedCaptioningManager {
|
|
|
92
95
|
PLATFORM_KEYS.deviceClosedCaptioningEnabled
|
|
93
96
|
);
|
|
94
97
|
|
|
95
|
-
log_debug("Initializing closed captioning manager", { existingState });
|
|
96
|
-
|
|
97
98
|
if (existingState !== null) {
|
|
99
|
+
log_debug(
|
|
100
|
+
`ClosedCaptioningManager: Setting initial state to ${existingState}`
|
|
101
|
+
);
|
|
102
|
+
|
|
98
103
|
this.ccState$.next(existingState === "true" || existingState === true);
|
|
104
|
+
} else {
|
|
105
|
+
log_debug("ClosedCaptioningManager: No existing state found");
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
if (hasVizioAPIs()) {
|
|
109
|
+
log_debug("ClosedCaptioningManager: Setting closed captioning handler");
|
|
110
|
+
|
|
102
111
|
window.VIZIO!.setClosedCaptionHandler((isCCEnabled) => {
|
|
103
|
-
log_debug(
|
|
112
|
+
log_debug(
|
|
113
|
+
"ClosedCaptioningManager: There was a change in the CC state",
|
|
114
|
+
{ isCCEnabled }
|
|
115
|
+
);
|
|
104
116
|
|
|
105
117
|
sessionStorage.setItem(
|
|
106
118
|
PLATFORM_KEYS.deviceClosedCaptioningEnabled,
|
|
107
119
|
isCCEnabled
|
|
108
120
|
);
|
|
109
121
|
|
|
122
|
+
log_debug(
|
|
123
|
+
"ClosedCaptioningManager: Saved CC state to session storage",
|
|
124
|
+
{ isCCEnabled }
|
|
125
|
+
);
|
|
126
|
+
|
|
110
127
|
this.ccState$.next(isCCEnabled);
|
|
111
128
|
});
|
|
129
|
+
} else {
|
|
130
|
+
log_debug(
|
|
131
|
+
"ClosedCaptioningManager: Vizio APIs are not available, skipping setup"
|
|
132
|
+
);
|
|
112
133
|
}
|
|
113
134
|
}
|
|
114
135
|
|
|
@@ -227,7 +227,14 @@ class FocusManager {
|
|
|
227
227
|
|
|
228
228
|
const nextNextFocus = FocusManager.getNextFocusable(direction, nextFocus);
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
if (!nextNextFocus) {
|
|
231
|
+
const nextNextFocusForParent =
|
|
232
|
+
FocusManager.instance.getNextFocusableForParent(direction, nextFocus);
|
|
233
|
+
|
|
234
|
+
FocusManager.instance.setFocus(nextNextFocusForParent, options);
|
|
235
|
+
} else {
|
|
236
|
+
FocusManager.instance.setFocus(nextNextFocus, options);
|
|
237
|
+
}
|
|
231
238
|
} else {
|
|
232
239
|
FocusManager.instance.setFocusLocal(nextFocus);
|
|
233
240
|
|
|
@@ -307,9 +314,26 @@ class FocusManager {
|
|
|
307
314
|
return FocusManager.getNextFocusable(direction);
|
|
308
315
|
}
|
|
309
316
|
|
|
310
|
-
getNextFocusableForParent(
|
|
317
|
+
getNextFocusableForParent(
|
|
318
|
+
direction,
|
|
319
|
+
focusable?: FocusManager.TouchableReactRef
|
|
320
|
+
) {
|
|
321
|
+
const focusableId = focusable
|
|
322
|
+
? getFocusableId(focusable)
|
|
323
|
+
: FocusManager.instance.focusedId;
|
|
324
|
+
|
|
311
325
|
const focusDirection = toFocusDirection(direction);
|
|
312
|
-
const parentNode = this.tree.findParent(
|
|
326
|
+
const parentNode = this.tree.findParent(focusableId);
|
|
327
|
+
|
|
328
|
+
const parentNodeParent = this.tree.findParent(parentNode?.id);
|
|
329
|
+
|
|
330
|
+
const hasNextFocusable = this.tree.find(
|
|
331
|
+
parentNode?.component?.current?.props[focusDirection]
|
|
332
|
+
);
|
|
333
|
+
|
|
334
|
+
if (!hasNextFocusable) {
|
|
335
|
+
return parentNodeParent?.component?.current?.props[focusDirection];
|
|
336
|
+
}
|
|
313
337
|
|
|
314
338
|
return parentNode?.component?.current?.props[focusDirection];
|
|
315
339
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.8620112557",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.8620112557",
|
|
32
32
|
"buffer": "^5.2.1",
|
|
33
33
|
"camelize": "^1.0.0",
|
|
34
34
|
"create-react-context": "^0.2.3",
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
2
|
-
|
|
3
1
|
import { platformSelect } from "../../reactUtils";
|
|
4
2
|
|
|
5
3
|
const TAB_BAR_HEIGHT_IOS = 49;
|
|
@@ -7,6 +5,6 @@ const TAB_BAR_HEIGHT_ANDROID = 56;
|
|
|
7
5
|
|
|
8
6
|
export const useGetTabBarHeight = () =>
|
|
9
7
|
platformSelect({
|
|
10
|
-
ios: TAB_BAR_HEIGHT_IOS
|
|
8
|
+
ios: TAB_BAR_HEIGHT_IOS,
|
|
11
9
|
android: TAB_BAR_HEIGHT_ANDROID,
|
|
12
10
|
}) as number;
|