@applicaster/zapp-react-native-app 12.0.0-alpha.7496053101 → 12.0.0-alpha.7528906949

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.
@@ -5,10 +5,10 @@ import { View } from "react-native";
5
5
 
6
6
  import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
7
7
  import {
8
- useGetBottomTabBarHeight,
9
- useNavigation,
10
8
  useDimensions,
9
+ useGetBottomTabBarHeight,
11
10
  useNavbarState,
11
+ useNavigation,
12
12
  } from "@applicaster/zapp-react-native-utils/reactHooks";
13
13
  import { Transitioner } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner";
14
14
  import { transitionConfig } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner/config";
@@ -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 { MenuToggleContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
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 = (props: Props) => {
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
- } = props;
56
+ } = useMenuToggleContext();
64
57
 
65
58
  const dimensions = useDimensions("screen", { fullDimensions: true });
66
59
  const isRTL = useIsRTL();
@@ -77,7 +70,10 @@ const LayoutWithMenu = (props: Props) => {
77
70
  activeRiver,
78
71
  plugins
79
72
  ) as React.ComponentType<
80
- MobileNavBarPluginProps & { navigator: ZappNavigation }
73
+ MobileNavBarPluginProps &
74
+ MenuToggleContextType & {
75
+ navigator: QuickBrickAppNavigator;
76
+ }
81
77
  >,
82
78
  []
83
79
  );
@@ -100,23 +96,31 @@ const LayoutWithMenu = (props: Props) => {
100
96
  [bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
101
97
  );
102
98
 
103
- const menuProps = {
104
- setToggleMenu: setToggleMenu,
105
- toggleMenu: toggleMenu,
106
- openMenu: openMenu,
107
- setOpenMenu: setOpenMenu,
108
- closeMenu: closeMenu,
109
- setCloseMenu: setCloseMenu,
110
- dimensions: { window: dimensions },
111
- navigator,
112
- ...getNavigationProps({
99
+ const menuProps = React.useMemo(() => {
100
+ const navigationProps = getNavigationProps({
113
101
  navigator,
114
102
  title,
115
103
  category: "menu",
116
- }),
117
- bottomTabBarHeight,
118
- isRTL,
119
- };
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]);
120
124
 
121
125
  useListenEventBusEvent(
122
126
  PushTopicManagerConsts.PushTopicManagerSubscriptionID,
@@ -143,14 +147,22 @@ const LayoutWithMenu = (props: Props) => {
143
147
  <Screen
144
148
  key={navigator.currentRoute}
145
149
  pathname={navigator.currentRoute} // required by TransitionerComponent
146
- screenData={navigator.screenData} // required by TransitionerComponent
147
- setToggleMenu={setToggleMenu}
148
- setCloseMenu={setCloseMenu}
150
+ screenData={navigator.data} // required by TransitionerComponent
149
151
  />
150
152
  </Transitioner>
151
153
  </View>
152
154
  ) : null}
153
- {showMenu && <Menu {...{ ...menuProps, id: navigator.currentRoute }} />}
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
+ )}
154
166
  {/* depends on active river. @TODO move below screen context */}
155
167
  {VideoModal && videoModalState.visible && <VideoModal />}
156
168
  <ZappHooksModal />
@@ -159,6 +171,6 @@ const LayoutWithMenu = (props: Props) => {
159
171
  };
160
172
 
161
173
  export const Layout = R.compose(
162
- MenuToggleContext.withConsumer,
163
- withDimensionsProvider
174
+ withDimensionsProvider,
175
+ withModalAnimationProvider
164
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.7496053101",
3
+ "version": "12.0.0-alpha.7528906949",
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.7496053101",
33
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7496053101",
34
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7496053101",
35
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7496053101",
36
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7496053101",
32
+ "@applicaster/quick-brick-core": "12.0.0-alpha.7528906949",
33
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7528906949",
34
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7528906949",
35
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7528906949",
36
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7528906949",
37
37
  "axios": "^0.28.0",
38
38
  "camelize": "^1.0.0",
39
39
  "query-string": "7.1.3",