@applicaster/zapp-react-native-app 14.0.0-alpha.5621117258 → 14.0.0-alpha.5810348423

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.
@@ -10,9 +10,46 @@ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/n
10
10
  import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";
11
11
  import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks/state";
12
12
  import { useErrorStore } from "@applicaster/quick-brick-core/App/ErrorBoundary/store";
13
+ import { isApplePlatform } from "@applicaster/zapp-react-native-utils/reactUtils";
13
14
 
14
15
  const getHome = R.compose(R.find(R.propEq("home", true)), R.values);
15
16
 
17
+ const isIOS = isApplePlatform();
18
+ /* Set to `false` in production, do not commit this change */
19
+ const IS_DEBUGGER_ENABLED = false;
20
+
21
+ /**
22
+ * This is a workaround to fix an error on start when debugger is connected.
23
+ * Update function body for this function `callNativeSyncHook`
24
+ * node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:167
25
+
26
+ this.processCallbacks(moduleID, methodID, params, onFail, onSucc);
27
+ if(global.nativeCallSyncHook) {
28
+ return global.nativeCallSyncHook(moduleID, methodID, params);
29
+ }
30
+ */
31
+
32
+ // Assign this to a dev-only button or useEffect call
33
+ const connectToRemoteDebugger = () => {
34
+ if (__DEV__ && isIOS) {
35
+ try {
36
+ const { DevSettings, NativeModules } = require("react-native");
37
+
38
+ // eslint-disable-next-line no-console
39
+ console.warn(`Debugger connected: ${IS_DEBUGGER_ENABLED}`);
40
+
41
+ if (DevSettings?.setIsDebuggingRemotely) {
42
+ DevSettings.setIsDebuggingRemotely(IS_DEBUGGER_ENABLED);
43
+ }
44
+
45
+ NativeModules?.DevSettings?.setIsDebuggingRemotely?.(IS_DEBUGGER_ENABLED);
46
+ } catch (error) {
47
+ // eslint-disable-next-line no-console
48
+ console.error(`connectToRemoteDebugger message: ${error.message}`);
49
+ }
50
+ }
51
+ };
52
+
16
53
  const InteractionManagerComponent = () => {
17
54
  const { sendHardwareBackButtonClickEvent } = useAnalytics();
18
55
  const rivers = useRivers();
@@ -66,10 +103,17 @@ const InteractionManagerComponent = () => {
66
103
  }, [navigator.currentRoute]);
67
104
 
68
105
  React.useEffect(() => {
69
- BackHandler.addEventListener("hardwareBackPress", onHardwareBackPress);
106
+ connectToRemoteDebugger();
107
+ }, []);
108
+
109
+ React.useEffect(() => {
110
+ const unsubscribe = BackHandler.addEventListener(
111
+ "hardwareBackPress",
112
+ onHardwareBackPress
113
+ );
70
114
 
71
115
  return () => {
72
- BackHandler.removeEventListener("hardwareBackPress", onHardwareBackPress);
116
+ unsubscribe.remove();
73
117
  };
74
118
  }, [onHardwareBackPress]);
75
119
 
@@ -138,6 +138,9 @@ jest.mock(
138
138
  );
139
139
 
