@applicaster/zapp-react-native-ui-components 15.0.0-rc.44 → 15.0.0-rc.45

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.
@@ -135,17 +135,11 @@ export const BorderContainerView = (props: Props) => {
135
135
 
136
136
  const isImageOnlyCell = useMemo(
137
137
  () =>
138
- !hasFocusableInside(entry) &&
139
- !hasTextLabels &&
140
138
  state === "focused" &&
141
- !isMeasurement?.measuringInProgress,
142
- [
143
- hasFocusableInside,
144
- entry,
145
- hasTextLabels,
146
- state,
147
- isMeasurement?.measuringInProgress,
148
- ]
139
+ !hasTextLabels &&
140
+ !isMeasurement?.measuringInProgress &&
141
+ !hasFocusableInside(entry),
142
+ [entry, hasTextLabels, state, isMeasurement?.measuringInProgress]
149
143
  );
150
144
 
151
145
  useEffect(() => {
@@ -1,35 +1,19 @@
1
1
  import { resolveNavigationPlugin } from "@applicaster/zapp-react-native-utils/navigationUtils";
2
2
 
3
- /**
4
- * This function helps to decide wether the menu should be presented on the screen
5
- * based on route and / or screen Data
6
- *
7
- * is similar to the navbar, except that it covers scenarios where only the navbar (and not)
8
- * the menu, will be hidden
9
- *
10
- * - playable screens
11
- * - qb_search_screen
12
- * - screen hooks that specify showNavBar or presentFullScreen
13
- * - screens or nested screens that have allow_screen_plugin_presentation set to true
14
- *
15
- * @param {String} route current route of the screen
16
- * @param {Object} screenData payload associated with the currently presented screen
17
- * @returns {Boolean}
18
- */
19
- export function isMenuVisible(route, screenData, plugins) {
20
- const plugin = resolveNavigationPlugin({
3
+ export const BOTTOM_TABS_PLUGIN_ID = "quick-brick-bottom-tabs";
4
+
5
+ export const SIDE_MENU_PLUGIN_ID = "quick_brick_side_menu";
6
+
7
+ export function getMenuPlugin(screenData, plugins) {
8
+ return resolveNavigationPlugin({
21
9
  category: "menu",
22
10
  navigations:
23
11
  screenData?.navigations || screenData?.targetScreen?.navigations,
24
12
  plugins,
25
13
  });
14
+ }
26
15
 
27
- const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
28
-
29
- if (!isBottomTabsPlugin) {
30
- return false;
31
- }
32
-
16
+ function shouldShowNavigation(route, screenData) {
33
17
  if (route.includes("playable")) {
34
18
  return false;
35
19
  }
@@ -56,3 +40,44 @@ export function isMenuVisible(route, screenData, plugins) {
56
40
 
57
41
  return true;
58
42
  }
43
+
44
+ /**
45
+ * This function helps to decide whether the menu should be presented on the screen
46
+ * based on route and / or screen Data
47
+ *
48
+ * is similar to the navbar, except that it covers scenarios where only the navbar (and not)
49
+ * the menu will be hidden
50
+ *
51
+ * - playable screens
52
+ * - qb_search_screen
53
+ * - screen hooks that specify showNavBar or presentFullScreen
54
+ * - screens or nested screens that have allow_screen_plugin_presentation set to true
55
+ *
56
+ * @param {String} route current route of the screen
57
+ * @param {Object} screenData payload associated with the currently presented screen
58
+ * @returns {Boolean}
59
+ */
60
+ export function isMenuVisible(route, screenData, plugins) {
61
+ const plugin = getMenuPlugin(screenData, plugins);
62
+
63
+ const isBottomTabsPlugin = plugin?.identifier === BOTTOM_TABS_PLUGIN_ID;
64
+ const isSideMenuPlugin = plugin?.identifier === SIDE_MENU_PLUGIN_ID;
65
+
66
+ if (!isBottomTabsPlugin && !isSideMenuPlugin) {
67
+ return false;
68
+ }
69
+
70
+ return shouldShowNavigation(route, screenData);
71
+ }
72
+
73
+ export function isBottomTabVisible(route, screenData, plugins) {
74
+ const plugin = getMenuPlugin(screenData, plugins);
75
+
76
+ const isBottomTabsPlugin = plugin?.identifier === BOTTOM_TABS_PLUGIN_ID;
77
+
78
+ if (!isBottomTabsPlugin) {
79
+ return false;
80
+ }
81
+
82
+ return shouldShowNavigation(route, screenData);
83
+ }
@@ -5,7 +5,7 @@ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/n
5
5
 
6
6
  import { useConfiguration } from "../utils";
7
7
  import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
8
- import { isMenuVisible } from "../../Screen/navigationHandler";
8
+ import { isBottomTabVisible } from "../../Screen/navigationHandler";
9
9
 
10
10
  import {
11
11
  useSafeAreaFrame,
@@ -70,7 +70,11 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
70
70
 
71
71
  const plugins = usePlugins();
72
72
 
73
- const menuVisible = isMenuVisible(currentRoute, screenData, plugins);
73
+ const bottomTabsVisible = isBottomTabVisible(
74
+ currentRoute,
75
+ screenData,
76
+ plugins
77
+ );
74
78
 
75
79
  const frame = useSafeAreaFrame();
76
80
  const insets = useSafeAreaInsets();
@@ -115,7 +119,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
115
119
  React.useEffect(() => {
116
120
  const collapsedHeight =
117
121
  minimisedHeight +
118
- (menuVisible ? bottomTabBarHeight : 0) +
122
+ (bottomTabsVisible ? bottomTabBarHeight : 0) +
119
123
  (isOldAndroidDevice ? 0 : insets.bottom) + // insets.bottom is added to properly display docked modal
120
124
  PROGRESS_BAR_HEIGHT;
121
125
 
@@ -136,7 +140,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
136
140
  setHeightAboveMinimised(heightAboveMinimised);
137
141
  offset.current = heightAboveMinimised;
138
142
  }
139
- }, [frame.height, insets.bottom, menuVisible, minimisedHeight]);
143
+ }, [frame.height, insets.bottom, bottomTabsVisible, minimisedHeight]);
140
144
 
141
145
  return (
142
146
  <ReactContext.Provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "15.0.0-rc.44",
3
+ "version": "15.0.0-rc.45",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,10 +28,10 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "15.0.0-rc.44",
32
- "@applicaster/zapp-react-native-bridge": "15.0.0-rc.44",
33
- "@applicaster/zapp-react-native-redux": "15.0.0-rc.44",
34
- "@applicaster/zapp-react-native-utils": "15.0.0-rc.44",
31
+ "@applicaster/applicaster-types": "15.0.0-rc.45",
32
+ "@applicaster/zapp-react-native-bridge": "15.0.0-rc.45",
33
+ "@applicaster/zapp-react-native-redux": "15.0.0-rc.45",
34
+ "@applicaster/zapp-react-native-utils": "15.0.0-rc.45",
35
35
  "promise": "^8.3.0",
36
36
  "url": "^0.11.0",
37
37
  "uuid": "^3.3.2"