@applicaster/zapp-react-native-app 12.0.0-alpha.4400210593 → 12.0.0-alpha.4408649484
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 +65 -40
- 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,13 @@ 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 { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
33
|
|
|
27
34
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
28
35
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
@@ -32,22 +39,11 @@ import {
|
|
|
32
39
|
PushTopicManagerEvents,
|
|
33
40
|
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
34
41
|
|
|
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
42
|
const containerStyle = {
|
|
47
43
|
height: "100%",
|
|
48
44
|
};
|
|
49
45
|
|
|
50
|
-
const LayoutWithMenu = (
|
|
46
|
+
const LayoutWithMenu = () => {
|
|
51
47
|
const {
|
|
52
48
|
plugins,
|
|
53
49
|
appState: { appReady },
|
|
@@ -60,7 +56,7 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
60
56
|
setOpenMenu,
|
|
61
57
|
closeMenu,
|
|
62
58
|
setCloseMenu,
|
|
63
|
-
} =
|
|
59
|
+
} = useMenuToggleContext();
|
|
64
60
|
|
|
65
61
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
66
62
|
const isRTL = useIsRTL();
|
|
@@ -70,6 +66,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
70
66
|
|
|
71
67
|
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
72
68
|
|
|
69
|
+
const plugin = resolveNavigationPlugin({
|
|
70
|
+
category: "menu",
|
|
71
|
+
navigations: activeRiver?.navigations,
|
|
72
|
+
plugins,
|
|
73
|
+
});
|
|
74
|
+
|
|
73
75
|
const Menu = React.useMemo(
|
|
74
76
|
() =>
|
|
75
77
|
getNavigationPluginModule(
|
|
@@ -77,9 +79,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
77
79
|
activeRiver,
|
|
78
80
|
plugins
|
|
79
81
|
) as React.ComponentType<
|
|
80
|
-
MobileNavBarPluginProps &
|
|
82
|
+
MobileNavBarPluginProps &
|
|
83
|
+
MenuToggleContextType & {
|
|
84
|
+
navigator: QuickBrickAppNavigator;
|
|
85
|
+
}
|
|
81
86
|
>,
|
|
82
|
-
[]
|
|
87
|
+
[activeRiver]
|
|
83
88
|
);
|
|
84
89
|
|
|
85
90
|
const showMenu = React.useMemo(
|
|
@@ -87,9 +92,13 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
87
92
|
[navigator.currentRoute]
|
|
88
93
|
);
|
|
89
94
|
|
|
95
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
96
|
+
|
|
97
|
+
const shouldApplyStyleForBottomTabs = showMenu && isBottomTabsPlugin;
|
|
98
|
+
|
|
90
99
|
const contentStyle = React.useMemo(
|
|
91
100
|
() => ({
|
|
92
|
-
...(
|
|
101
|
+
...(shouldApplyStyleForBottomTabs
|
|
93
102
|
? {
|
|
94
103
|
paddingBottom: bottomTabBarHeight,
|
|
95
104
|
}
|
|
@@ -100,23 +109,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
100
109
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
101
110
|
);
|
|
102
111
|
|
|
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({
|
|
112
|
+
const menuProps = React.useMemo(() => {
|
|
113
|
+
const navigationProps = getNavigationProps({
|
|
113
114
|
navigator,
|
|
114
115
|
title,
|
|
115
116
|
category: "menu",
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
}) ?? {
|
|
118
|
+
selected: "",
|
|
119
|
+
title: "",
|
|
120
|
+
home: false,
|
|
121
|
+
rules: {} as ZappNavBarRules,
|
|
122
|
+
assets: {} as ZappNavBarAssets,
|
|
123
|
+
styles: {},
|
|
124
|
+
nav_items: [] as NavBarItem[],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const props = {
|
|
128
|
+
...navigationProps,
|
|
129
|
+
dimensions: { window: dimensions },
|
|
130
|
+
bottomTabBarHeight,
|
|
131
|
+
isRTL,
|
|
132
|
+
navigator,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
return { ...props, id: navigator.currentRoute };
|
|
136
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
120
137
|
|
|
121
138
|
useListenEventBusEvent(
|
|
122
139
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -143,14 +160,22 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
143
160
|
<Screen
|
|
144
161
|
key={navigator.currentRoute}
|
|
145
162
|
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
146
|
-
screenData={navigator.
|
|
147
|
-
setToggleMenu={setToggleMenu}
|
|
148
|
-
setCloseMenu={setCloseMenu}
|
|
163
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
149
164
|
/>
|
|
150
165
|
</Transitioner>
|
|
151
166
|
</View>
|
|
152
167
|
) : null}
|
|
153
|
-
{showMenu &&
|
|
168
|
+
{showMenu && (
|
|
169
|
+
<Menu
|
|
170
|
+
{...menuProps}
|
|
171
|
+
setToggleMenu={setToggleMenu}
|
|
172
|
+
toggleMenu={toggleMenu}
|
|
173
|
+
openMenu={openMenu}
|
|
174
|
+
setOpenMenu={setOpenMenu}
|
|
175
|
+
closeMenu={closeMenu}
|
|
176
|
+
setCloseMenu={setCloseMenu}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
154
179
|
{/* depends on active river. @TODO move below screen context */}
|
|
155
180
|
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
156
181
|
<ZappHooksModal />
|
|
@@ -159,6 +184,6 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
159
184
|
};
|
|
160
185
|
|
|
161
186
|
export const Layout = R.compose(
|
|
162
|
-
|
|
163
|
-
|
|
187
|
+
withDimensionsProvider,
|
|
188
|
+
withModalAnimationProvider
|
|
164
189
|
)(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.4408649484",
|
|
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.4408649484",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4408649484",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.4408649484",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4408649484",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4408649484",
|
|
37
37
|
"axios": "^0.28.0",
|
|
38
38
|
"camelize": "^1.0.0",
|
|
39
39
|
"query-string": "7.1.3",
|