@applicaster/zapp-react-native-app 12.0.0-alpha.5643066061 → 12.0.0-alpha.5675222257

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.
@@ -8,7 +8,7 @@ import {
8
8
  } from "@applicaster/zapp-react-native-bridge/QuickBrick";
9
9
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
10
10
  import { useAnalytics } from "@applicaster/zapp-react-native-utils/analyticsUtils";
11
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
11
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks/state";
12
12
 
13
13
  type Props = {
14
14
  children: React.CElement,
@@ -19,7 +19,7 @@ const getHome = R.compose(R.find(R.propEq("home", true)), R.values);
19
19
  const InteractionManagerComponent = (props: Props) => {
20
20
  const { children } = props;
21
21
  const { sendHardwareBackButtonClickEvent } = useAnalytics();
22
- const { rivers } = usePickFromState(["rivers"]);
22
+ const rivers = useRivers();
23
23
  const navigator = useNavigation();
24
24
 
25
25
  const isHomeScreen = () => {
@@ -0,0 +1,7 @@
1
+ describe("Layout", () => {
2
+ it.todo("should match snapshot when appReady is true");
3
+ it.todo("should not render transitioner with screen when appReady is false");
4
+ it.todo("should render menu when showMenu is true");
5
+ it.todo("should render VideoModal when visible & VideoModal is true");
6
+ it.todo("should render ZappHooksModal");
7
+ });
@@ -8,7 +8,7 @@ import {
8
8
  useGetBottomTabBarHeight,
9
9
  useNavigation,
10
10
  useDimensions,
11
- useIsNavBarVisible,
11
+ useNavbarState,
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";
@@ -23,11 +23,15 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
23
23
  import { MenuToggleContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
24
24
  import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
25
25
  import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
26
+ import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
26
27
 
27
28
  import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
28
- import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
29
29
  import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
30
- import { PushTopicManager, PushTopicManagerConsts, PushTopicManagerEvents } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
30
+ import {
31
+ PushTopicManager,
32
+ PushTopicManagerConsts,
33
+ PushTopicManagerEvents,
34
+ } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
31
35
 
32
36
  type Props = {
33
37
  children: React.ReactNode;
@@ -61,29 +65,21 @@ const LayoutWithMenu = (props: Props) => {
61
65
 
62
66
  const dimensions = useDimensions("screen", { fullDimensions: true });
63
67
  const isRTL = useIsRTL();
64
-
65
68
  const navigator = useNavigation();
66
69
  const bottomTabBarHeight = useGetBottomTabBarHeight();
67
-
68
- const {
69
- activeRiver,
70
- currentRoute,
71
- screenData,
72
- videoModalState,
73
- isVideoModalDocked,
74
- videoModalState: { visible },
75
- } = navigator;
76
-
77
- const isNavBarVisible = useIsNavBarVisible();
78
70
  const { title } = useNavbarState();
79
71
 
80
- const NavBar = React.useMemo(
81
- () => getNavigationPluginModule("nav_bar", activeRiver, plugins),
82
- []
83
- );
72
+ const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
84
73
 
85
74
  const Menu = React.useMemo(
86
- () => getNavigationPluginModule("menu", activeRiver, plugins),
75
+ () =>
76
+ getNavigationPluginModule(
77
+ "menu",
78
+ activeRiver,
79
+ plugins
80
+ ) as React.ComponentType<
81
+ MobileNavBarPluginProps & { navigator: ZappNavigation }
82
+ >,
87
83
  []
88
84
  );
89
85
 
@@ -96,8 +92,8 @@ const LayoutWithMenu = (props: Props) => {
96
92
  () => ({
97
93
  ...(showMenu
98
94
  ? {
99
- paddingBottom: bottomTabBarHeight,
100
- }
95
+ paddingBottom: bottomTabBarHeight,
96
+ }
101
97
  : {}),
102
98
  ...containerStyle,
103
99
  opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
@@ -105,20 +101,6 @@ const LayoutWithMenu = (props: Props) => {
105
101
  [bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
106
102
  );
107
103
 
108
- const navBarProps = React.useMemo(
109
- () => ({
110
- setToggleMenu,
111
- toggleMenu,
112
- openMenu,
113
- setOpenMenu,
114
- closeMenu,
115
- setCloseMenu,
116
- navigator,
117
- ...getNavigationProps({ navigator, title, category: "nav_bar" }),
118
- }),
119
- [navigator.currentRoute]
120
- );
121
-
122
104
  const menuProps = {
123
105
  setToggleMenu: setToggleMenu,
124
106
  toggleMenu: toggleMenu,
@@ -127,7 +109,7 @@ const LayoutWithMenu = (props: Props) => {
127
109
  closeMenu: closeMenu,
128
110
  setCloseMenu: setCloseMenu,
129
111
  dimensions: { window: dimensions },
130
- navigator: navigator,
112
+ navigator,
131
113
  ...getNavigationProps({
132
114
  navigator,
133
115
  title,
@@ -144,6 +126,11 @@ const LayoutWithMenu = (props: Props) => {
144
126
  PushTopicManager.getInstance().routeEvent
145
127
  );
146
128
 
129
+ React.useEffect(() => {
130
+ // getting tags right after subscription
131
+ PushTopicManager.getInstance().prepareTags();
132
+ }, []);
133
+
147
134
  return (
148
135
  <>
149
136
  {appReady ? (
@@ -153,22 +140,20 @@ const LayoutWithMenu = (props: Props) => {
153
140
  contentStyle={showMenu ? contentStyle : {}}
154
141
  isRTL={isRTL}
155
142
  >
143
+ {/* has pathname context */}
156
144
  <Screen
157
145
  key={navigator.currentRoute}
158
- NavBar={NavBar}
159
- navBarProps={navBarProps}
160
- Menu={Menu}
161
- menuProps={menuProps}
162
- pathname={currentRoute}
163
- screenData={screenData}
164
- isNavBarVisible={isNavBarVisible}
146
+ pathname={navigator.currentRoute} // required by TransitionerComponent
147
+ screenData={navigator.screenData} // required by TransitionerComponent
148
+ setToggleMenu={setToggleMenu}
149
+ setCloseMenu={setCloseMenu}
165
150
  />
166
151
  </Transitioner>
167
152
  </View>
168
153
  ) : null}
169
- {showMenu && <Menu {...menuProps} />}
170
- {VideoModal && visible && <VideoModal />}
171
-
154
+ {showMenu && <Menu {...{ ...menuProps, id: navigator.currentRoute }} />}
155
+ {/* depends on active river. @TODO move below screen context */}
156
+ {VideoModal && videoModalState.visible && <VideoModal />}
172
157
  <ZappHooksModal />
173
158
  </>
174
159
  );
@@ -176,5 +161,6 @@ const LayoutWithMenu = (props: Props) => {
176
161
 
177
162
  export const Layout = R.compose(
178
163
  MenuToggleContext.withConsumer,
179
- withDimensionsProvider
164
+ withDimensionsProvider,
165
+ withModalAnimationProvider
180
166
  )(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,10 +1,11 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-app",
3
- "version": "12.0.0-alpha.5643066061",
3
+ "version": "12.0.0-alpha.5675222257",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "jest -w=2",
8
+ "build": "echo 'skipping ts build for core packages'",
8
9
  "flow-types": "node_modules/.bin/flow-copy-source -v -i '**/__tests__**' . ."
9
10
  },
10
11
  "repository": {
@@ -28,12 +29,12 @@
28
29
  },
29
30
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
31
  "dependencies": {
31
- "@applicaster/quick-brick-core": "12.0.0-alpha.5643066061",
32
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5643066061",
33
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5643066061",
34
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5643066061",
35
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5643066061",
36
- "axios": "^0.21.2",
32
+ "@applicaster/quick-brick-core": "12.0.0-alpha.5675222257",
33
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.5675222257",
34
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.5675222257",
35
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.5675222257",
36
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.5675222257",
37
+ "axios": "^0.28.0",
37
38
  "camelize": "^1.0.0",
38
39
  "query-string": "7.1.3",
39
40
  "react-router-native": "5.1.2",
@@ -44,7 +45,6 @@
44
45
  "react-native": "0.68.6"
45
46
  },
46
47
  "devDependencies": {
47
- "@applicaster/zapp-react-native-flow-types": "1.5.0",
48
48
  "nock": "^10.0.0",
49
49
  "redux-mock-store": "^1.5.3"
50
50
  },
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+
4
+ "compilerOptions": {
5
+ "outDir": "./lib",
6
+ "rootDir": "./src"
7
+ },
8
+
9
+ "include": ["src/**/*"],
10
+ "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"]
11
+ }