@applicaster/zapp-react-dom-app 15.0.0-rc.5 → 15.0.0-rc.7

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.
@@ -157,4 +157,27 @@ describe("withBackToTopActionHOC", () => {
157
157
  render(<Wrapped />);
158
158
  expect(receivedProps.backToTopAction()).toBe("GO_BACK");
159
159
  });
160
+
161
+ it("returns FORCE_GO_BACK in hook case", () => {
162
+ expect.assertions(1);
163
+
164
+ (useCurrentScreenIsRoot as jest.Mock).mockReturnValue(false);
165
+ (useCurrentScreenIsHome as jest.Mock).mockReturnValue(false);
166
+ (useCurrentScreenIsTabs as jest.Mock).mockReturnValue(false);
167
+
168
+ (useNavigation as jest.Mock).mockReturnValue({
169
+ startUpHooks: [],
170
+ currentRoute: "/hooks/some_route",
171
+ });
172
+
173
+ (focusManager.isFocusOnMenu as jest.Mock).mockReturnValue(false);
174
+ (focusManager.isFocusOnContent as jest.Mock).mockReturnValue(false);
175
+
176
+ (focusManager.isTabsScreenContentFocused as jest.Mock).mockReturnValue(
177
+ false
178
+ );
179
+
180
+ render(<Wrapped />);
181
+ expect(receivedProps.backToTopAction()).toBe("FORCE_GO_BACK");
182
+ });
160
183
  });
@@ -17,6 +17,7 @@ export type BACK_TO_TOP_ACTION =
17
17
  | "GO_HOME"
18
18
  | "GO_BACK"
19
19
  | "FOCUS_ON_SELECTED_TOP_MENU_ITEM"
20
+ | "FORCE_GO_BACK"
20
21
  | "FOCUS_ON_SELECTED_TAB_ITEM";
21
22
 
22
23
  export type BackToTopAction = () => BACK_TO_TOP_ACTION;
@@ -31,6 +32,8 @@ export function withBackToTopActionHOC(Component) {
31
32
 
32
33
  const isStartUpHook = isFilledArray(navigator.startUpHooks);
33
34
 
35
+ const isHook = navigator.currentRoute?.includes("hook");
36
+
34
37
  const emitFocusOnSelectedTab = useSubscriberFor(
35
38
  QBUIComponentEvents.focusOnSelectedTab
36
39
  );
@@ -60,9 +63,13 @@ export function withBackToTopActionHOC(Component) {
60
63
  return "FOCUS_ON_SELECTED_TOP_MENU_ITEM";
61
64
  }
62
65
 
66
+ if (isHook) {
67
+ return "FORCE_GO_BACK";
68
+ }
69
+
63
70
  // default
64
71
  return "GO_BACK";
65
- }, [isHome, isRoot, isTabsScreen, isStartUpHook]);
72
+ }, [isHome, isRoot, isTabsScreen, isStartUpHook, isHook]);
66
73
 
67
74
  return (
68
75
  <Component
@@ -461,6 +461,15 @@ class InteractionManagerClass extends React.Component<Props, State> {
461
461
  }
462
462
  }
463
463
 
464
+ if (action === "FORCE_GO_BACK") {
465
+ log_info(action);
466
+
467
+ const fallbackToHome = false;
468
+ const fromHook = true;
469
+
470
+ navigator.goBack(fallbackToHome, fromHook);
471
+ }
472
+
464
473
  break;
465
474
  case DISPLAY_STATES.PLAYER:
466
475
  if (isDialogVisible) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "15.0.0-rc.5",
3
+ "version": "15.0.0-rc.7",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "15.0.0-rc.5",
26
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.5",
27
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.5",
28
- "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.5",
29
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.5",
25
+ "@applicaster/zapp-react-dom-ui-components": "15.0.0-rc.7",
26
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.7",
27
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.7",
28
+ "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.7",
29
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.7",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "typeface-montserrat": "^0.0.54",
32
32
  "video.js": "7.14.3",