@applicaster/zapp-react-native-app 15.0.0-rc.11 → 15.0.0-rc.111
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";
|
|
19
22
|
|
|
20
|
-
import {
|
|
21
|
-
|
|
23
|
+
import {
|
|
24
|
+
usePlugins,
|
|
25
|
+
useAppSelector,
|
|
26
|
+
selectAppReady,
|
|
27
|
+
} from "@applicaster/zapp-react-native-redux";
|
|
28
|
+
|
|
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,
|
|
@@ -27,7 +40,6 @@ import {
|
|
|
27
40
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
28
41
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
29
42
|
import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
30
|
-
import { useModalAnimationContext } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/useModalAnimationContext";
|
|
31
43
|
|
|
32
44
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
33
45
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
@@ -45,10 +57,8 @@ const styles = StyleSheet.create({
|
|
|
45
57
|
});
|
|
46
58
|
|
|
47
59
|
const LayoutWithMenu = () => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
appState: { appReady },
|
|
51
|
-
} = usePickFromState(["plugins", "appState"]);
|
|
60
|
+
const plugins = usePlugins();
|
|
61
|
+
const appReady = useAppSelector(selectAppReady);
|
|
52
62
|
|
|
53
63
|
const {
|
|
54
64
|
toggleMenu,
|
|
@@ -83,7 +93,11 @@ const LayoutWithMenu = () => {
|
|
|
83
93
|
[activeRiver]
|
|
84
94
|
);
|
|
85
95
|
|
|
86
|
-
const
|
|
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]);
|
|
87
101
|
|
|
88
102
|
/** BTB shown when videoModalState - visible & minimized, maximized & animation gesture is active
|
|
89
103
|
* otherwise hidden if videoModalState - visible
|
|
@@ -96,19 +110,40 @@ const LayoutWithMenu = () => {
|
|
|
96
110
|
plugins
|
|
97
111
|
);
|
|
98
112
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
+
);
|
|
102
133
|
|
|
103
|
-
return
|
|
134
|
+
return bottomTabsVisible && isVideoOverlayVisible(videoModalState);
|
|
104
135
|
}, [
|
|
105
136
|
videoModalState.visible,
|
|
106
137
|
videoModalState.mode,
|
|
107
138
|
navigator.currentRoute,
|
|
108
|
-
|
|
139
|
+
navigator.screenData,
|
|
109
140
|
]);
|
|
110
141
|
|
|
111
|
-
const paddingBottom =
|
|
142
|
+
const paddingBottom = showBottomTabs
|
|
143
|
+
? bottomTabBarHeight + safeAreaBottomInset
|
|
144
|
+
: 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
|
|
145
|
+
|
|
146
|
+
const videoModalStateDocked = isVideoModalDocked();
|
|
112
147
|
|
|
113
148
|
const contentStyle = React.useMemo(
|
|
114
149
|
() =>
|
|
@@ -116,10 +151,10 @@ const LayoutWithMenu = () => {
|
|
|
116
151
|
styles.container,
|
|
117
152
|
{
|
|
118
153
|
paddingBottom,
|
|
119
|
-
opacity: videoModalState.visible && !
|
|
154
|
+
opacity: videoModalState.visible && !videoModalStateDocked ? 0 : 1,
|
|
120
155
|
},
|
|
121
156
|
]),
|
|
122
|
-
[videoModalState.visible,
|
|
157
|
+
[paddingBottom, videoModalState.visible, videoModalStateDocked]
|
|
123
158
|
);
|
|
124
159
|
|
|
125
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-rc.
|
|
3
|
+
"version": "15.0.0-rc.111",
|
|
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.
|
|
31
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-ui-components": "15.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-rc.
|
|
30
|
+
"@applicaster/quick-brick-core": "15.0.0-rc.111",
|
|
31
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.111",
|
|
32
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-rc.111",
|
|
33
|
+
"@applicaster/zapp-react-native-ui-components": "15.0.0-rc.111",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-rc.111",
|
|
35
35
|
"axios": "^0.28.0",
|
|
36
36
|
"camelize": "^1.0.0",
|
|
37
37
|
"query-string": "7.1.3",
|