@applicaster/zapp-react-native-ui-components 12.0.0-rc.26 → 12.0.0-rc.28

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 (30) hide show
  1. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +1 -41
  2. package/Components/Layout/TV/__tests__/index.test.tsx +0 -21
  3. package/Components/Layout/TV/index.tsx +20 -36
  4. package/Components/MasterCell/utils/index.ts +2 -2
  5. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  6. package/Components/ModalComponent/Button/Item.tsx +82 -0
  7. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  8. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  9. package/Components/ModalComponent/Button/assets.ts +4 -0
  10. package/Components/ModalComponent/Button/index.tsx +111 -0
  11. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  12. package/Components/ModalComponent/Header/Title.tsx +70 -0
  13. package/Components/ModalComponent/Header/assets.ts +4 -0
  14. package/Components/ModalComponent/Header/index.tsx +71 -0
  15. package/Components/ModalComponent/Header/utils.ts +79 -0
  16. package/Components/ModalComponent/index.tsx +38 -0
  17. package/Components/ModalComponent/utils.ts +126 -0
  18. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  19. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  20. package/Components/RouteManager/index.tsx +4 -2
  21. package/Components/Screen/__tests__/Screen.test.tsx +83 -69
  22. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +10 -6
  23. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  24. package/Components/Screen/index.tsx +84 -44
  25. package/Components/Screen/navigationHandler.ts +0 -82
  26. package/Components/VideoModal/PlayerDetails.tsx +3 -0
  27. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
  28. package/Components/index.js +2 -0
  29. package/Contexts/ScreenContext/index.tsx +1 -1
  30. package/package.json +5 -5
@@ -6,6 +6,14 @@ const Mocked_RouteManager = jest.fn((props) => (
6
6
  <View testID="routeManager" {...props} />
7
7
  ));
8
8
 
9
+ const mock_navBarVisibleFlag = true;
10
+
11
+ const mockIsNavBarVisible = jest.fn(() => mock_navBarVisibleFlag);
12
+
13
+ jest.mock("react-native-safe-area-context", () => ({
14
+ useSafeAreaInsets: () => ({ top: 44 }),
15
+ }));
16
+
9
17
  jest.mock("../../RouteManager", () => ({
10
18
  RouteManager: Mocked_RouteManager,
11
19
  }));
@@ -23,47 +31,42 @@ jest.mock(
23
31
  })
24
32
  );
25
33
 
26
- let mock_navBarVisibleFlag = true;
27
-
28
- jest.mock("../navigationHandler.ts", () => ({
29
- isNavBarVisible: jest.fn(() => mock_navBarVisibleFlag),
30
- }));
31
-
32
34
  jest.mock("@applicaster/zapp-react-native-utils/analyticsUtils", () => ({
33
35
  useAnalytics: jest.fn(() => ({
34
36
  sendScreenEvent: jest.fn(),
35
37
  })),
36
38
  }));
37
39
 
38
- const {
39
- allowedOrientationsForScreen,
40
- getOrientation,
41
- useGetScreenOrientation,
42
- } = require("@applicaster/zapp-react-native-utils/appUtils/orientationHelper");
43
-
44
40
  jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
45
41
  useTheme: jest.fn(() => ({
46
42
  app_background_color: "blue",
47
43
  })),
48
44
  }));
49
45
 
46
+ const NavBar = jest.fn((props) => <View testID="navBar" {...props} />);
47
+
48
+ jest.mock(
49
+ "@applicaster/zapp-react-native-app/App/Layout/layoutHelpers",
50
+ () => ({
51
+ getNavigationPluginModule: () => NavBar,
52
+ })
53
+ );
54
+
50
55
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/screen", () => ({
51
- useCurrentScreenData: jest.fn(() => ({
56
+ ...(jest.requireActual(
57
+ "@applicaster/zapp-react-native-utils/reactHooks/screen"
58
+ ) as any),
59
+ useScreenData: jest.fn(() => ({
52
60
  id: "testId",
61
+ navigations: [{ id: "testId", category: "nav_bar" }],
53
62
  })),
54
- useNavbarState: jest.fn(() => ({
55
- visible: jest.fn(() => mock_navBarVisibleFlag),
63
+ useCurrentScreenData: jest.fn(() => ({
64
+ id: "testId",
56
65
  })),
57
66
  }));
58
67
 
59
- const { isNavBarVisible } = require("../navigationHandler");
60
-
61
- const NavBar = jest.fn((props) => <View testID="navBar" {...props} />);
62
- const navigator = {};
63
- const navBarProps = { nav_items: [] };
64
- const screenData = {};
65
-
66
68
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
69
+ isNavBarVisible: mockIsNavBarVisible,
67
70
  useRoute: jest.fn(() => ({
68
71
  pathname: "/river/testId",
69
72
  })),
@@ -89,9 +92,26 @@ jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
89
92
  }),
90
93
  }));
