@applicaster/zapp-react-native-utils 12.0.0-alpha.5040434238 → 12.0.0-alpha.5050333009

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.
Files changed (100) hide show
  1. package/analyticsUtils/AnalyticsEvents/index.ts +13 -0
  2. package/analyticsUtils/AnalyticsEvents/searchEvents.ts +21 -0
  3. package/analyticsUtils/AnalyticsEvents/sendShareEvent.ts +21 -0
  4. package/analyticsUtils/analyticsPlugins.ts +25 -0
  5. package/analyticsUtils/events.ts +12 -0
  6. package/analyticsUtils/index.tsx +12 -0
  7. package/appUtils/HooksManager/{Hook.js → Hook.ts} +35 -23
  8. package/appUtils/HooksManager/{constants.js → constants.ts} +1 -1
  9. package/appUtils/HooksManager/{index.js → index.ts} +118 -111
  10. package/appUtils/HooksManager/types.ts +116 -0
  11. package/appUtils/RiverFocusManager/index.js +17 -12
  12. package/appUtils/accessibilityManager/const.ts +50 -0
  13. package/appUtils/accessibilityManager/hooks.ts +31 -0
  14. package/appUtils/accessibilityManager/index.ts +150 -0
  15. package/appUtils/accessibilityManager/logger.ts +5 -0
  16. package/appUtils/focusManager/__tests__/__snapshots__/focusManager.test.js.snap +2 -3
  17. package/appUtils/focusManager/__tests__/focusManager.test.js +4 -24
  18. package/appUtils/focusManager/__tests__/index.test.ts +2 -3
  19. package/appUtils/focusManager/index.ts +76 -57
  20. package/appUtils/focusManager/treeDataStructure/Tree/index.js +2 -3
  21. package/appUtils/focusManager/treeDataStructure/Utils/index.js +76 -47
  22. package/appUtils/focusManager/utils/index.ts +100 -0
  23. package/appUtils/focusManagerAux/index.ts +76 -0
  24. package/appUtils/focusManagerAux/utils/index.ts +100 -0
  25. package/appUtils/{index.js → index.ts} +2 -0
  26. package/appUtils/keyCodes/{index.js → index.ts} +2 -0
  27. package/appUtils/keyCodes/keys/index.ts +3 -0
  28. package/appUtils/keyCodes/{keys.android.js → keys/keyEventMapper.ts} +0 -19
  29. package/appUtils/keyCodes/keys/keys.android.ts +18 -0
  30. package/appUtils/keyCodes/keys/keys.ios.ts +25 -0
  31. package/appUtils/keyCodes/keys/keys.ts +15 -0
  32. package/appUtils/keyCodes/{keys.web.js → keys/keys.web.ts} +8 -0
  33. package/appUtils/keyCodes/{keysByPlatform.js → keys/keysByPlatform.ts} +11 -1
  34. package/appUtils/platform/const.ts +25 -0
  35. package/appUtils/platform/index.ts +3 -0
  36. package/appUtils/platform/platformUtils.ts +171 -0
  37. package/appUtils/playerManager/conts.ts +1 -0
  38. package/appUtils/playerManager/index.ts +11 -5
  39. package/appUtils/playerManager/nativePlayerManager.ts +12 -0
  40. package/appUtils/playerManager/player.ts +10 -3
  41. package/appUtils/playerManager/playerNative.ts +10 -14
  42. package/appUtils/playerManager/usePlayerControllerSetup.tsx +7 -1
  43. package/arrayUtils/__tests__/isFilledArray.test.ts +63 -0
  44. package/arrayUtils/index.ts +5 -0
  45. package/booleanUtils/index.ts +4 -4
  46. package/cellUtils/__tests__/cellUtils.test.ts +9 -20
  47. package/cellUtils/index.ts +8 -12
  48. package/dateUtils/index.ts +11 -0
  49. package/domUtils/{cookieManager.js → cookieManager.ts} +1 -2
  50. package/functionUtils/index.ts +15 -11
  51. package/headersUtils/index.ts +1 -0
  52. package/inflatedUrlUtils/index.ts +4 -4
  53. package/keyboardState/index.ts +0 -0
  54. package/localizationUtils/__tests__/localizationUtils.test.ts +72 -53
  55. package/localizationUtils/index.ts +13 -22
  56. package/manifestUtils/defaultManifestConfigurations/generalContent.js +6 -0
  57. package/manifestUtils/defaultManifestConfigurations/player.js +2 -1
  58. package/modalState/index.ts +1 -5
  59. package/navigationUtils/index.ts +62 -5
  60. package/numberUtils/__tests__/isLikeNumber.test.ts +18 -0
  61. package/numberUtils/index.ts +9 -18
  62. package/package.json +2 -2
  63. package/playerUtils/configurationGenerator.ts +3 -1
  64. package/pluginUtils/index.ts +9 -0
  65. package/reactHooks/autoscrolling/__tests__/{useTrackedView.test.ts → useTrackedView.test.tsx} +16 -1
  66. package/reactHooks/cell-click/__tests__/index.test.js +10 -1
  67. package/reactHooks/cell-click/index.ts +12 -12
  68. package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +30 -70
  69. package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +6 -2
  70. package/reactHooks/feed/__tests__/useInflatedUrl.test.ts +18 -3
  71. package/reactHooks/feed/useBuildPipesUrl.ts +7 -10
  72. package/reactHooks/feed/useFeedRefresh.tsx +9 -7
  73. package/reactHooks/feed/useInflatedUrl.ts +44 -15
  74. package/reactHooks/layout/__tests__/{index.test.js → index.test.tsx} +43 -29
  75. package/reactHooks/layout/getDeviceInfo/index.ts +4 -3
  76. package/reactHooks/layout/types/index.ts +1 -1
  77. package/reactHooks/layout/useDimensions/useDimensions.ts +5 -2
  78. package/reactHooks/navigation/__mocks__/index.ts +13 -0
  79. package/reactHooks/navigation/__mocks__/useNavigation.ts +3 -0
  80. package/reactHooks/navigation/__tests__/index.test.tsx +11 -8
  81. package/reactHooks/navigation/index.ts +55 -25
  82. package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +21 -23
  83. package/reactHooks/screen/index.ts +2 -0
  84. package/reactHooks/screen/useScreenBackgroundColor.ts +23 -0
  85. package/reactHooks/screen/useScreenContext.ts +3 -3
  86. package/reactUtils/index.ts +91 -0
  87. package/screenState/index.ts +0 -8
  88. package/stringUtils/index.ts +5 -0
  89. package/testUtils/getByTestId.ts +14 -0
  90. package/testUtils/index.tsx +24 -22
  91. package/types.ts +4 -0
  92. package/appUtils/focusManager/FocusableEvents.ts +0 -8
  93. package/appUtils/focusManager/treeDataStructure/Utils/__tests__/Utils_android.test.js +0 -1094
  94. package/appUtils/focusManager/treeDataStructure/Utils/index.android.js +0 -261
  95. package/appUtils/keyCodes/keys.ios.js +0 -46
  96. /package/appUtils/HooksManager/{logger.js → logger.ts} +0 -0
  97. /package/appUtils/{directionHelper.js → directionHelper.ts} +0 -0
  98. /package/appUtils/keyCodes/{androidTVKeys.js → androidTVKeys.ts} +0 -0
  99. /package/appUtils/{localizationsHelper.js → localizationsHelper.ts} +0 -0
  100. /package/domUtils/{logger.js → logger.ts} +0 -0
