@applicaster/zapp-react-native-app 12.0.0-alpha.7496053101 → 12.0.0-alpha.7517336525
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.
- package/App/Layout/index.tsx +87 -44
- package/App/__tests__/app.test.js +5 -0
- package/package.json +6 -6
package/App/Layout/index.tsx
CHANGED
|
@@ -3,12 +3,15 @@ import * as R from "ramda";
|
|
|
3
3
|
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
|
|
6
|
-
import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
7
6
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
getNavigationProps,
|
|
8
|
+
resolveNavigationPlugin,
|
|
9
|
+
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
10
|
+
import {
|
|
10
11
|
useDimensions,
|
|
12
|
+
useGetBottomTabBarHeight,
|
|
11
13
|
useNavbarState,
|
|
14
|
+
useNavigation,
|
|
12
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
16
|
import { Transitioner } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner";
|
|
14
17
|
import { transitionConfig } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner/config";
|
|
@@ -20,9 +23,16 @@ import { getNavigationPluginModule } from "./layoutHelpers";
|
|
|
20
23
|
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
21
24
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
22
25
|
|
|
23
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
useMenuToggleContext,
|
|
28
|
+
MenuToggleContextType,
|
|
29
|
+
} from "@applicaster/zapp-react-native-ui-components/Contexts/MenuToggleContext";
|
|
24
30
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
25
31
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
32
|
+
import {
|
|
33
|
+
withModalAnimationProvider,
|
|
34
|
+
useModalAnimationContext,
|
|
35
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
36
|
|
|
27
37
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
28
38
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
@@ -32,22 +42,11 @@ import {
|
|
|
32
42
|
PushTopicManagerEvents,
|
|
33
43
|
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
34
44
|
|
|
35
|
-
type Props = {
|
|
36
|
-
children: React.ReactNode;
|
|
37
|
-
toggleMenu: any;
|
|
38
|
-
setToggleMenu: () => void;
|
|
39
|
-
openMenu: any;
|
|
40
|
-
setOpenMenu: () => void;
|
|
41
|
-
closeMenu: any;
|
|
42
|
-
setCloseMenu: () => void;
|
|
43
|
-
navigator: QuickBrickAppNavigator;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
45
|
const containerStyle = {
|
|
47
46
|
height: "100%",
|
|
48
47
|
};
|
|
49
48
|
|
|
50
|
-
const LayoutWithMenu = (
|
|
49
|
+
const LayoutWithMenu = () => {
|
|
51
50
|
const {
|
|
52
51
|
plugins,
|
|
53
52
|
appState: { appReady },
|
|
@@ -60,7 +59,7 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
60
59
|
setOpenMenu,
|
|
61
60
|
closeMenu,
|
|
62
61
|
setCloseMenu,
|
|
63
|
-
} =
|
|
62
|
+
} = useMenuToggleContext();
|
|
64
63
|
|
|
65
64
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
66
65
|
const isRTL = useIsRTL();
|
|
@@ -70,6 +69,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
70
69
|
|
|
71
70
|
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
72
71
|
|
|
72
|
+
const plugin = resolveNavigationPlugin({
|
|
73
|
+
category: "menu",
|
|
74
|
+
navigations: activeRiver?.navigations,
|
|
75
|
+
plugins,
|
|
76
|
+
});
|
|
77
|
+
|
|
73
78
|
const Menu = React.useMemo(
|
|
74
79
|
() =>
|
|
75
80
|
getNavigationPluginModule(
|
|
@@ -77,19 +82,42 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
77
82
|
activeRiver,
|
|
78
83
|
plugins
|
|
79
84
|
) as React.ComponentType<
|
|
80
|
-
MobileNavBarPluginProps &
|
|
85
|
+
MobileNavBarPluginProps &
|
|
86
|
+
MenuToggleContextType & {
|
|
87
|
+
navigator: QuickBrickAppNavigator;
|
|
88
|
+
}
|
|
81
89
|
>,
|
|
82
|
-
[]
|
|
90
|
+
[activeRiver]
|
|
83
91
|
);
|
|
84
92
|
|
|
93
|
+
const { isActiveGesture } = useModalAnimationContext();
|
|
94
|
+
|
|
95
|
+
/** BTB shown when videoModalState - visible & minimized, maximized & animation gesture is active
|
|
96
|
+
* otherwise hidden if videoModalState - visible
|
|
97
|
+
* also check isMenuVisible
|
|
98
|
+
*/
|
|
85
99
|
const showMenu = React.useMemo(
|
|
86
|
-
() =>
|
|
87
|
-
|
|
100
|
+
() =>
|
|
101
|
+
((videoModalState.visible &&
|
|
102
|
+
(videoModalState.mode === "MINIMIZED" ||
|
|
103
|
+
(videoModalState.mode === "MAXIMIZED" && isActiveGesture))) ||
|
|
104
|
+
!videoModalState.visible) &&
|
|
105
|
+
isMenuVisible(navigator.currentRoute, navigator.screenData),
|
|
106
|
+
[
|
|
107
|
+
videoModalState.visible,
|
|
108
|
+
videoModalState.mode,
|
|
109
|
+
navigator.currentRoute,
|
|
110
|
+
isActiveGesture,
|
|
111
|
+
]
|
|
88
112
|
);
|
|
89
113
|
|
|
114
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
115
|
+
|
|
116
|
+
const shouldApplyStyleForBottomTabs = showMenu && isBottomTabsPlugin;
|
|
117
|
+
|
|
90
118
|
const contentStyle = React.useMemo(
|
|
91
119
|
() => ({
|
|
92
|
-
...(
|
|
120
|
+
...(shouldApplyStyleForBottomTabs
|
|
93
121
|
? {
|
|
94
122
|
paddingBottom: bottomTabBarHeight,
|
|
95
123
|
}
|
|
@@ -100,23 +128,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
100
128
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
101
129
|
);
|
|
102
130
|
|
|
103
|
-
const menuProps = {
|
|
104
|
-
|
|
105
|
-
toggleMenu: toggleMenu,
|
|
106
|
-
openMenu: openMenu,
|
|
107
|
-
setOpenMenu: setOpenMenu,
|
|
108
|
-
closeMenu: closeMenu,
|
|
109
|
-
setCloseMenu: setCloseMenu,
|
|
110
|
-
dimensions: { window: dimensions },
|
|
111
|
-
navigator,
|
|
112
|
-
...getNavigationProps({
|
|
131
|
+
const menuProps = React.useMemo(() => {
|
|
132
|
+
const navigationProps = getNavigationProps({
|
|
113
133
|
navigator,
|
|
114
134
|
title,
|
|
115
135
|
category: "menu",
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
136
|
+
}) ?? {
|
|
137
|
+
selected: "",
|
|
138
|
+
title: "",
|
|
139
|
+
home: false,
|
|
140
|
+
rules: {} as ZappNavBarRules,
|
|
141
|
+
assets: {} as ZappNavBarAssets,
|
|
142
|
+
styles: {},
|
|
143
|
+
nav_items: [] as NavBarItem[],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const props = {
|
|
147
|
+
...navigationProps,
|
|
148
|
+
dimensions: { window: dimensions },
|
|
149
|
+
bottomTabBarHeight,
|
|
150
|
+
isRTL,
|
|
151
|
+
navigator,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return { ...props, id: navigator.currentRoute };
|
|
155
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
120
156
|
|
|
121
157
|
useListenEventBusEvent(
|
|
122
158
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -136,21 +172,28 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
136
172
|
<View style={contentStyle}>
|
|
137
173
|
<Transitioner
|
|
138
174
|
transitionConfig={transitionConfig}
|
|
139
|
-
contentStyle={
|
|
175
|
+
contentStyle={{}}
|
|
140
176
|
isRTL={isRTL}
|
|
141
177
|
>
|
|
142
|
-
{/* has pathname context */}
|
|
143
178
|
<Screen
|
|
144
179
|
key={navigator.currentRoute}
|
|
145
180
|
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
146
|
-
screenData={navigator.
|
|
147
|
-
setToggleMenu={setToggleMenu}
|
|
148
|
-
setCloseMenu={setCloseMenu}
|
|
181
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
149
182
|
/>
|
|
150
183
|
</Transitioner>
|
|
151
184
|
</View>
|
|
152
185
|
) : null}
|
|
153
|
-
{showMenu &&
|
|
186
|
+
{showMenu && (
|
|
187
|
+
<Menu
|
|
188
|
+
{...menuProps}
|
|
189
|
+
setToggleMenu={setToggleMenu}
|
|
190
|
+
toggleMenu={toggleMenu}
|
|
191
|
+
openMenu={openMenu}
|
|
192
|
+
setOpenMenu={setOpenMenu}
|
|
193
|
+
closeMenu={closeMenu}
|
|
194
|
+
setCloseMenu={setCloseMenu}
|
|
195
|
+
/>
|
|
196
|
+
)}
|
|
154
197
|
{/* depends on active river. @TODO move below screen context */}
|
|
155
198
|
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
156
199
|
<ZappHooksModal />
|
|
@@ -159,6 +202,6 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
159
202
|
};
|
|
160
203
|
|
|
161
204
|
export const Layout = R.compose(
|
|
162
|
-
|
|
163
|
-
|
|
205
|
+
withDimensionsProvider,
|
|
206
|
+
withModalAnimationProvider
|
|
164
207
|
)(LayoutWithMenu);
|
|
@@ -54,6 +54,11 @@ jest.mock(
|
|
|
54
54
|
() => () => null
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
+
jest.mock(
|
|
58
|
+
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation",
|
|
59
|
+
() => ({ withModalAnimationProvider: () => null })
|
|
60
|
+
);
|
|
61
|
+
|
|
57
62
|
jest.mock("react-native-safe-area-context", () => ({
|
|
58
63
|
SafeAreaProvider: jest.fn(
|
|
59
64
|
() =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-app",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.7517336525",
|
|
4
4
|
"description": "Zapp App Component for Applicaster's Quick Brick React Native App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@applicaster/quick-brick-core": "12.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
32
|
+
"@applicaster/quick-brick-core": "12.0.0-alpha.7517336525",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7517336525",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.7517336525",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7517336525",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.7517336525",
|
|
37
37
|
"axios": "^0.28.0",
|
|
38
38
|
"camelize": "^1.0.0",
|
|
39
39
|
"query-string": "7.1.3",
|