91
94
 
95
+ const {
96
+ ORIENTATIONS,
97
+ } = require("@applicaster/zapp-react-native-utils/appUtils/orientationHelper");
98
+
99
+ const {
100
+ useCurrentScreenData,
101
+ } = require("@applicaster/zapp-react-native-utils/reactHooks/screen");
102
+
103
+ const {
104
+ allowedOrientationsForScreen,
105
+ getOrientation,
106
+ useGetScreenOrientation,
107
+ } = require("@applicaster/zapp-react-native-utils/appUtils/orientationHelper");
108
+
109
+ const navigator = {};
110
+ const navBarProps = { nav_items: [] };
111
+ const screenData = {};
112
+
92
113
  const screenProps = {
93
114
  pathname: "/foo/path",
94
- NavBar,
95
115
  navigator,
96
116
  navBarProps,
97
117
  screenData,
@@ -105,7 +125,6 @@ describe("<Screen Component />", () => {
105
125
  beforeEach(() => {
106
126
  allowedOrientationsForScreen.mockClear();
107
127
  getOrientation.mockClear();
108
- isNavBarVisible.mockClear();
109
128
  useGetScreenOrientation.mockClear();
110
129
  });
111
130
 
@@ -121,14 +140,9 @@ describe("<Screen Component />", () => {
121
140
 
122
141
  describe("when the navbar should be hidden", () => {
123
142
  beforeEach(() => {
124
- mock_navBarVisibleFlag = false;
125
143
  wrapper = create(<Screen {...screenProps} />);
126
144
  });
127
145
 
128
- afterEach(() => {
129
- mock_navBarVisibleFlag = true;
130
- });
131
-
132
146
  it("renders correctly", () => {
133
147
  act(() => {
134
148
  wrapper = create(<Screen {...screenProps} />);
@@ -138,44 +152,44 @@ describe("<Screen Component />", () => {
138
152
  });
139
153
  });
140
154
 
141
- // it("invokes the orientation hook when the route changes", () => {
142
- // act(() => {
143
- // wrapper = create(<Screen {...screenProps} />);
144
- // });
145
-
146
- // // @ts-ignore
147
- // useCurrentScreenData.mockReturnValue({
148
- // id: "player-testId",
149
- // general: { screen_orientation: ORIENTATIONS.landscapeSensor },
150
- // plugin_type: "player",
151
- // });
152
-
153
- // act(() => {
154
- // wrapper.update(
155
- // <Screen
156
- // {...screenProps}
157
- // pathname="/playable"
158
- // screenData={{
159
- // id: "player-testId",
160
- // general: { screen_orientation: ORIENTATIONS.landscapeSensor },
161
- // plugin_type: "player",
162
- // }}
163
- // />
164
- // );
165
- // });
166
-
167
- // useCurrentScreenData.mockReturnValue({
168
- // id: "player-testId",
169
- // general: { screen_orientation: ORIENTATIONS.landscapeSensor },
170
- // });
171
-
172
- // act(() => {
173
- // wrapper.update(<Screen {...screenProps} />);
174
- // });
175
-
176
- // expect(allowedOrientationsForScreen).toHaveBeenNthCalledWith(
177
- // 1,
178
- // ORIENTATIONS.landscapeSensor
179
- // );
180
- // });
155
+ it("invokes the orientation hook when the route changes", () => {
156
+ act(() => {
157
+ wrapper = create(<Screen {...screenProps} />);
158
+ });
159
+
160
+ // @ts-ignore
161
+ useCurrentScreenData.mockReturnValue({
162
+ id: "player-testId",
163
+ general: { screen_orientation: ORIENTATIONS.landscapeSensor },
164
+ plugin_type: "player",
165
+ });
166
+
167
+ act(() => {
168
+ wrapper.update(
169
+ <Screen
170
+ {...screenProps}
171
+ pathname="/playable"
172
+ screenData={{
173
+ id: "player-testId",
174
+ general: { screen_orientation: ORIENTATIONS.landscapeSensor },
175
+ plugin_type: "player",
176
+ }}
177
+ />
178
+ );
179
+ });
180
+
181
+ useCurrentScreenData.mockReturnValue({
182
+ id: "player-testId",
183
+ general: { screen_orientation: ORIENTATIONS.landscapeSensor },
184
+ });
185
+
186
+ act(() => {
187
+ wrapper.update(<Screen {...screenProps} />);
188
+ });
189
+
190
+ expect(allowedOrientationsForScreen).toHaveBeenNthCalledWith(
191
+ 1,
192
+ ORIENTATIONS.landscapeSensor
193
+ );
194
+ });
181
195
  });
@@ -6,17 +6,19 @@ exports[`<Screen Component /> when the navbar should be hidden renders correctly
6
6
  Object {
7
7
  "backgroundColor": "blue",
8
8
  "flex": 1,
9
+ "paddingTop": 0,
9
10
  }
10
11
  }
11
12
  >
12
13
  <View
13
- nav_items={Array []}
14
+ id="/river/testId"
15
+ selected="testId"
14
16
  testID="navBar"
17
+ title=""
15
18
  />
16
19
  <View>
17
20
  <View
18
- pathname="/foo/path"
19
- screenData={Object {}}
21
+ pathname="/river/testId"
20
22
  testID="routeManager"
21
23
  />
22
24
  </View>
@@ -29,17 +31,19 @@ exports[`<Screen Component /> when the navbar should show renders correctly 1`]
29
31
  Object {
30
32
  "backgroundColor": "blue",
31
33
  "flex": 1,
34
+ "paddingTop": 0,
32
35
  }
33
36
  }
34
37
  >
35
38
  <View
36
- nav_items={Array []}
39
+ id="/river/testId"
40
+ selected="testId"
37
41
  testID="navBar"
42
+ title=""
38
43
  />
39
44
  <View>
40
45
  <View
41
- pathname="/foo/path"
42
- screenData={Object {}}
46
+ pathname="/river/testId"
43
47
  testID="routeManager"
44
48
  />
45
49
  </View>
@@ -1,183 +1,6 @@
1
- import { isNavBarVisible, isMenuVisible } from "../navigationHandler";
1
+ import { isMenuVisible } from "../navigationHandler";
2
2
 
3
3
  describe("NavigationHandler", () => {
4
- describe("isNavBarVisible", () => {
5
- it("returns false when the route is a player route", () => {
6
- const navBarVisible = isNavBarVisible(
7
- "/playable/some_vod_item",
8
- {},
9
- undefined,
10
- false
11
- );
12
-
13
- expect(navBarVisible).toBe(false);
14
- });
15
-
16
- it("returns false when the next screen is the QB search screen", () => {
17
- const navBarVisible = isNavBarVisible(
18
- "/river/A1234",
19
- {
20
- type: "qb_search_screen",
21
- },
22
- undefined,
23
- false
24
- );
25
-
26
- expect(navBarVisible).toBe(false);
27
- });
28
-
29
- describe("when screen is a hook", () => {
30
- it("returns true if the `showNavBar` flag is set to true", () => {
31
- const navBarVisible = isNavBarVisible(
32
- "",
33
- {
34
- hookPlugin: {
35
- module: {
36
- showNavBar: true,
37
- },
38
- },
39
- },
40
- undefined,
41
- false
42
- );
43
-
44
- expect(navBarVisible).toBe(true);
45
- });
46
-
47
- it("returns true if presentFullScreen flag is set to false", () => {
48
- const navBarVisible = isNavBarVisible(
49
- "",
50
- {
51
- hookPlugin: {
52
- module: {
53
- presentFullScreen: false,
54
- },
55
- },
56
- },
57
- undefined,
58
- false
59
- );
60
-
61
- expect(navBarVisible).toBe(true);
62
- });
63
-
64
- it("returns false if presentFullScreen flag is set to true", () => {
65
- const navBarVisible = isNavBarVisible(
66
- "",
67
- {
68
- hookPlugin: {
69
- module: {
70
- presentFullScreen: true,
71
- },
72
- },
73
- },
74
- undefined,
75
- false
76
- );
77
-
78
- expect(navBarVisible).toBe(false);
79
- });
80
- });
81
-
82
- it("returns false if the screen's general settings allow screen presentation", () => {
83
- const navBarVisible = isNavBarVisible(
84
- "",
85
- {
86
- general: {
87
- allow_screen_plugin_presentation: true,
88
- },
89
- },
90
- undefined,
91
- false
92
- );
93
-
94
- expect(navBarVisible).toBe(false);
95
- });
96
-
97
- it("returns false if the screen's general settings hide app nav bar", () => {
98
- const navBarVisible = isNavBarVisible(
99
- "",
100
- {
101
- general: {
102
- hide_app_nav_bar: true,
103
- },
104
- },
105
- undefined,
106
- false
107
- );
108
-
109
- expect(navBarVisible).toBe(false);
110
- });
111
-
112
- it("returns false if it's secondary nav bar and hide_secondary_level_menu is true", () => {
113
- const navBarVisible = isNavBarVisible(
114
- "",
115
- {
116
- navigations: [
117
- {
118
- styles: {
119
- hide_secondary_level_menu: true,
120
- },
121
- },
122
- ],
123
- },
124
- undefined,
125
- true
126
- );
127
-
128
- expect(navBarVisible).toBe(false);
129
- });
130
-
131
- it("returns true if it's secondary nav bar and hide_secondary_level_menu is false", () => {
132
- const navBarVisible = isNavBarVisible(
133
- "",
134
- {
135
- navigations: [
136
- {
137
- styles: {
138
- hide_secondary_level_menu: false,
139
- },
140
- },
141
- ],
142
- },
143
- undefined,
144
- true
145
- );
146
-
147
- expect(navBarVisible).toBe(true);
148
- });
149
-
150
- it("returns true if it's first level menu and hide_secondary_level_menu is true", () => {
151
- const navBarVisible = isNavBarVisible(
152
- "",
153
- {
154
- navigations: [
155
- {
156
- styles: {
157
- hide_secondary_level_menu: false,
158
- },
159
- },
160
- ],
161
- },
162
- undefined,
163
- false
164
- );
165
-
166
- expect(navBarVisible).toBe(true);
167
- });
168
-
169
- it("returns true otherwise", () => {
170
- const navBarVisible = isNavBarVisible(
171
- "",
172
- { navigations: [] },
173
- undefined,
174
- false
175
- );
176
-
177
- expect(navBarVisible).toBe(true);
178
- });
179
- });
180
-
181
4
  describe("isMenuVisible", () => {
182
5
  it("returns false when the route is a player route", () => {
183
6
  const menuVisible = isMenuVisible("/playable/some_vod_item", {});
@@ -1,36 +1,26 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
- import React, { useMemo } from "react";
2
+ import React from "react";
3
3
  import * as R from "ramda";
4
4
  import { View } from "react-native";
5
- import { RouteManager } from "../RouteManager";
6
- import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
7
- import { useScreenOrientationHandler } from "./orientationHandler";
8
- import { useScreenConfiguration } from "../River/useScreenConfiguration";
9
- import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
10
5
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
11
- import { ScreenContextProvider } from "../../Contexts/ScreenContext";
12
6
 
13
- type Props = {
14
- pathname: string;
15
- screenData: Record<string, any>;
16
- NavBar: ZappPlugin;
17
- Menu: ZappPlugin;
18
- navBarProps: Record<string, any>;
19
- isNavBarVisible: boolean;
20
- menuProps: {
21
- setToggleMenu: () => void;
22
- toggleMenu: () => void;
23
- openMenu: () => void;
24
- setOpenMenu: () => void;
25
- closeMenu: () => void;
26
- setCloseMenu: () => void;
27
- dimensions: { window: number };
28
- navigator: ZappNavigationProps;
29
- bottomTabBarHeight: number;
30
- isRTL: boolean;
31
- category: string;
32
- } & QuickBrickAppNavigator;
33
- };
7
+ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
8
+ import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
9
+ import { getNavigationPropsV2 } from "@applicaster/zapp-react-native-utils/navigationUtils";
10
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
11
+ import {
12
+ useDimensions,
13
+ useRoute,
14
+ useCurrentScreenData,
15
+ useNavbarState,
16
+ useScreenData,
17
+ } from "@applicaster/zapp-react-native-utils/reactHooks";
18
+ import { getNavigationPluginModule } from "@applicaster/zapp-react-native-app/App/Layout/layoutHelpers";
19
+
20
+ import { ScreenContextProvider } from "../../Contexts/ScreenContext";
21
+ import { RouteManager } from "../RouteManager";
22
+ import { useScreenConfiguration } from "../River/useScreenConfiguration";
23
+ import { useScreenOrientationHandler } from "./orientationHandler";
34
24
 
35
25
  function colorIsNotTransparent(color) {
36
26
  const layers = R.compose(
@@ -49,25 +39,68 @@ function isValidColor(string) {
49
39
  return string && string !== "transparent" && colorIsNotTransparent(string);
50
40
  }
51
41
 
52
- export function Screen(props: Props) {
53
- const { pathname, screenData, NavBar } = props;
42
+ type Props = {
43
+ pathname: string;
44
+ screenData: unknown;
45
+ setToggleMenu: () => void;
46
+ setCloseMenu: () => void;
47
+ };
48
+
49
+ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
50
+ const theme = useTheme<BaseThemePropertiesMobile>();
54
51
  const { plugins } = usePickFromState(["plugins"]);
55
52
 
56
- const offlinePlugin = useMemo(
53
+ // Gets the data for the current screen configuration
54
+ const currentScreenData = useCurrentScreenData();
55
+ const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
56
+ const insets = useSafeAreaInsets();
57
+
58
+ const { width: screenWidth } = useDimensions("screen", {
59
+ fullDimensions: true,
60
+ });
61
+
62
+ const routeData = useRoute();
63
+
64
+ const currentRiver = useScreenData(
65
+ (routeData.screenData as ZappRiver)?.targetScreen
66
+ ? (routeData.screenData as ZappRiver)?.targetScreen.id
67
+ : (routeData.screenData as ZappRiver)?.screen_id
68
+ );
69
+
70
+ const { title } = useNavbarState();
71
+
72
+ const navBarProps = React.useMemo(
73
+ () => ({
74
+ ...getNavigationPropsV2({
75
+ currentRiver,
76
+ title,
77
+ category: "nav_bar",
78
+ }),
79
+ setToggleMenu,
80
+ setCloseMenu,
81
+ }),
82
+ [currentRiver, setCloseMenu, setToggleMenu]
83
+ );
84
+
85
+ const NavBar = React.useMemo(
57
86
  () =>
58
- R.compose(
59
- R.prop("module"),
60
- R.find(R.propEq("identifier", "offline-experience"))
61
- )(plugins),
62
- [plugins]
87
+ getNavigationPluginModule(
88
+ "nav_bar",
89
+ currentRiver,
90
+ plugins
91
+ ) as React.ComponentType<MobileNavBarPluginProps>,
92
+ []
63
93
  );
64
94
 
65
- const { OfflineFallbackScreen } = offlinePlugin;
95
+ const { screenData, pathname } = routeData;
66
96
 
67
- // Gets the data for the current screen configuration
68
- const currentScreenData = useCurrentScreenData();
69
- const theme = useTheme();
70
- const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
97
+ const offlinePlugin = getComponentModule({
98
+ plugins,
99
+ components: {},
100
+ componentType: "offline-experience",
101
+ });
102
+
103
+ const { OfflineFallbackScreen } = offlinePlugin;
71
104
 
72
105
  const style = React.useMemo(
73
106
  () => ({
@@ -75,21 +108,28 @@ export function Screen(props: Props) {
75
108
  backgroundColor: isValidColor(backgroundColor)
76
109
  ? backgroundColor
77
110
  : theme.app_background_color,
111
+ paddingTop: 0,
112
+ // paddingBottom: insets.bottom, // Should be applied directly by UI plugin
113
+ // paddingLeft: insets.left, // Should be applied directly by UI plugin
114
+ // paddingRight: insets.right, // Should be applied directly by UI plugin
78
115
  }),
79
- [theme.app_background_color, backgroundColor]
116
+ [insets, screenWidth, theme.app_background_color, backgroundColor]
80
117
  );
81
118
 
82
119
  const targetScreenData =
83
- currentScreenData || screenData?.targetScreen || screenData;
120
+ currentScreenData || (screenData as any)?.targetScreen || screenData;
84
121
 
85
122
  useScreenOrientationHandler({ screenData: targetScreenData });
86
123
 
87
124
  return (
88
125
  <ScreenContextProvider pathname={pathname}>
89
126
  <View style={style}>
90
- <NavBar key={pathname} {...props.navBarProps} />
127
+ <NavBar
128
+ {...{ ...(navBarProps as MobileNavBarPluginProps), id: pathname }}
129
+ />
91
130
 
92
131
  <OfflineFallbackScreen screenData={screenData}>
132
+ {/* @TODO RouteManager doesn't use props, can they be removed ? */}
93
133
  <RouteManager pathname={pathname} screenData={screenData} />
94
134
  </OfflineFallbackScreen>
95
135
  </View>
@@ -1,85 +1,3 @@
1
- import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
2
-
3
- /**
4
- * This function helps to decide wether the navbar should be presented on the screen
5
- * based on route and / or screen Data
6
- *
7
- * Currently the scenarios include
8
- * - players => false
9
- * - search screen plugin => false
10
- * - hooks with `showNavBar: true` or `presentFullScreen` not set to true, defaults to no navbar for hook screens
11
- * - screens with `allow_screen_plugin_presentation` in general property => false
12
- *
13
- * @param {String} route current route of the screen
14
- * @param {Object} screenData payload associated with the currently presented screen
15
- * @returns {Boolean}
16
- */
17
- export function isNavBarVisible(
18
- route,
19
- screenData,
20
- showNavBar,
21
- canGoBack,
22
- videoModalState: QuickBrickVideoModalState | null = null
23
- ) {
24
- /* screenData is not actual navigator.data
25
- * or navigator.screenData,
26
- * but navigator.data.screen */
27
- if (route.includes("playable")) {
28
- return false;
29
- }
30
-
31
- if (
32
- videoModalState?.mode === "FULLSCREEN" &&
33
- videoModalState?.visible === true
34
- ) {
35
- return false;
36
- }
37
-
38
- if (screenData?.type === "qb_search_screen" && !isTV()) {
39
- return false;
40
- }
41
-
42
- /* Match if screen is Hook */
43
- if (route.startsWith("/hooks/")) {
44
- const module = screenData?.module;
45
-
46
- if (module?.presentFullScreen) {
47
- return false;
48
- }
49
-
50
- return module?.showNavBar ?? false;
51
- }
52
-
53
- if (screenData?.hookPlugin) {
54
- const hookPlugin = screenData?.hookPlugin?.module;
55
-
56
- return (
57
- hookPlugin?.showNavBar || hookPlugin?.presentFullScreen !== true || false
58
- );
59
- }
60
-
61
- if (
62
- screenData?.general?.allow_screen_plugin_presentation ||
63
- screenData?.general?.hide_app_nav_bar
64
- ) {
65
- return false;
66
- }
67
-
68
- const hideSecondaryLevel = screenData?.navigations?.some(
69
- (navigation) => navigation.styles?.hide_secondary_level_menu
70
- );
71
-
72
- if (canGoBack && hideSecondaryLevel) {
73
- return false;
74
- }
75
-
76
- if (typeof showNavBar === "boolean" && !showNavBar) {
77
- return false;
78
- }
79
-
80
- return true;
81
- }
82
-
83
1
  /**
84
2
  * This function helps to decide wether the menu should be presented on the screen
85
3
  * based on route and / or screen Data