@applicaster/zapp-react-native-app 12.0.0-alpha.9531194637 → 12.0.0-alpha.9834532023

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.
@@ -32,22 +32,20 @@ import {
32
32
  PushTopicManagerEvents,
33
33
  } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
34
34
 
35
- type Props = {
36
- children: React.ReactNode;
35
+ type MenuToggleContextType = {
37
36
  toggleMenu: any;
38
37
  setToggleMenu: () => void;
39
38
  openMenu: any;
40
39
  setOpenMenu: () => void;
41
40
  closeMenu: any;
42
41
  setCloseMenu: () => void;
43
- navigator: QuickBrickAppNavigator;
44
42
  };
45
43
 
46
44
  const containerStyle = {
47
45
  height: "100%",
48
46
  };
49
47
 
50
- const LayoutWithMenu = (props: Props) => {
48
+ const LayoutWithMenu = () => {
51
49
  const {
52
50
  plugins,
53
51
  appState: { appReady },
@@ -60,7 +58,7 @@ const LayoutWithMenu = (props: Props) => {
60
58
  setOpenMenu,
61
59
  closeMenu,
62
60
  setCloseMenu,
63
- } = props;
61
+ } = React.useContext<MenuToggleContextType>(MenuToggleContext.ReactContext);
64
62
 
65
63
  const dimensions = useDimensions("screen", { fullDimensions: true });
66
64
  const isRTL = useIsRTL();
@@ -77,7 +75,10 @@ const LayoutWithMenu = (props: Props) => {
77
75
  activeRiver,
78
76
  plugins
79
77
  ) as React.ComponentType<
80
- MobileNavBarPluginProps & { navigator: ZappNavigation }
78
+ MobileNavBarPluginProps &
79
+ MenuToggleContextType & {
80
+ navigator: QuickBrickAppNavigator;
81
+ }
81
82
  >,
82
83
  []
83
84
  );
@@ -100,23 +101,31 @@ const LayoutWithMenu = (props: Props) => {
100
101
  [bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
101
102
  );
102
103
 
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({
104
+ const menuProps = React.useMemo(() => {
105
+ const navigationProps = getNavigationProps({
113
106
  navigator,
114
107
  title,
115
108
  category: "menu",
116
- }),
117
- bottomTabBarHeight,
118
- isRTL,
119
- };
109
+ }) ?? {
110
+ selected: "",
111
+ title: "",
112
+ home: false,
113
+ rules: {} as ZappNavBarRules,
114
+ assets: {} as ZappNavBarAssets,
115
+ styles: {},
116
+ nav_items: [] as NavBarItem[],
117
+ };
118
+
119
+ const props = {
120
+ ...navigationProps,
121
+ dimensions: { window: dimensions },
122
+ bottomTabBarHeight,
123
+ isRTL,
124
+ navigator,
125
+ };
126
+
127
+ return { ...props, id: navigator.currentRoute };
128
+ }, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
120
129
 
121
130
  useListenEventBusEvent(
122
131
  PushTopicManagerConsts.PushTopicManagerSubscriptionID,
@@ -144,13 +153,21 @@ const LayoutWithMenu = (props: Props) => {
144
153
  key={navigator.currentRoute}
145
154
  pathname={navigator.currentRoute} // required by TransitionerComponent
146
155
  screenData={navigator.screenData} // required by TransitionerComponent
147
- setToggleMenu={setToggleMenu}
148
- setCloseMenu={setCloseMenu}
149
156
  />
150
157
  </Transitioner>
151
158
  </View>
152
159
  ) : null}
153
- {showMenu && <Menu {...{ ...menuProps, id: navigator.currentRoute }} />}
160
+ {showMenu && (
161
+ <Menu
162
+ {...menuProps}
163
+ setToggleMenu={setToggleMenu}
164
+ toggleMenu={toggleMenu}
165
+ openMenu={openMenu}
166
+ setOpenMenu={setOpenMenu}
167
+ closeMenu={closeMenu}
168
+ setCloseMenu={setCloseMenu}
169
+ />
170
+ )}
154
171
  {/* depends on active river. @TODO move below screen context */}
155
172
  {VideoModal && videoModalState.visible && <VideoModal />}
156
173
  <ZappHooksModal />
@@ -158,7 +175,4 @@ const LayoutWithMenu = (props: Props) => {
158
175
  );
159
176
  };
160
177
 
161
- export const Layout = R.compose(
162
- MenuToggleContext.withConsumer,
163
- withDimensionsProvider
164
- )(LayoutWithMenu);
178
+ export const Layout = R.compose(withDimensionsProvider)(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.9531194637",
3
+ "version": "12.0.0-alpha.9834532023",
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.9531194637",
33
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.9531194637",
34
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.9531194637",
35
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.9531194637",
36
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.9531194637",
32
+ "@applicaster/quick-brick-core": "12.0.0-alpha.9834532023",
33
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.9834532023",
34
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.9834532023",
35
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.9834532023",
36
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.9834532023",
37
37
  "axios": "^0.28.0",
38
38
  "camelize": "^1.0.0",
39
39
  "query-string": "7.1.3",