@applicaster/zapp-react-native-app 12.0.0-alpha.3977160850 → 12.0.0-alpha.4300857220
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.
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
describe("Layout", () => {
|
|
2
|
+
it.todo("should match snapshot when appReady is true");
|
|
3
|
+
it.todo("should not render transitioner with screen when appReady is false");
|
|
4
|
+
it.todo("should render menu when showMenu is true");
|
|
5
|
+
it.todo("should render VideoModal when visible & VideoModal is true");
|
|
6
|
+
it.todo("should render ZappHooksModal");
|
|
7
|
+
});
|
package/App/Layout/index.tsx
CHANGED
|
@@ -20,9 +20,13 @@ import { getNavigationPluginModule } from "./layoutHelpers";
|
|
|
20
20
|
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
21
21
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useMenuToggleContext,
|
|
25
|
+
MenuToggleContextType,
|
|
26
|
+
} from "@applicaster/zapp-react-native-ui-components/Contexts/MenuToggleContext";
|
|
24
27
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
25
28
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
29
|
+
import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
30
|
|
|
27
31
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
28
32
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
@@ -32,22 +36,11 @@ import {
|
|
|
32
36
|
PushTopicManagerEvents,
|
|
33
37
|
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
34
38
|
|
|
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
39
|
const containerStyle = {
|
|
47
40
|
height: "100%",
|
|
48
41
|
};
|
|
49
42
|
|
|
50
|
-
const LayoutWithMenu = (
|
|
43
|
+
const LayoutWithMenu = () => {
|
|
51
44
|
const {
|
|
52
45
|
plugins,
|
|
53
46
|
appState: { appReady },
|
|
@@ -60,7 +53,7 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
60
53
|
setOpenMenu,
|
|
61
54
|
closeMenu,
|
|
62
55
|
setCloseMenu,
|
|
63
|
-
} =
|
|
56
|
+
} = useMenuToggleContext();
|
|
64
57
|
|
|
65
58
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
66
59
|
const isRTL = useIsRTL();
|
|
@@ -76,7 +69,12 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
76
69
|
"menu",
|
|
77
70
|
activeRiver,
|
|
78
71
|
plugins
|
|
79
|
-
) as React.ComponentType<
|
|
72
|
+
) as React.ComponentType<
|
|
73
|
+
MobileNavBarPluginProps &
|
|
74
|
+
MenuToggleContextType & {
|
|
75
|
+
navigator: QuickBrickAppNavigator;
|
|
76
|
+
}
|
|
77
|
+
>,
|
|
80
78
|
[]
|
|
81
79
|
);
|
|
82
80
|
|
|
@@ -98,23 +96,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
98
96
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
99
97
|
);
|
|
100
98
|
|
|
101
|
-
const menuProps = {
|
|
102
|
-
|
|
103
|
-
toggleMenu: toggleMenu,
|
|
104
|
-
openMenu: openMenu,
|
|
105
|
-
setOpenMenu: setOpenMenu,
|
|
106
|
-
closeMenu: closeMenu,
|
|
107
|
-
setCloseMenu: setCloseMenu,
|
|
108
|
-
dimensions: { window: dimensions },
|
|
109
|
-
navigator,
|
|
110
|
-
...getNavigationProps({
|
|
99
|
+
const menuProps = React.useMemo(() => {
|
|
100
|
+
const navigationProps = getNavigationProps({
|
|
111
101
|
navigator,
|
|
112
102
|
title,
|
|
113
103
|
category: "menu",
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
}) ?? {
|
|
105
|
+
selected: "",
|
|
106
|
+
title: "",
|
|
107
|
+
home: false,
|
|
108
|
+
rules: {} as ZappNavBarRules,
|
|
109
|
+
assets: {} as ZappNavBarAssets,
|
|
110
|
+
styles: {},
|
|
111
|
+
nav_items: [] as NavBarItem[],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const props = {
|
|
115
|
+
...navigationProps,
|
|
116
|
+
dimensions: { window: dimensions },
|
|
117
|
+
bottomTabBarHeight,
|
|
118
|
+
isRTL,
|
|
119
|
+
navigator,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return { ...props, id: navigator.currentRoute };
|
|
123
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
118
124
|
|
|
119
125
|
useListenEventBusEvent(
|
|
120
126
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -142,13 +148,21 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
142
148
|
key={navigator.currentRoute}
|
|
143
149
|
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
144
150
|
screenData={navigator.screenData} // required by TransitionerComponent
|
|
145
|
-
setToggleMenu={setToggleMenu}
|
|
146
|
-
setCloseMenu={setCloseMenu}
|
|
147
151
|
/>
|
|
148
152
|
</Transitioner>
|
|
149
153
|
</View>
|
|
150
154
|
) : null}
|
|
151
|
-
{showMenu &&
|
|
155
|
+
{showMenu && (
|
|
156
|
+
<Menu
|
|
157
|
+
{...menuProps}
|
|
158
|
+
setToggleMenu={setToggleMenu}
|
|
159
|
+
toggleMenu={toggleMenu}
|
|
160
|
+
openMenu={openMenu}
|
|
161
|
+
setOpenMenu={setOpenMenu}
|
|
162
|
+
closeMenu={closeMenu}
|
|
163
|
+
setCloseMenu={setCloseMenu}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
152
166
|
{/* depends on active river. @TODO move below screen context */}
|
|
153
167
|
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
154
168
|
<ZappHooksModal />
|
|
@@ -157,6 +171,6 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
157
171
|
};
|
|
158
172
|
|
|
159
173
|
export const Layout = R.compose(
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
withDimensionsProvider,
|
|
175
|
+
withModalAnimationProvider
|
|
162
176
|
)(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.4300857220",
|
|
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.4300857220",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.4300857220",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.4300857220",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.4300857220",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.4300857220",
|
|
37
37
|
"axios": "^0.28.0",
|
|
38
38
|
"camelize": "^1.0.0",
|
|
39
39
|
"query-string": "7.1.3",
|