@applicaster/zapp-react-native-app 12.0.0-alpha.7539319320 → 12.0.0-alpha.8235014824

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,
@@ -158,22 +140,20 @@ const LayoutWithMenu = (props: Props) => {
158
140
  contentStyle={showMenu ? contentStyle : {}}
159
141
  isRTL={isRTL}
160
142
  >
143
+ {/* has pathname context */}
161
144
  <Screen
162
145
  key={navigator.currentRoute}
163
- NavBar={NavBar}
164
- navBarProps={navBarProps}
165
- Menu={Menu}
166
- menuProps={menuProps}
167
- pathname={currentRoute}
168
- screenData={screenData}
169
- isNavBarVisible={isNavBarVisible}
146
+ pathname={navigator.currentRoute} // required by TransitionerComponent
147
+ screenData={navigator.screenData} // required by TransitionerComponent
148
+ setToggleMenu={setToggleMenu}
149
+ setCloseMenu={setCloseMenu}
170
150
  />
171
151
  </Transitioner>
172
152
  </View>
173
153
  ) : null}
174
- {showMenu && <Menu {...menuProps} />}
175
- {VideoModal && visible && <VideoModal />}
176
-
154
+ {showMenu && <Menu {...{ ...menuProps, id: navigator.currentRoute }} />}
155
+ {/* depends on active river. @TODO move below screen context */}
156
+ {VideoModal && videoModalState.visible && <VideoModal />}
177
157
  <ZappHooksModal />
178
158
  </>
179
159
  );
@@ -181,5 +161,6 @@ const LayoutWithMenu = (props: Props) => {
181
161
 
182
162
  export const Layout = R.compose(
183
163
  MenuToggleContext.withConsumer,
184
- withDimensionsProvider
164
+ withDimensionsProvider,
165
+ withModalAnimationProvider
185
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.7539319320",
3
+ "version": "12.0.0-alpha.8235014824",
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.7539319320",
32
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7539319320",
33
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7539319320",
34
- "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7539319320",
35
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7539319320",
36
- "axios": "^0.21.2",
32
+ "@applicaster/quick-brick-core": "12.0.0-alpha.8235014824",
33
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.8235014824",
34
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.8235014824",
35
+ "@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.8235014824",
36
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.8235014824",
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
+ }