140
140
  jest.mock("@applicaster/zapp-react-native-utils/navigationUtils", () => ({
141
+ ...(jest.requireActual(
142
+ "@applicaster/zapp-react-native-utils/navigationUtils"
143
+ ) as jest.Mock<any>),
141
144
  getNavigationProps: () => ({}),
142
145
  resolveNavigationPlugin: () => ({
143
146
  identifier: "quick-brick-bottom-tabs",
@@ -1,12 +1,9 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
3
 
4
- import { View } from "react-native";
4
+ import { View, StyleSheet } from "react-native";
5
5
 
6
- import {
7
- getNavigationProps,
8
- resolveNavigationPlugin,
9
- } from "@applicaster/zapp-react-native-utils/navigationUtils";
6
+ import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
10
7
  import {
11
8
  useDimensions,
12
9
  useGetBottomTabBarHeight,
@@ -39,10 +36,13 @@ import {
39
36
  PushTopicManagerConsts,
40
37
  PushTopicManagerEvents,
41
38
  } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
39
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
42
40
 
43
- const containerStyle = {
44
- height: "100%",
45
- };
41
+ const styles = StyleSheet.create({
42
+ container: {
43
+ height: "100%",
44
+ },
45
+ });
46
46
 
47
47
  const LayoutWithMenu = () => {
48
48
  const {
@@ -63,16 +63,11 @@ const LayoutWithMenu = () => {
63
63
  const isRTL = useIsRTL();
64
64
  const navigator = useNavigation();
65
65
  const bottomTabBarHeight = useGetBottomTabBarHeight();
66
+ const { bottom: safeAreaBottomInset } = useSafeAreaInsets();
66
67
  const { title } = useNavbarState();
67
68
 
68
69
  const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
69
70
 
70
- const plugin = resolveNavigationPlugin({
71
- category: "menu",
72
- navigations: activeRiver?.navigations,
73
- plugins,
74
- });
75
-
76
71
  const Menu = React.useMemo(
77
72
  () =>
78
73
  getNavigationPluginModule(
@@ -95,15 +90,17 @@ const LayoutWithMenu = () => {
95
90
  * also check isMenuVisible
96
91
  */
97
92
  const showMenu = React.useMemo(() => {
98
- if (!videoModalState.visible) {
99
- return isMenuVisible(navigator.currentRoute, navigator.screenData);
100
- } else {
101
- if (videoModalState.mode === "FULLSCREEN") {
102
- return false;
103
- }
104
- }
105
-
106
- return isMenuVisible(navigator.currentRoute, navigator.screenData);
93
+ const menuVisible = isMenuVisible(
94
+ navigator.currentRoute,
95
+ navigator.screenData,
96
+ plugins
97
+ );
98
+
99
+ const shouldShowWithVideo =
100
+ videoModalState.visible &&
101
+ ["MINIMIZED", "MAXIMIZED"].includes(videoModalState.mode);
102
+
103
+ return menuVisible && (shouldShowWithVideo || !videoModalState.visible);
107
104
  }, [
108
105
  videoModalState.visible,
109
106
  videoModalState.mode,
@@ -111,19 +108,18 @@ const LayoutWithMenu = () => {
111
108
  isActiveGesture,
112
109
  ]);
113
110
 
114
- const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
115
-
116
- const paddingBottom = React.useMemo(() => {
117
- return showMenu && isBottomTabsPlugin ? bottomTabBarHeight : 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
118
- }, [showMenu, isBottomTabsPlugin, bottomTabBarHeight]);
111
+ const paddingBottom = showMenu ? bottomTabBarHeight + safeAreaBottomInset : 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
119
112
 
120
113
  const contentStyle = React.useMemo(
121
- () => ({
122
- ...containerStyle,
123
- paddingBottom,
124
- opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
125
- }),
126
- [videoModalState.visible, isVideoModalDocked, paddingBottom]
114
+ () =>
115
+ StyleSheet.flatten([
116
+ styles.container,
117
+ {
118
+ paddingBottom,
119
+ opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
120
+ },
121
+ ]),
122
+ [videoModalState.visible, isVideoModalDocked]
127
123
  );
128
124
 
129
125
  const menuProps = React.useMemo(() => {
@@ -167,7 +163,7 @@ const LayoutWithMenu = () => {
167
163
  return (
168
164
  <>
169
165
  {appReady ? (
170
- <View style={containerStyle}>
166
+ <View style={styles.container}>
171
167
  <Transitioner
172
168
  transitionConfig={transitionConfig}
173
169
  contentStyle={contentStyle}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-app",
3
- "version": "14.0.0-alpha.5621117258",
3
+ "version": "14.0.0-alpha.5810348423",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,11 +27,11 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/quick-brick-core": "14.0.0-alpha.5621117258",
31
- "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.5621117258",
32
- "@applicaster/zapp-react-native-redux": "14.0.0-alpha.5621117258",
33
- "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.5621117258",
34
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.5621117258",
30
+ "@applicaster/quick-brick-core": "14.0.0-alpha.5810348423",
31
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.5810348423",
32
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.5810348423",
33
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-alpha.5810348423",
34
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.5810348423",
35
35
  "axios": "^0.28.0",
36
36
  "camelize": "^1.0.0",
37
37
  "query-string": "7.1.3",
@@ -46,23 +46,14 @@
46
46
  "@applicaster/zapp-react-native-tvos-ui-components": "*",
47
47
  "@babel/runtime": "*",
48
48
  "@react-native-community/netinfo": "*",
49
- "immer": "*",
50
49
  "react": "*",
51
50
  "react-native": "*",
52
51
  "react-native-fs": "*",
53
- "react-native-gesture-handler": "*",
54
52
  "react-native-linear-gradient": "*",
55
- "react-native-safe-area-context": "*",
56
53
  "react-native-svg": "*",
57
- "react-native-web": "*",
58
54
  "react-native-webview": "*",
59
55
  "uglify-js": "*",
60
56
  "validate-color": "*",
61
57
  "zustand": "*"
62
- },
63
- "devDependencies": {
64
- "nock": "^10.0.0",
65
- "redux-mock-store": "^1.5.3"
66
- },
67
- "gitHead": "a473487564142c55cdb50f02505cf0b60fe75658"
58
+ }
68
59
  }