@@ -0,0 +1,116 @@
1
+ import { SubscriberObj } from "../../functionUtils";
2
+ import { HOOKS_EVENTS } from "./constants";
3
+
4
+ export interface HookConfiguration {}
5
+
6
+ /* existing Hook Plugn props: sample */
7
+ interface _HookModulePlugin {
8
+ Component:
9
+ | React.FC<HookPluginProps>
10
+ | React.Component<HookPluginProps, any>
11
+ | React.ReactNode;
12
+ ModalContainer?: React.FC<ModalProps> | React.Component<ModalProps, any>;
13
+ skipHook?: (payload: ZappRiver | ZappEntry) => boolean;
14
+ presentFullScreen: boolean;
15
+ showNavBar?: boolean;
16
+ isFlowBlocker: (() => boolean) | boolean; // narrow this
17
+ hasPlayerHook?: boolean;
18
+ name: string;
19
+ runInBackground?: (
20
+ item: HookPluginProps["payload"],
21
+ callback: hookCallback,
22
+ hookPlugin: HookScreenData,
23
+ presentUI: (payload?: HookPluginProps["payload"]) => void
24
+ ) => any;
25
+ }
26
+
27
+ //* Derived from usage */
28
+ export interface HookModule {
29
+ ModalContainer?: React.ComponentType<any>;
30
+ Component: React.ComponentType<any>;
31
+ presentFullScreen: boolean;
32
+ run?: (
33
+ arg0: unknown,
34
+ callback: () => void,
35
+ configuration: HookConfiguration
36
+ ) => void; // not sure about optional parameter
37
+ hasPlayerHook?: boolean;
38
+ configuration?: HookConfiguration;
39
+ isFlowBlocker: () => boolean;
40
+ skipHook?: (payload?: ZappRiver | ZappEntry) => boolean;
41
+ runInBackground?: (
42
+ arg0: unknown,
43
+ callback: () => void,
44
+ hookPlugin: Hook,
45
+ presentUI: (payload?: HookPluginProps["payload"]) => void
46
+ ) => void;
47
+ name: string;
48
+ showNavBar?: boolean; // unsure
49
+ }
50
+
51
+ export type HookManagerArgs = {
52
+ rivers: Record<string, ZappRiver>;
53
+ plugins: ZappPlugin[];
54
+ targetScreen: ZappRiver;
55
+ startUpHooksData?: {
56
+ startUpHooks?: unknown[] | "in_process";
57
+ setStartUpHooks?: (arg0: string) => void;
58
+ };
59
+ };
60
+
61
+ export interface HookManager {
62
+ subscriber: SubscriberObj;
63
+ presentScreenHook: (
64
+ hook: Hook,
65
+ payload: unknown,
66
+ callback: (...any) => void
67
+ ) => void;
68
+ executeHook: (
69
+ hook: Hook,
70
+ payload: unknown,
71
+ callback: (...any) => void
72
+ ) => void;
73
+ handleHooks: (payload: unknown) => void;
74
+ runInBackground: (
75
+ hook: Hook,
76
+ payload: unknown,
77
+ callback: (...any) => void,
78
+ presentUI: (payload?: HookPluginProps["payload"]) => void
79
+ ) => void;
80
+ }
81
+
82
+ export type HookIniObj = {
83
+ hook: HookModule & {
84
+ module: HookModule;
85
+ general: unknown;
86
+ screen_id?: string;
87
+ identifier?: string;
88
+ weight?: number | string;
89
+ };
90
+ hooks: Hook<any>[];
91
+ manager: HookManager;
92
+ };
93
+
94
+ export interface Hook<T extends HookModule = HookModule> {
95
+ manager: HookManager;
96
+ lastHook: boolean;
97
+ state: number;
98
+ module: T;
99
+ screen_id: string;
100
+ identifier: string;
101
+ configuration: T["configuration"];
102
+ setStateAndNotify(
103
+ event: typeof HOOKS_EVENTS[keyof typeof HOOKS_EVENTS],
104
+ opts: {
105
+ error?: typeof Error;
106
+ route?: string;
107
+ hookPlugin: Hook<T>;
108
+ payload: unknown;
109
+ }
110
+ );
111
+ general?: {
112
+ transition_type: typeof HOOKS_EVENTS[keyof typeof HOOKS_EVENTS];
113
+ allow_screen_plugin_presentation: boolean;
114
+ is_flow_blocker: boolean;
115
+ };
116
+ }
@@ -26,7 +26,7 @@ export const riverFocusManager = (function () {
26
26
  /**
27
27
  * Retrieve screen focus data by id
28
28
  *
29
- * @param {String} screenFocusableGroupId Id that was used to save screen data.
29
+ * @param {{screenFocusableGroupId: string}} screenFocusableGroupId Unique Id of the screen from layout.json
30
30
  *
31
31
  */
32
32
  function screenFocusableData({ screenFocusableGroupId }) {
@@ -36,8 +36,9 @@ export const riverFocusManager = (function () {
36
36
  /**
37
37
  * Clear screen data for specific screen
38
38
  *
39
- * @param {String} screenId Unique Id of the screen from layout.json
40
- * @param {boolean} isInsideContainer If this screen a screen picker child
39
+ * @param {{ screenId: string, isInsideContainer: boolean }}
40
+ * screenId Unique Id of the screen from layout.json
41
+ * isInsideContainer If this screen a screen picker child
41
42
  *
42
43
  */
43
44
  function clearScreenData({ screenId, isInsideContainer }) {
@@ -60,9 +61,13 @@ export const riverFocusManager = (function () {
60
61
  /**
61
62
  * Focus on selected items
62
63
  *
63
- * @param {String} screenFocusableGroupId Top group id that was saved as screenn
64
- * @param {String} screenFocusedOnItem focusable item to focus
65
- * @param {object} history navigator history object
64
+ * @param {{
65
+ * screenFocusableGroupId: string,
66
+ * screenFocusedOnItem: () => void,
67
+ * previousAction: QuickBrickNavigationActionType,
68
+ * isDeepLink: boolean }} object contains data for focus
69
+ * - `screenFocusedOnItem` focusable item to focus
70
+ * - `previousActionhistory` navigator history object
66
71
  *
67
72
  */
68
73
  function focusOnSelectedItem({
@@ -115,15 +120,15 @@ export const riverFocusManager = (function () {
115
120
 
116
121
  /**
117
122
  * Create unique key that will be used for save focused group data inside specific screen
118
- *
119
- * @param {String} screenId Unique Id of the screen from layout.json
120
- * @param {boolean} isInsideContainer If this screen a screen picker child
123
+ * @param {{ screenId: string, isInsideContainer: boolean }}
124
+ * screenId Unique Id of the screen from layout.json
125
+ * isInsideContainer If this screen a screen picker child
121
126
  *
122
127
  */
123
128
  function screenFocusableGroupId({ screenId, isInsideContainer }) {
124
- return R.isNil(isInsideContainer)
125
- ? `RiverFocusableGroup-${screenId}`
126
- : `RiverFocusableGroup-${screenId}-isInsideContainer`;
129
+ return `RiverFocusableGroup-${screenId}${
130
+ R.isNil(isInsideContainer) ? "" : "-isInsideContainer"
131
+ }`;
127
132
  }
128
133
 
129
134
  return {
@@ -0,0 +1,50 @@
1
+ export const BUTTON_ACCESSIBILITY_KEYS = {
2
+ play: {
3
+ label: "accessibility_play_label",
4
+ hint: "accessibility_play_hint",
5
+ mini: {
6
+ label: "accessibility_play_mini_label",
7
+ hint: "accessibility_play_mini_hint",
8
+ },
9
+ },
10
+ pause: {
11
+ label: "accessibility_pause_label",
12
+ hint: "accessibility_pause_hint",
13
+ mini: {
14
+ label: "accessibility_pause_mini_label",
15
+ hint: "accessibility_pause_mini_hint",
16
+ },
17
+ },
18
+ rewind: {
19
+ label: "accessibility_rewind_label",
20
+ hint: "accessibility_rewind_hint",
21
+ },
22
+ forward: {
23
+ label: "accessibility_forward_label",
24
+ hint: "accessibility_forward_hint",
25
+ },
26
+ close: {
27
+ label: "accessibility_close_label",
28
+ hint: "accessibility_close_hint",
29
+ mini: {
30
+ label: "accessibility_close_mini_label",
31
+ hint: "accessibility_close_mini_hint",
32
+ },
33
+ },
34
+ maximize: {
35
+ label: "accessibility_maximize_label",
36
+ hint: "accessibility_maximize_hint",
37
+ },
38
+ subtitles: {
39
+ label: "accessibility_subtitle_label",
40
+ hint: "accessibility_subtitle_hint",
41
+ },
42
+ back: {
43
+ label: "accessibility_back_label",
44
+ hint: "accessibility_back_hint",
45
+ },
46
+ fullscreen: {
47
+ label: "accessibility_fullscreen_label",
48
+ hint: "accessibility_fullscreen_hint",
49
+ },
50
+ } as const;
@@ -0,0 +1,31 @@
1
+ import { useEffect, useMemo } from "react";
2
+ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
+ import { AccessibilityManager } from "./index";
4
+
5
+ export const useAccessibilityManager = () => {
6
+ const { remoteConfigurations } = usePickFromState(["remoteConfigurations"]);
7
+ const { localizations } = remoteConfigurations;
8
+
9
+ const accessibilityManager = useMemo(() => {
10
+ return AccessibilityManager.getInstance();
11
+ }, []);
12
+
13
+ useEffect(() => {
14
+ accessibilityManager.updateLocalizations(localizations);
15
+ }, [localizations]);
16
+
17
+ useEffect(() => {
18
+ const subscription = accessibilityManager.getStateAsObservable().subscribe({
19
+ next: () => {
20
+ // TODO: handle accessibility states
21
+ // screenReaderEnabled: false
22
+ // reduceMotionEnabled: false
23
+ // boldTextEnabled: false
24
+ },
25
+ });
26
+
27
+ return () => subscription.unsubscribe();
28
+ }, [accessibilityManager]);
29
+
30
+ return accessibilityManager;
31
+ };
@@ -0,0 +1,150 @@
1
+ import { BehaviorSubject } from "rxjs";
2
+ import { accessibilityManagerLogger as logger } from "./logger";
3
+ import { TTSManager } from "../platform/platformUtils";
4
+ import { getLocalizations } from "../../localizationUtils";
5
+ import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
6
+
7
+ export interface AccessibilityState {
8
+ screenReaderEnabled: boolean;
9
+ reduceMotionEnabled: boolean;
10
+ boldTextEnabled: boolean;
11
+ }
12
+
13
+ export interface AccessibilityProps {
14
+ accessibilityLabel?: string;
15
+ accessibilityHint?: string;
16
+ "aria-label"?: string;
17
+ "aria-description"?: string;
18
+ }
19
+
20
+ export class AccessibilityManager {
21
+ private static _instance: AccessibilityManager | null = null;
22
+ private state$ = new BehaviorSubject<AccessibilityState>({
23
+ screenReaderEnabled: false,
24
+ reduceMotionEnabled: false,
25
+ boldTextEnabled: false,
26
+ });
27
+
28
+ private announcements$ = new BehaviorSubject<{
29
+ message: string;
30
+ localizedMessage?: string | undefined;
31
+ timestamp: number;
32
+ } | null>(null);
33
+
34
+ private ttsManager = TTSManager.getInstance();
35
+ private localizations: { [key: string]: string };
36
+
37
+ private constructor(localizations?: { [key: string]: string }) {
38
+ if (localizations) {
39
+ this.localizations = getLocalizations({ localizations });
40
+ }
41
+ }
42
+
43
+ public static getInstance(): AccessibilityManager {
44
+ if (!AccessibilityManager._instance) {
45
+ AccessibilityManager._instance = new AccessibilityManager();
46
+ }
47
+
48
+ return AccessibilityManager._instance;
49
+ }
50
+
51
+ public updateLocalizations(localizations: { [key: string]: string }) {
52
+ this.localizations = getLocalizations({ localizations });
53
+ }
54
+
55
+ public getState(): AccessibilityState {
56
+ return this.state$.getValue();
57
+ }
58
+
59
+ public getStateAsObservable() {
60
+ return this.state$.asObservable();
61
+ }
62
+
63
+ /**
64
+ * text you want to be read, if you want to use localized text pass keyOfLocalizedText instead
65
+ * keyOfLocalizedText is the key to the localized text
66
+ */
67
+ public readText({
68
+ text,
69
+ keyOfLocalizedText,
70
+ }: {
71
+ text: string;
72
+ keyOfLocalizedText?: string;
73
+ }) {
74
+ logger.debug("Reading text", { text, keyOfLocalizedText });
75
+
76
+ if (keyOfLocalizedText) {
77
+ if (!this.localizations) {
78
+ logger.error(
79
+ "Attempting to use localized key without initialized localizations"
80
+ );
81
+
82
+ return;
83
+ }
84
+
85
+ const localizedMessage = this.getLocalizedMessage(keyOfLocalizedText);
86
+
87
+ if (!localizedMessage) {
88
+ logger.warn(`No localization found for key: ${keyOfLocalizedText}`);
89
+
90
+ return;
91
+ }
92
+
93
+ text = localizedMessage;
94
+ }
95
+
96
+ if (this.ttsManager) {
97
+ this.ttsManager.readText(text);
98
+ }
99
+
100
+ this.announcements$.next({
101
+ message: text,
102
+ localizedMessage: keyOfLocalizedText ? text : undefined,
103
+ timestamp: Date.now(),
104
+ });
105
+ }
106
+
107
+ public getButtonAccessibilityProps(buttonName: string): AccessibilityProps {
108
+ const buttonConfig = BUTTON_ACCESSIBILITY_KEYS[buttonName];
109
+
110
+ if (!buttonConfig) {
111
+ return {
112
+ accessibilityLabel: buttonName,
113
+ accessibilityHint: `Press button to perform action on ${buttonName}`,
114
+ "aria-label": buttonName,
115
+ "aria-description": `Press button to perform action on ${buttonName}`,
116
+ };
117
+ }
118
+
119
+ const labelKey = buttonConfig.label;
120
+ const hintKey = buttonConfig.hint;
121
+
122
+ const label = this.getLocalizedMessage(labelKey) || buttonName;
123
+
124
+ const hint =
125
+ this.getLocalizedMessage(hintKey) ||
126
+ `Press button to perform action on ${buttonName}`;
127
+
128
+ return {
129
+ accessibilityLabel: label,
130
+ accessibilityHint: hint,
131
+ "aria-label": label,
132
+ "aria-description": hint,
133
+ };
134
+ }
135
+
136
+ public getLocalizedMessage(key: string): string | void {
137
+ if (!key) return;
138
+
139
+ if (!this.localizations) {
140
+ logger.error(
141
+ "Attempting to use localized key without initialized localizations",
142
+ { key }
143
+ );
144
+
145
+ return;
146
+ }
147
+
148
+ return this.localizations[key];
149
+ }
150
+ }
@@ -0,0 +1,5 @@
1
+ import { utilsLogger } from "../../logger";
2
+
3
+ export const accessibilityManagerLogger = utilsLogger.addSubsystem(
4
+ "accessibilityManager"
5
+ );
@@ -3,9 +3,7 @@
3
3
  exports[`focusManager should be defined 1`] = `
4
4
  Object {
5
5
  "blur": [Function],
6
- "disableAutomaticFocus": [Function],
7
6
  "disableFocus": [Function],
8
- "enableAutomaticFocus": [Function],
9
7
  "enableFocus": [Function],
10
8
  "focusableTree": Tree {
11
9
  "loadingCounter": 0,
@@ -23,6 +21,7 @@ Object {
23
21
  "getGroupById": [Function],
24
22
  "getGroupRootById": [Function],
25
23
  "invokeHandler": [Function],
24
+ "isCurrentFocusOnTheTopScreen": [Function],
26
25
  "isFocusDisabled": [Function],
27
26
  "isGroupItemFocused": [Function],
28
27
  "longPress": [Function],
@@ -30,11 +29,11 @@ Object {
30
29
  "on": [Function],
31
30
  "press": [Function],
32
31
  "pressOut": [Function],
32
+ "recoverFocus": [Function],
33
33
  "register": [Function],
34
34
  "removeHandler": [Function],
35
35
  "setFocus": [Function],
36
36
  "setInitialFocus": [Function],
37
- "setupInitialFocus": [Function],
38
37
  "unregister": [Function],
39
38
  }
40
39
  `;
@@ -14,10 +14,8 @@ describe("focusManager", () => {
14
14
  expect(focusManager).toMatchSnapshot();
15
15
  });
16
16
 
17
- it("enableAutomaticFocus should not block setting focus", () => {
17
+ it("manages to land initial focus", () => {
18
18
  const mockSetFocus = jest.fn();
19
- focusManager.setupInitialFocus("1", true);
20
- focusManager.enableAutomaticFocus();
21
19
 
22
20
  focusManager.register({
23
21
  id: "1",
@@ -31,31 +29,13 @@ describe("focusManager", () => {
31
29
  },
32
30
  });
33
31
 
32
+ const { success } = focusManager.setInitialFocus();
33
+
34
+ expect(success).toBe(true);
34
35
  expect(mockSetFocus).toBeCalledTimes(1);
35
36
  expect(mockSetFocus).toBeCalledWith(null);
36
37
  });
37
38
 
38
- it("enableAutomaticFocus should block setting focus", () => {
39
- const mockSetFocus = jest.fn();
40
- focusManager.setupInitialFocus("1", true);
41
- focusManager.disableAutomaticFocus();
42
-
43
- focusManager.register({
44
- id: "1",
45
- component: {
46
- setFocus: mockSetFocus,
47
- willReceiveFocus: function () {},
48
- isMounted: function () {
49
- return true;
50
- },
51
- props: { groupId: "121" },
52
- },
53
- });
54
-
55
- expect(mockSetFocus).toBeCalledTimes(0);
56
- expect(mockSetFocus).not.toBeCalledWith(null);
57
- });
58
-
59
39
  describe("register", () => {});
60
40
  describe("unregister", () => {});
61
41
  describe("find", () => {});
@@ -18,7 +18,6 @@ describe("focusManager", () => {
18
18
  "on",
19
19
  "invokeHandler",
20
20
  "removeHandler",
21
- "setupInitialFocus",
22
21
  "longPress",
23
22
  "pressOut",
24
23
  "enableFocus",
@@ -27,10 +26,10 @@ describe("focusManager", () => {
27
26
  "isFocusDisabled",
28
27
  "getCurrentFocusNode",
29
28
  "focusableTree",
30
- "disableAutomaticFocus",
31
- "enableAutomaticFocus",
32
29
  "getGroupRootById",
33
30
  "isGroupItemFocused",
31
+ "recoverFocus",
32
+ "isCurrentFocusOnTheTopScreen",
34
33
  ];
35
34
 
36
35
  expectedMethods.forEach((method) => {