@applicaster/zapp-react-native-app 12.0.0-alpha.4374801485 → 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 +62 -39
- 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,7 +23,10 @@ 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";
|
|
26
32
|
import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
@@ -33,22 +39,11 @@ import {
|
|
|
33
39
|
PushTopicManagerEvents,
|
|
34
40
|
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
35
41
|
|
|
36
|
-
type Props = {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
toggleMenu: any;
|
|
39
|
-
setToggleMenu: () => void;
|
|
40
|
-
openMenu: any;
|
|
41
|
-
setOpenMenu: () => void;
|
|
42
|
-
closeMenu: any;
|
|
43
|
-
setCloseMenu: () => void;
|
|
44
|
-
navigator: QuickBrickAppNavigator;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
42
|
const containerStyle = {
|
|
48
43
|
height: "100%",
|
|
49
44
|
};
|
|
50
45
|
|
|
51
|
-
const LayoutWithMenu = (
|
|
46
|
+
const LayoutWithMenu = () => {
|
|
52
47
|
const {
|
|
53
48
|
plugins,
|
|
54
49
|
appState: { appReady },
|
|
@@ -61,7 +56,7 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
61
56
|
setOpenMenu,
|
|
62
57
|
closeMenu,
|
|
63
58
|
setCloseMenu,
|
|
64
|
-
} =
|
|
59
|
+
} = useMenuToggleContext();
|
|
65
60
|
|
|
66
61
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
67
62
|
const isRTL = useIsRTL();
|
|
@@ -71,6 +66,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
71
66
|
|
|
72
67
|
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
73
68
|
|
|
69
|
+
const plugin = resolveNavigationPlugin({
|
|
70
|
+
category: "menu",
|
|
71
|
+
navigations: activeRiver?.navigations,
|
|
72
|
+
plugins,
|
|
73
|
+
});
|
|
74
|
+
|
|
74
75
|
const Menu = React.useMemo(
|
|
75
76
|
() =>
|
|
76
77
|
getNavigationPluginModule(
|
|
@@ -78,9 +79,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
78
79
|
activeRiver,
|
|
79
80
|
plugins
|
|
80
81
|
) as React.ComponentType<
|
|
81
|
-
MobileNavBarPluginProps &
|
|
82
|
+
MobileNavBarPluginProps &
|
|
83
|
+
MenuToggleContextType & {
|
|
84
|
+
navigator: QuickBrickAppNavigator;
|
|
85
|
+
}
|
|
82
86
|
>,
|
|
83
|
-
[]
|
|
87
|
+
[activeRiver]
|
|
84
88
|
);
|
|
85
89
|
|
|
86
90
|
const showMenu = React.useMemo(
|
|
@@ -88,9 +92,13 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
88
92
|
[navigator.currentRoute]
|
|
89
93
|
);
|
|
90
94
|
|
|
95
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
96
|
+
|
|
97
|
+
const shouldApplyStyleForBottomTabs = showMenu && isBottomTabsPlugin;
|
|
98
|
+
|
|
91
99
|
const contentStyle = React.useMemo(
|
|
92
100
|
() => ({
|
|
93
|
-
...(
|
|
101
|
+
...(shouldApplyStyleForBottomTabs
|
|
94
102
|
? {
|
|
95
103
|
paddingBottom: bottomTabBarHeight,
|
|
96
104
|
}
|
|
@@ -101,23 +109,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
101
109
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
102
110
|
);
|
|
103
111
|
|
|
104
|
-
const menuProps = {
|
|
105
|
-
|
|
106
|
-
toggleMenu: toggleMenu,
|
|
107
|
-
openMenu: openMenu,
|
|
108
|
-
setOpenMenu: setOpenMenu,
|
|
109
|
-
closeMenu: closeMenu,
|
|
110
|
-
setCloseMenu: setCloseMenu,
|
|
111
|
-
dimensions: { window: dimensions },
|
|
112
|
-
navigator,
|
|
113
|
-
...getNavigationProps({
|
|
112
|
+
const menuProps = React.useMemo(() => {
|
|
113
|
+
const navigationProps = getNavigationProps({
|
|
114
114
|
navigator,
|
|
115
115
|
title,
|
|
116
116
|
category: "menu",
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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]);
|
|
121
137
|
|
|
122
138
|
useListenEventBusEvent(
|
|
123
139
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -144,14 +160,22 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
144
160
|
<Screen
|
|
145
161
|
key={navigator.currentRoute}
|
|
146
162
|
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
147
|
-
screenData={navigator.
|
|
148
|
-
setToggleMenu={setToggleMenu}
|
|
149
|
-
setCloseMenu={setCloseMenu}
|
|
163
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
150
164
|
/>
|
|
151
165
|
</Transitioner>
|
|
152
166
|
</View>
|
|
153
167
|
) : null}
|
|
154
|
-
{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
|
+
)}
|
|
155
179
|
{/* depends on active river. @TODO move below screen context */}
|
|
156
180
|
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
157
181
|
<ZappHooksModal />
|
|
@@ -160,7 +184,6 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
160
184
|
};
|
|
161
185
|
|
|
162
186
|
export const Layout = R.compose(
|
|
163
|
-
MenuToggleContext.withConsumer,
|
|
164
187
|
withDimensionsProvider,
|
|
165
188
|
withModalAnimationProvider
|
|
166
189
|
)(LayoutWithMenu);
|
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",
|