@applicaster/zapp-react-native-app 12.0.0-alpha.7539319320 → 12.0.0-alpha.7604714363
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 {
|
|
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
|
|
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
|
+
});
|
package/App/Layout/index.tsx
CHANGED
|
@@ -3,12 +3,15 @@ import * as R from "ramda";
|
|
|
3
3
|
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
|
|
6
|
-
import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
7
6
|
import {
|
|
7
|
+
getNavigationProps,
|
|
8
|
+
resolveNavigationPlugin,
|
|
9
|
+
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
10
|
+
import {
|
|
11
|
+
useDimensions,
|
|
8
12
|
useGetBottomTabBarHeight,
|
|
13
|
+
useNavbarState,
|
|
9
14
|
useNavigation,
|
|
10
|
-
useDimensions,
|
|
11
|
-
useIsNavBarVisible,
|
|
12
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
16
|
import { Transitioner } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner";
|
|
14
17
|
import { transitionConfig } from "@applicaster/zapp-react-native-ui-components/Components/Transitioner/config";
|
|
@@ -20,31 +23,27 @@ import { getNavigationPluginModule } from "./layoutHelpers";
|
|
|
20
23
|
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
21
24
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
22
25
|
|
|
23
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
useMenuToggleContext,
|
|
28
|
+
MenuToggleContextType,
|
|
29
|
+
} from "@applicaster/zapp-react-native-ui-components/Contexts/MenuToggleContext";
|
|
24
30
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
25
31
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
32
|
+
import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
33
|
|
|
27
34
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
28
|
-
import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
29
35
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
setToggleMenu: () => void;
|
|
36
|
-
openMenu: any;
|
|
37
|
-
setOpenMenu: () => void;
|
|
38
|
-
closeMenu: any;
|
|
39
|
-
setCloseMenu: () => void;
|
|
40
|
-
navigator: QuickBrickAppNavigator;
|
|
41
|
-
};
|
|
36
|
+
import {
|
|
37
|
+
PushTopicManager,
|
|
38
|
+
PushTopicManagerConsts,
|
|
39
|
+
PushTopicManagerEvents,
|
|
40
|
+
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
42
41
|
|
|
43
42
|
const containerStyle = {
|
|
44
43
|
height: "100%",
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
const LayoutWithMenu = (
|
|
46
|
+
const LayoutWithMenu = () => {
|
|
48
47
|
const {
|
|
49
48
|
plugins,
|
|
50
49
|
appState: { appReady },
|
|
@@ -57,47 +56,59 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
57
56
|
setOpenMenu,
|
|
58
57
|
closeMenu,
|
|
59
58
|
setCloseMenu,
|
|
60
|
-
} =
|
|
59
|
+
} = useMenuToggleContext();
|
|
61
60
|
|
|
62
61
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
63
62
|
const isRTL = useIsRTL();
|
|
64
|
-
|
|
65
63
|
const navigator = useNavigation();
|
|
66
64
|
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
65
|
const { title } = useNavbarState();
|
|
79
66
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
68
|
+
|
|
69
|
+
const plugin = resolveNavigationPlugin({
|
|
70
|
+
category: "menu",
|
|
71
|
+
navigations: activeRiver?.navigations,
|
|
72
|
+
plugins,
|
|
73
|
+
});
|
|
84
74
|
|
|
85
75
|
const Menu = React.useMemo(
|
|
86
|
-
() =>
|
|
87
|
-
|
|
76
|
+
() =>
|
|
77
|
+
getNavigationPluginModule(
|
|
78
|
+
"menu",
|
|
79
|
+
activeRiver,
|
|
80
|
+
plugins
|
|
81
|
+
) as React.ComponentType<
|
|
82
|
+
MobileNavBarPluginProps &
|
|
83
|
+
MenuToggleContextType & {
|
|
84
|
+
navigator: QuickBrickAppNavigator;
|
|
85
|
+
}
|
|
86
|
+
>,
|
|
87
|
+
[activeRiver]
|
|
88
88
|
);
|
|
89
89
|
|
|
90
|
+
/** BTB shown when videoModalState - visible & minimized,
|
|
91
|
+
* otherwise hidden if videoModalState - visible
|
|
92
|
+
* also check isMenuVisible
|
|
93
|
+
*/
|
|
90
94
|
const showMenu = React.useMemo(
|
|
91
|
-
() =>
|
|
92
|
-
|
|
95
|
+
() =>
|
|
96
|
+
((videoModalState.visible && videoModalState.mode === "MINIMIZED") ||
|
|
97
|
+
!videoModalState.visible) &&
|
|
98
|
+
isMenuVisible(navigator.currentRoute, navigator.screenData),
|
|
99
|
+
[videoModalState.visible, videoModalState.mode, navigator.currentRoute]
|
|
93
100
|
);
|
|
94
101
|
|
|
102
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
103
|
+
|
|
104
|
+
const shouldApplyStyleForBottomTabs = showMenu && isBottomTabsPlugin;
|
|
105
|
+
|
|
95
106
|
const contentStyle = React.useMemo(
|
|
96
107
|
() => ({
|
|
97
|
-
...(
|
|
108
|
+
...(shouldApplyStyleForBottomTabs
|
|
98
109
|
? {
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
paddingBottom: bottomTabBarHeight,
|
|
111
|
+
}
|
|
101
112
|
: {}),
|
|
102
113
|
...containerStyle,
|
|
103
114
|
opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
|
|
@@ -105,37 +116,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
105
116
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
106
117
|
);
|
|
107
118
|
|
|
108
|
-
const
|
|
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
|
-
const menuProps = {
|
|
123
|
-
setToggleMenu: setToggleMenu,
|
|
124
|
-
toggleMenu: toggleMenu,
|
|
125
|
-
openMenu: openMenu,
|
|
126
|
-
setOpenMenu: setOpenMenu,
|
|
127
|
-
closeMenu: closeMenu,
|
|
128
|
-
setCloseMenu: setCloseMenu,
|
|
129
|
-
dimensions: { window: dimensions },
|
|
130
|
-
navigator: navigator,
|
|
131
|
-
...getNavigationProps({
|
|
119
|
+
const menuProps = React.useMemo(() => {
|
|
120
|
+
const navigationProps = getNavigationProps({
|
|
132
121
|
navigator,
|
|
133
122
|
title,
|
|
134
123
|
category: "menu",
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
}) ?? {
|
|
125
|
+
selected: "",
|
|
126
|
+
title: "",
|
|
127
|
+
home: false,
|
|
128
|
+
rules: {} as ZappNavBarRules,
|
|
129
|
+
assets: {} as ZappNavBarAssets,
|
|
130
|
+
styles: {},
|
|
131
|
+
nav_items: [] as NavBarItem[],
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const props = {
|
|
135
|
+
...navigationProps,
|
|
136
|
+
dimensions: { window: dimensions },
|
|
137
|
+
bottomTabBarHeight,
|
|
138
|
+
isRTL,
|
|
139
|
+
navigator,
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return { ...props, id: navigator.currentRoute };
|
|
143
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
139
144
|
|
|
140
145
|
useListenEventBusEvent(
|
|
141
146
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -155,31 +160,36 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
155
160
|
<View style={contentStyle}>
|
|
156
161
|
<Transitioner
|
|
157
162
|
transitionConfig={transitionConfig}
|
|
158
|
-
contentStyle={
|
|
163
|
+
contentStyle={{}}
|
|
159
164
|
isRTL={isRTL}
|
|
160
165
|
>
|
|
161
166
|
<Screen
|
|
162
167
|
key={navigator.currentRoute}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Menu={Menu}
|
|
166
|
-
menuProps={menuProps}
|
|
167
|
-
pathname={currentRoute}
|
|
168
|
-
screenData={screenData}
|
|
169
|
-
isNavBarVisible={isNavBarVisible}
|
|
168
|
+
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
169
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
170
170
|
/>
|
|
171
171
|
</Transitioner>
|
|
172
172
|
</View>
|
|
173
173
|
) : null}
|
|
174
|
-
{showMenu &&
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
{showMenu && (
|
|
175
|
+
<Menu
|
|
176
|
+
{...menuProps}
|
|
177
|
+
setToggleMenu={setToggleMenu}
|
|
178
|
+
toggleMenu={toggleMenu}
|
|
179
|
+
openMenu={openMenu}
|
|
180
|
+
setOpenMenu={setOpenMenu}
|
|
181
|
+
closeMenu={closeMenu}
|
|
182
|
+
setCloseMenu={setCloseMenu}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
{/* depends on active river. @TODO move below screen context */}
|
|
186
|
+
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
177
187
|
<ZappHooksModal />
|
|
178
188
|
</>
|
|
179
189
|
);
|
|
180
190
|
};
|
|
181
191
|
|
|
182
192
|
export const Layout = R.compose(
|
|
183
|
-
|
|
184
|
-
|
|
193
|
+
withDimensionsProvider,
|
|
194
|
+
withModalAnimationProvider
|
|
185
195
|
)(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.
|
|
3
|
+
"version": "12.0.0-alpha.7604714363",
|
|
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.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
36
|
-
"axios": "^0.
|
|
32
|
+
"@applicaster/quick-brick-core": "12.0.0-alpha.7604714363",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7604714363",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.7604714363",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-alpha.7604714363",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.7604714363",
|
|
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
|
},
|