@applicaster/zapp-react-native-app 12.0.0-alpha.5553532911 → 12.0.0-alpha.5624518702

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,7 +20,10 @@ 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";
26
29
  import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
@@ -33,22 +36,11 @@ import {
33
36
  PushTopicManagerEvents,
34
37
  } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
35
38
 
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
39
  const containerStyle = {
48
40
  height: "100%",
49
41
  };
50
42
 
51
- const LayoutWithMenu = (props: Props) => {
43
+ const LayoutWithMenu = () => {
52
44
  const {
53
45
  plugins,
54
46
  appState: { appReady },
@@ -61,7 +53,7 @@ const LayoutWithMenu = (props: Props) => {
61
53
  setOpenMenu,
62
54
  closeMenu,
63
55
  setCloseMenu,
64
- } = props;
56
+ } = useMenuToggleContext();
65
57
 
66
58
  const dimensions = useDimensions("screen", { fullDimensions: true });
67
59
  const isRTL = useIsRTL();
@@ -78,7 +70,10 @@ const LayoutWithMenu = (props: Props) => {
78
70
  activeRiver,
79
71
  plugins
80
72
  ) as React.ComponentType<
81
- MobileNavBarPluginProps & { navigator: ZappNavigation }
73
+ MobileNavBarPluginProps &
74
+ MenuToggleContextType & {
75
+ navigator: QuickBrickAppNavigator;
76
+ }
82
77
  >,
83
78
  []
84
79
  );
@@ -101,23 +96,31 @@ const LayoutWithMenu = (props: Props) => {
101
96
  [bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
102
97
  );
103
98
 
104
- const menuProps = {
105
- setToggleMenu: setToggleMenu,
106
- toggleMenu: toggleMenu,
107
- openMenu: openMenu,
108
- setOpenMenu: setOpenMenu,
109
- closeMenu: closeMenu,
110
- setCloseMenu: setCloseMenu,
111
- dimensions: { window: dimensions },
112
- navigator,
113
- ...getNavigationProps({
99
+ const menuProps = React.useMemo(() => {
100
+ const navigationProps = getNavigationProps({
114
101
  navigator,
115
102
  title,
116
103
  category: "menu",
117
- }),
118
- bottomTabBarHeight,
119
- isRTL,
120
- };
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]);
121
124
 
122
125
  useListenEventBusEvent(
123
126
  PushTopicManagerConsts.PushTopicManagerSubscriptionID,
@@ -144,14 +147,22 @@ const LayoutWithMenu = (props: Props) => {
144
147
  <Screen
145
148
  key={navigator.currentRoute}
146
149
  pathname={navigator.currentRoute} // required by TransitionerComponent
147
- screenData={navigator.screenData} // required by TransitionerComponent
148
- setToggleMenu={setToggleMenu}
149
- setCloseMenu={setCloseMenu}
150
+ screenData={navigator.data} // required by TransitionerComponent
150
151
  />
151
152
  </Transitioner>
152
153
  </View>
153
154
  ) : null}
154
- {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
+ )}
155
166
  {/* depends on active river. @TODO move below screen context */}
156
167
  {VideoModal && videoModalState.visible && <VideoModal />}
157
168
  <ZappHooksModal />
@@ -160,7 +171,6 @@ const LayoutWithMenu = (props: Props) => {
160
171
  };
161
172
 
162
173
  export const Layout = R.compose(
163
- MenuToggleContext.withConsumer,
164
174
  withDimensionsProvider,
165
175
  withModalAnimationProvider
166
176
  )(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.5553532911",
3
+ "version": "12.0.0-alpha.5624518702",
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.5553532911",
33
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5553532911",
34
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5553532911",
35
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5553532911",
36
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5553532911",
32
+ "@applicaster/quick-brick-core": "12.0.0-alpha.5624518702",
33
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5624518702",
34
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5624518702",
35
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5624518702",
36
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5624518702",
37
37
  "axios": "^0.28.0",
38
38
  "camelize": "^1.0.0",
39
39
  "query-string": "7.1.3",