@applicaster/zapp-react-native-app 15.0.0-alpha.4368022015 → 15.0.0-alpha.4374322811
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.
|
@@ -57,7 +57,17 @@ exports[`Layout should match snapshot when appReady is true 1`] = `
|
|
|
57
57
|
},
|
|
58
58
|
"currentRoute": "home",
|
|
59
59
|
"data": {},
|
|
60
|
-
"isVideoModalDocked":
|
|
60
|
+
"isVideoModalDocked": [MockFunction] {
|
|
61
|
+
"calls": [
|
|
62
|
+
[],
|
|
63
|
+
],
|
|
64
|
+
"results": [
|
|
65
|
+
{
|
|
66
|
+
"type": "return",
|
|
67
|
+
"value": false,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
61
71
|
"videoModalState": {
|
|
62
72
|
"mode": "MINIMIZED",
|
|
63
73
|
"visible": false,
|
|
@@ -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
|
|
|
@@ -52,7 +59,13 @@ jest.mock(
|
|
|
52
59
|
})
|
|
53
60
|
);
|
|
54
61
|
|
|
55
|
-
const mockUseNavigation = jest.fn()
|
|
62
|
+
const mockUseNavigation = jest.fn(() => ({
|
|
63
|
+
activeRiver: { navigations: [] },
|
|
64
|
+
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
65
|
+
currentRoute: "home",
|
|
66
|
+
data: {},
|
|
67
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
68
|
+
}));
|
|
56
69
|
|
|
57
70
|
jest.mock(
|
|
58
71
|
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
|
|
@@ -110,6 +123,9 @@ jest.mock(
|
|
|
110
123
|
"@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler",
|
|
111
124
|
() => ({
|
|
112
125
|
isMenuVisible: jest.fn(() => true),
|
|
126
|
+
isBottomTabVisible: jest.fn(() => true),
|
|
127
|
+
getMenuPlugin: jest.fn(() => ({ identifier: "test-plugin" })),
|
|
128
|
+
SIDE_MENU_PLUGIN_ID: "quick_brick_side_menu",
|
|
113
129
|
})
|
|
114
130
|
);
|
|
115
131
|
|
|
@@ -150,28 +166,6 @@ jest.mock("@applicaster/zapp-react-native-utils/navigationUtils", () => ({
|
|
|
150
166
|
const { Layout } = require("../");
|
|
151
167
|
|
|
152
168
|
describe("Layout", () => {
|
|
153
|
-
beforeAll(() => {
|
|
154
|
-
mockUseNavigation.mockImplementation(() => ({
|
|
155
|
-
activeRiver: { navigations: [] },
|
|
156
|
-
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
157
|
-
isVideoModalDocked: false,
|
|
158
|
-
currentRoute: "home",
|
|
159
|
-
data: {},
|
|
160
|
-
}));
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
beforeEach(() => {
|
|
164
|
-
jest.clearAllMocks();
|
|
165
|
-
|
|
166
|
-
mockUseNavigation.mockImplementation(() => ({
|
|
167
|
-
activeRiver: { navigations: [] },
|
|
168
|
-
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
169
|
-
isVideoModalDocked: false,
|
|
170
|
-
currentRoute: "home",
|
|
171
|
-
data: {},
|
|
172
|
-
}));
|
|
173
|
-
});
|
|
174
|
-
|
|
175
169
|
it("should match snapshot when appReady is true", () => {
|
|
176
170
|
const { toJSON } = renderWithProviders(<Layout />);
|
|
177
171
|
|
|
@@ -198,7 +192,7 @@ describe("Layout", () => {
|
|
|
198
192
|
mockUseNavigation.mockReturnValue({
|
|
199
193
|
activeRiver: { navigations: [] },
|
|
200
194
|
videoModalState: { visible: true, mode: "MINIMIZED" },
|
|
201
|
-
isVideoModalDocked:
|
|
195
|
+
isVideoModalDocked: jest.fn(() => true),
|
|
202
196
|
currentRoute: "home",
|
|
203
197
|
data: {},
|
|
204
198
|
});
|
|
@@ -216,7 +210,7 @@ describe("Layout", () => {
|
|
|
216
210
|
mockUseNavigation.mockReturnValueOnce({
|
|
217
211
|
activeRiver: { navigations: [{ identifier: "quick-brick-bottom-tabs" }] },
|
|
218
212
|
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
219
|
-
isVideoModalDocked: false,
|
|
213
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
220
214
|
currentRoute: "home",
|
|
221
215
|
data: {},
|
|
222
216
|
});
|
|
@@ -237,4 +231,60 @@ describe("Layout", () => {
|
|
|
237
231
|
opacity: 1,
|
|
238
232
|
});
|
|
239
233
|
});
|
|
234
|
+
|
|
235
|
+
it("should render menu when Side Menu is active and VideoModal is FULLSCREEN", () => {
|
|
236
|
+
(getMenuPlugin as jest.Mock).mockReturnValue({
|
|
237
|
+
identifier: SIDE_MENU_PLUGIN_ID,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
mockUseNavigation.mockReturnValue({
|
|
241
|
+
activeRiver: { navigations: [] },
|
|
242
|
+
videoModalState: { visible: true, mode: "FULLSCREEN" },
|
|
243
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
244
|
+
currentRoute: "home",
|
|
245
|
+
data: {},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const { queryByTestId } = renderWithProviders(<Layout />);
|
|
249
|
+
expect(queryByTestId("menu")).toBeTruthy();
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("should NOT render menu when Bottom Tabs are active and VideoModal is FULLSCREEN", () => {
|
|
253
|
+
(getMenuPlugin as jest.Mock).mockReturnValue({
|
|
254
|
+
identifier: "quick-brick-bottom-tabs",
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
mockUseNavigation.mockReturnValue({
|
|
258
|
+
activeRiver: { navigations: [] },
|
|
259
|
+
videoModalState: { visible: true, mode: "FULLSCREEN" },
|
|
260
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
261
|
+
currentRoute: "home",
|
|
262
|
+
data: {},
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
const { queryByTestId } = renderWithProviders(<Layout />);
|
|
266
|
+
expect(queryByTestId("menu")).toBeNull();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("should not add padding when Side Menu is active", () => {
|
|
270
|
+
(getMenuPlugin as jest.Mock).mockReturnValue({
|
|
271
|
+
identifier: SIDE_MENU_PLUGIN_ID,
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
(isBottomTabVisible as jest.Mock).mockReturnValue(false);
|
|
275
|
+
|
|
276
|
+
mockUseNavigation.mockReturnValue({
|
|
277
|
+
activeRiver: { navigations: [] },
|
|
278
|
+
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
279
|
+
isVideoModalDocked: jest.fn(() => false),
|
|
280
|
+
currentRoute: "home",
|
|
281
|
+
data: {},
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const { getByTestId } = renderWithProviders(<Layout />);
|
|
285
|
+
|
|
286
|
+
expect(getByTestId("transitioner").props.contentStyle.paddingBottom).toBe(
|
|
287
|
+
0
|
|
288
|
+
);
|
|
289
|
+
});
|
|
240
290
|
});
|
package/App/Layout/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { StyleSheet, View } from "react-native";
|
|
5
5
|
|
|
6
6
|
import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
7
7
|
import {
|
|
@@ -15,10 +15,23 @@ 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 {
|
|
18
|
+
import {
|
|
19
|
+
getNavigationPluginModule,
|
|
20
|
+
isVideoOverlayVisible,
|
|
21
|
+
} from "./layoutHelpers";
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
usePlugins,
|
|
25
|
+
useAppSelector,
|
|
26
|
+
selectAppReady,
|
|
27
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
19
28
|
|
|
20
|
-
import {
|
|
21
|
-
|
|
29
|
+
import {
|
|
30
|
+
getMenuPlugin,
|
|
31
|
+
isBottomTabVisible,
|
|
32
|
+
isMenuVisible,
|
|
33
|
+
SIDE_MENU_PLUGIN_ID,
|
|
34
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
22
35
|
|
|
23
36
|
import {
|
|
24
37
|
MenuToggleContextType,
|
|
@@ -44,10 +57,8 @@ const styles = StyleSheet.create({
|
|
|
44
57
|
});
|
|
45
58
|
|
|
46
59
|
const LayoutWithMenu = () => {
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
appState: { appReady },
|
|
50
|
-
} = usePickFromState(["plugins", "appState"]);
|
|
60
|
+
const plugins = usePlugins();
|
|
61
|
+
const appReady = useAppSelector(selectAppReady);
|
|
51
62
|
|
|
52
63
|
const {
|
|
53
64
|
toggleMenu,
|
|
@@ -82,6 +93,12 @@ const LayoutWithMenu = () => {
|
|
|
82
93
|
[activeRiver]
|
|
83
94
|
);
|
|
84
95
|
|
|
96
|
+
const isSideMenu = React.useMemo(() => {
|
|
97
|
+
const menuPlugin = getMenuPlugin(navigator.screenData, plugins);
|
|
98
|
+
|
|
99
|
+
return menuPlugin?.identifier === SIDE_MENU_PLUGIN_ID;
|
|
100
|
+
}, [navigator.screenData, plugins]);
|
|
101
|
+
|
|
85
102
|
/** BTB shown when videoModalState - visible & minimized, maximized & animation gesture is active
|
|
86
103
|
* otherwise hidden if videoModalState - visible
|
|
87
104
|
* also check isMenuVisible
|
|
@@ -93,14 +110,40 @@ const LayoutWithMenu = () => {
|
|
|
93
110
|
plugins
|
|
94
111
|
);
|
|
95
112
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
113
|
+
if (isSideMenu) {
|
|
114
|
+
return menuVisible;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return menuVisible && isVideoOverlayVisible(videoModalState);
|
|
118
|
+
}, [
|
|
119
|
+
plugins,
|
|
120
|
+
isSideMenu,
|
|
121
|
+
navigator.currentRoute,
|
|
122
|
+
navigator.screenData,
|
|
123
|
+
videoModalState.visible,
|
|
124
|
+
videoModalState.mode,
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
const showBottomTabs = React.useMemo(() => {
|
|
128
|
+
const bottomTabsVisible = isBottomTabVisible(
|
|
129
|
+
navigator.currentRoute,
|
|
130
|
+
navigator.screenData,
|
|
131
|
+
plugins
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
return bottomTabsVisible && isVideoOverlayVisible(videoModalState);
|
|
135
|
+
}, [
|
|
136
|
+
videoModalState.visible,
|
|
137
|
+
videoModalState.mode,
|
|
138
|
+
navigator.currentRoute,
|
|
139
|
+
navigator.screenData,
|
|
140
|
+
]);
|
|
99
141
|
|
|
100
|
-
|
|
101
|
-
|
|
142
|
+
const paddingBottom = showBottomTabs
|
|
143
|
+
? bottomTabBarHeight + safeAreaBottomInset
|
|
144
|
+
: 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
|
|
102
145
|
|
|
103
|
-
const
|
|
146
|
+
const videoModalStateDocked = isVideoModalDocked();
|
|
104
147
|
|
|
105
148
|
const contentStyle = React.useMemo(
|
|
106
149
|
() =>
|
|
@@ -108,10 +151,10 @@ const LayoutWithMenu = () => {
|
|
|
108
151
|
styles.container,
|
|
109
152
|
{
|
|
110
153
|
paddingBottom,
|
|
111
|
-
opacity: videoModalState.visible && !
|
|
154
|
+
opacity: videoModalState.visible && !videoModalStateDocked ? 0 : 1,
|
|
112
155
|
},
|
|
113
156
|
]),
|
|
114
|
-
[videoModalState.visible,
|
|
157
|
+
[paddingBottom, videoModalState.visible, videoModalStateDocked]
|
|
115
158
|
);
|
|
116
159
|
|
|
117
160
|
const menuProps = React.useMemo(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-app",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.4374322811",
|
|
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-alpha.
|
|
31
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-ui-components": "15.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.
|
|
30
|
+
"@applicaster/quick-brick-core": "15.0.0-alpha.4374322811",
|
|
31
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.4374322811",
|
|
32
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.4374322811",
|
|
33
|
+
"@applicaster/zapp-react-native-ui-components": "15.0.0-alpha.4374322811",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.4374322811",
|
|
35
35
|
"axios": "^0.28.0",
|
|
36
36
|
"camelize": "^1.0.0",
|
|
37
37
|
"query-string": "7.1.3",
|