@applicaster/zapp-react-native-app 12.0.0-rc.9 → 12.0.0-rc.91
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,34 +56,35 @@ 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
90
|
const showMenu = React.useMemo(
|
|
@@ -92,12 +92,16 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
92
92
|
[navigator.currentRoute]
|
|
93
93
|
);
|
|
94
94
|
|
|
95
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
96
|
+
|
|
97
|
+
const shouldApplyStyleForBottomTabs = showMenu && isBottomTabsPlugin;
|
|
98
|
+
|
|
95
99
|
const contentStyle = React.useMemo(
|
|
96
100
|
() => ({
|
|
97
|
-
...(
|
|
101
|
+
...(shouldApplyStyleForBottomTabs
|
|
98
102
|
? {
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
paddingBottom: bottomTabBarHeight,
|
|
104
|
+
}
|
|
101
105
|
: {}),
|
|
102
106
|
...containerStyle,
|
|
103
107
|
opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
|
|
@@ -105,37 +109,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
105
109
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
106
110
|
);
|
|
107
111
|
|
|
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({
|
|
112
|
+
const menuProps = React.useMemo(() => {
|
|
113
|
+
const navigationProps = getNavigationProps({
|
|
132
114
|
navigator,
|
|
133
115
|
title,
|
|
134
116
|
category: "menu",
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
117
|
+
}) ?? {
|
|
118
|
+
selected: "",
|
|
119
|
+
title: "",
|
|
120
|
+
home: false,
|
|
121
|
+
rules: {} as ZappNavBarRules,
|
|
122
|
+
assets: {} as ZappNavBarAssets,
|
|
123
|
+
styles: {},
|
|
124
|
+
nav_items: [] as NavBarItem[],
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const props = {
|
|
128
|
+
...navigationProps,
|
|
129
|
+
dimensions: { window: dimensions },
|
|
130
|
+
bottomTabBarHeight,
|
|
131
|
+
isRTL,
|
|
132
|
+
navigator,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
return { ...props, id: navigator.currentRoute };
|
|
136
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
139
137
|
|
|
140
138
|
useListenEventBusEvent(
|
|
141
139
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -158,28 +156,34 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
158
156
|
contentStyle={showMenu ? contentStyle : {}}
|
|
159
157
|
isRTL={isRTL}
|
|
160
158
|
>
|
|
159
|
+
{/* has pathname context */}
|
|
161
160
|
<Screen
|
|
162
161
|
key={navigator.currentRoute}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Menu={Menu}
|
|
166
|
-
menuProps={menuProps}
|
|
167
|
-
pathname={currentRoute}
|
|
168
|
-
screenData={screenData}
|
|
169
|
-
isNavBarVisible={isNavBarVisible}
|
|
162
|
+
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
163
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
170
164
|
/>
|
|
171
165
|
</Transitioner>
|
|
172
166
|
</View>
|
|
173
167
|
) : null}
|
|
174
|
-
{showMenu &&
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
{showMenu && (
|
|
169
|
+
<Menu
|
|
170
|
+
{...menuProps}
|
|
171
|
+
setToggleMenu={setToggleMenu}
|
|
172
|
+
toggleMenu={toggleMenu}
|
|
173
|
+
openMenu={openMenu}
|
|
174
|
+
setOpenMenu={setOpenMenu}
|
|
175
|
+
closeMenu={closeMenu}
|
|
176
|
+
setCloseMenu={setCloseMenu}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
{/* depends on active river. @TODO move below screen context */}
|
|
180
|
+
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
177
181
|
<ZappHooksModal />
|
|
178
182
|
</>
|
|
179
183
|
);
|
|
180
184
|
};
|
|
181
185
|
|
|
182
186
|
export const Layout = R.compose(
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
withDimensionsProvider,
|
|
188
|
+
withModalAnimationProvider
|
|
185
189
|
)(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-rc.
|
|
3
|
+
"version": "12.0.0-rc.91",
|
|
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-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
36
|
-
"axios": "^0.
|
|
32
|
+
"@applicaster/quick-brick-core": "12.0.0-rc.91",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.91",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.91",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.91",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.91",
|
|
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
|
},
|