@applicaster/zapp-react-native-app 15.0.0-rc.44 → 15.0.0-rc.46

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.
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
2
  import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
3
+ import {
4
+ getMenuPlugin,
5
+ isBottomTabVisible,
6
+ SIDE_MENU_PLUGIN_ID,
7
+ } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
3
8
 
4
9
  const mockUseMenuToggleContext = jest.fn(() => ({
5
10
  toggleMenu: jest.fn(),
@@ -12,12 +17,14 @@ const mockUseMenuToggleContext = jest.fn(() => ({
12
17
 
13
18
  jest.mock("../layoutHelpers", () => {
14
19
  const { View } = jest.requireActual("react-native");
20
+ const { isVideoOverlayVisible } = jest.requireActual("../layoutHelpers");
15
21
 
16
22
  return {
17
23
  // eslint-disable-next-line react/display-name
18
24
  getNavigationPluginModule: () => (props) => (
19
25
  <View testID="menu" {...props} />
20
26
  ),
27
+ isVideoOverlayVisible,
21
28
  };
22
29
  });
23
30
 
@@ -110,6 +117,9 @@ jest.mock(
110
117
  "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler",
111
118
  () => ({
112
119
  isMenuVisible: jest.fn(() => true),
120
+ isBottomTabVisible: jest.fn(() => true),
121
+ getMenuPlugin: jest.fn(() => ({ identifier: "test-plugin" })),
122
+ SIDE_MENU_PLUGIN_ID: "quick_brick_side_menu",
113
123
  })
114
124
  );
115
125
 
@@ -237,4 +247,60 @@ describe("Layout", () => {
237
247
  opacity: 1,
238
248
  });
239
249
  });
250
+
251
+ it("should render menu when Side Menu is active and VideoModal is FULLSCREEN", () => {
252
+ (getMenuPlugin as jest.Mock).mockReturnValue({
253
+ identifier: SIDE_MENU_PLUGIN_ID,
254
+ });
255
+
256
+ mockUseNavigation.mockReturnValue({
257
+ activeRiver: { navigations: [] },
258
+ videoModalState: { visible: true, mode: "FULLSCREEN" },
259
+ isVideoModalDocked: false,
260
+ currentRoute: "home",
261
+ data: {},
262
+ });
263
+
264
+ const { queryByTestId } = renderWithProviders(<Layout />);
265
+ expect(queryByTestId("menu")).toBeTruthy();
266
+ });
267
+
268
+ it("should NOT render menu when Bottom Tabs are active and VideoModal is FULLSCREEN", () => {
269
+ (getMenuPlugin as jest.Mock).mockReturnValue({
270
+ identifier: "quick-brick-bottom-tabs",
271
+ });
272
+
273
+ mockUseNavigation.mockReturnValue({
274
+ activeRiver: { navigations: [] },
275
+ videoModalState: { visible: true, mode: "FULLSCREEN" },
276
+ isVideoModalDocked: false,
277
+ currentRoute: "home",
278
+ data: {},
279
+ });
280
+
281
+ const { queryByTestId } = renderWithProviders(<Layout />);
282
+ expect(queryByTestId("menu")).toBeNull();
283
+ });
284
+
285
+ it("should not add padding when Side Menu is active", () => {
286
+ (getMenuPlugin as jest.Mock).mockReturnValue({
287
+ identifier: SIDE_MENU_PLUGIN_ID,
288
+ });
289
+
290
+ (isBottomTabVisible as jest.Mock).mockReturnValue(false);
291
+
292
+ mockUseNavigation.mockReturnValue({
293
+ activeRiver: { navigations: [] },
294
+ videoModalState: { visible: false, mode: "MINIMIZED" },
295
+ isVideoModalDocked: false,
296
+ currentRoute: "home",
297
+ data: {},
298
+ });
299
+
300
+ const { getByTestId } = renderWithProviders(<Layout />);
301
+
302
+ expect(getByTestId("transitioner").props.contentStyle.paddingBottom).toBe(
303
+ 0
304
+ );
305
+ });
240
306
  });
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
3
 
4
- import { View, StyleSheet } from "react-native";
4
+ import { StyleSheet, View } from "react-native";
5
5
 
6
6
  import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
7
7
  import {
@@ -15,9 +15,17 @@ import { transitionConfig } from "@applicaster/zapp-react-native-ui-components/C
15
15
  import { Screen } from "@applicaster/zapp-react-native-ui-components/Components/Screen";
16
16
  import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
17
17
 
18
- import { getNavigationPluginModule } from "./layoutHelpers";
18
+ import {
19
+ getNavigationPluginModule,
20
+ isVideoOverlayVisible,
21
+ } from "./layoutHelpers";
19
22
 
20
- import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
23
+ import {
24
+ getMenuPlugin,
25
+ isBottomTabVisible,
26
+ isMenuVisible,
27
+ SIDE_MENU_PLUGIN_ID,
28
+ } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
21
29
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
22
30
 
23
31
  import {
@@ -82,6 +90,12 @@ const LayoutWithMenu = () => {
82
90
  [activeRiver]
83
91
  );
84
92
 
93
+ const isSideMenu = React.useMemo(() => {
94
+ const menuPlugin = getMenuPlugin(navigator.screenData, plugins);
95
+
96
+ return menuPlugin?.identifier === SIDE_MENU_PLUGIN_ID;
97
+ }, [navigator.screenData, plugins]);
98
+
85
99
  /** BTB shown when videoModalState - visible & minimized, maximized & animation gesture is active
86
100
  * otherwise hidden if videoModalState - visible
87
101
  * also check isMenuVisible
@@ -93,14 +107,38 @@ const LayoutWithMenu = () => {
93
107
  plugins
94
108
  );
95
109
 
96
- const shouldShowWithVideo =
97
- videoModalState.visible &&
98
- ["MINIMIZED", "MAXIMIZED"].includes(videoModalState.mode);
110
+ if (isSideMenu) {
111
+ return menuVisible;
112
+ }
99
113
 
100
- return menuVisible && (shouldShowWithVideo || !videoModalState.visible);
101
- }, [videoModalState.visible, videoModalState.mode, navigator.currentRoute]);
114
+ return menuVisible && isVideoOverlayVisible(videoModalState);
115
+ }, [
116
+ plugins,
117
+ isSideMenu,
118
+ navigator.currentRoute,
119
+ navigator.screenData,
120
+ videoModalState.visible,
121
+ videoModalState.mode,
122
+ ]);
123
+
124
+ const showBottomTabs = React.useMemo(() => {
125
+ const bottomTabsVisible = isBottomTabVisible(
126
+ navigator.currentRoute,
127
+ navigator.screenData,
128
+ plugins
129
+ );
102
130
 
103
- const paddingBottom = showMenu ? bottomTabBarHeight + safeAreaBottomInset : 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
131
+ return bottomTabsVisible && isVideoOverlayVisible(videoModalState);
132
+ }, [
133
+ videoModalState.visible,
134
+ videoModalState.mode,
135
+ navigator.currentRoute,
136
+ navigator.screenData,
137
+ ]);
138
+
139
+ const paddingBottom = showBottomTabs
140
+ ? bottomTabBarHeight + safeAreaBottomInset
141
+ : 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
104
142
 
105
143
  const contentStyle = React.useMemo(
106
144
  () =>
@@ -28,3 +28,10 @@ export function getNavigationPluginModule(
28
28
 
29
29
  return plugin.module;
30
30
  }
31
+
32
+ export function isVideoOverlayVisible(videoModalState) {
33
+ return (
34
+ !videoModalState.visible ||
35
+ ["MINIMIZED", "MAXIMIZED"].includes(videoModalState.mode)
36
+ );
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-app",
3
- "version": "15.0.0-rc.44",
3
+ "version": "15.0.0-rc.46",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/quick-brick-core": "15.0.0-rc.44",
31
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.44",
32
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.44",
33
- "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.44",
34
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.44",
30
+ "@applicaster/quick-brick-core": "15.0.0-rc.46",
31
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.46",
32
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.46",
33
+ "@applicaster/zapp-react-native-ui-components": "15.0.0-rc.46",
34
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.46",
35
35
  "axios": "^0.28.0",
36
36
  "camelize": "^1.0.0",
37
37
  "query-string": "7.1.3",