@applicaster/zapp-react-native-app 12.0.0-rc.8 → 12.0.0-rc.81
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
|
@@ -5,10 +5,10 @@ import { View } from "react-native";
|
|
|
5
5
|
|
|
6
6
|
import { getNavigationProps } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
7
7
|
import {
|
|
8
|
+
useDimensions,
|
|
8
9
|
useGetBottomTabBarHeight,
|
|
10
|
+
useNavbarState,
|
|
9
11
|
useNavigation,
|
|
10
|
-
useDimensions,
|
|
11
|
-
useIsNavBarVisible,
|
|
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";
|
|
@@ -20,31 +20,27 @@ import { getNavigationPluginModule } from "./layoutHelpers";
|
|
|
20
20
|
import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
|
|
21
21
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
useMenuToggleContext,
|
|
25
|
+
MenuToggleContextType,
|
|
26
|
+
} from "@applicaster/zapp-react-native-ui-components/Contexts/MenuToggleContext";
|
|
24
27
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
25
28
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
29
|
+
import { withModalAnimationProvider } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
26
30
|
|
|
27
31
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
28
|
-
import { useNavbarState } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
29
32
|
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
|
-
};
|
|
33
|
+
import {
|
|
34
|
+
PushTopicManager,
|
|
35
|
+
PushTopicManagerConsts,
|
|
36
|
+
PushTopicManagerEvents,
|
|
37
|
+
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
42
38
|
|
|
43
39
|
const containerStyle = {
|
|
44
40
|
height: "100%",
|
|
45
41
|
};
|
|
46
42
|
|
|
47
|
-
const LayoutWithMenu = (
|
|
43
|
+
const LayoutWithMenu = () => {
|
|
48
44
|
const {
|
|
49
45
|
plugins,
|
|
50
46
|
appState: { appReady },
|
|
@@ -57,33 +53,28 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
57
53
|
setOpenMenu,
|
|
58
54
|
closeMenu,
|
|
59
55
|
setCloseMenu,
|
|
60
|
-
} =
|
|
56
|
+
} = useMenuToggleContext();
|
|
61
57
|
|
|
62
58
|
const dimensions = useDimensions("screen", { fullDimensions: true });
|
|
63
59
|
const isRTL = useIsRTL();
|
|
64
|
-
|
|
65
60
|
const navigator = useNavigation();
|
|
66
61
|
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
62
|
const { title } = useNavbarState();
|
|
79
63
|
|
|
80
|
-
const
|
|
81
|
-
() => getNavigationPluginModule("nav_bar", activeRiver, plugins),
|
|
82
|
-
[]
|
|
83
|
-
);
|
|
64
|
+
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
84
65
|
|
|
85
66
|
const Menu = React.useMemo(
|
|
86
|
-
() =>
|
|
67
|
+
() =>
|
|
68
|
+
getNavigationPluginModule(
|
|
69
|
+
"menu",
|
|
70
|
+
activeRiver,
|
|
71
|
+
plugins
|
|
72
|
+
) as React.ComponentType<
|
|
73
|
+
MobileNavBarPluginProps &
|
|
74
|
+
MenuToggleContextType & {
|
|
75
|
+
navigator: QuickBrickAppNavigator;
|
|
76
|
+
}
|
|
77
|
+
>,
|
|
87
78
|
[]
|
|
88
79
|
);
|
|
89
80
|
|
|
@@ -96,8 +87,8 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
96
87
|
() => ({
|
|
97
88
|
...(showMenu
|
|
98
89
|
? {
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
paddingBottom: bottomTabBarHeight,
|
|
91
|
+
}
|
|
101
92
|
: {}),
|
|
102
93
|
...containerStyle,
|
|
103
94
|
opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
|
|
@@ -105,37 +96,31 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
105
96
|
[bottomTabBarHeight, videoModalState.visible, isVideoModalDocked, showMenu]
|
|
106
97
|
);
|
|
107
98
|
|
|
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({
|
|
99
|
+
const menuProps = React.useMemo(() => {
|
|
100
|
+
const navigationProps = getNavigationProps({
|
|
132
101
|
navigator,
|
|
133
102
|
title,
|
|
134
103
|
category: "menu",
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
104
|
+
}) ?? {
|
|
105
|
+
selected: "",
|
|
106
|
+
title: "",
|
|
107
|
+
home: false,
|
|
108
|
+
rules: {} as ZappNavBarRules,
|
|
109
|
+
assets: {} as ZappNavBarAssets,
|
|
110
|
+
styles: {},
|
|
111
|
+
nav_items: [] as NavBarItem[],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const props = {
|
|
115
|
+
...navigationProps,
|
|
116
|
+
dimensions: { window: dimensions },
|
|
117
|
+
bottomTabBarHeight,
|
|
118
|
+
isRTL,
|
|
119
|
+
navigator,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
return { ...props, id: navigator.currentRoute };
|
|
123
|
+
}, [dimensions, isRTL, bottomTabBarHeight, navigator.currentRoute]);
|
|
139
124
|
|
|
140
125
|
useListenEventBusEvent(
|
|
141
126
|
PushTopicManagerConsts.PushTopicManagerSubscriptionID,
|
|
@@ -158,28 +143,34 @@ const LayoutWithMenu = (props: Props) => {
|
|
|
158
143
|
contentStyle={showMenu ? contentStyle : {}}
|
|
159
144
|
isRTL={isRTL}
|
|
160
145
|
>
|
|
146
|
+
{/* has pathname context */}
|
|
161
147
|
<Screen
|
|
162
148
|
key={navigator.currentRoute}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Menu={Menu}
|
|
166
|
-
menuProps={menuProps}
|
|
167
|
-
pathname={currentRoute}
|
|
168
|
-
screenData={screenData}
|
|
169
|
-
isNavBarVisible={isNavBarVisible}
|
|
149
|
+
pathname={navigator.currentRoute} // required by TransitionerComponent
|
|
150
|
+
screenData={navigator.data} // required by TransitionerComponent
|
|
170
151
|
/>
|
|
171
152
|
</Transitioner>
|
|
172
153
|
</View>
|
|
173
154
|
) : null}
|
|
174
|
-
{showMenu &&
|
|
175
|
-
|
|
176
|
-
|
|
155
|
+
{showMenu && (
|
|
156
|
+
<Menu
|
|
157
|
+
{...menuProps}
|
|
158
|
+
setToggleMenu={setToggleMenu}
|
|
159
|
+
toggleMenu={toggleMenu}
|
|
160
|
+
openMenu={openMenu}
|
|
161
|
+
setOpenMenu={setOpenMenu}
|
|
162
|
+
closeMenu={closeMenu}
|
|
163
|
+
setCloseMenu={setCloseMenu}
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
{/* depends on active river. @TODO move below screen context */}
|
|
167
|
+
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
177
168
|
<ZappHooksModal />
|
|
178
169
|
</>
|
|
179
170
|
);
|
|
180
171
|
};
|
|
181
172
|
|
|
182
173
|
export const Layout = R.compose(
|
|
183
|
-
|
|
184
|
-
|
|
174
|
+
withDimensionsProvider,
|
|
175
|
+
withModalAnimationProvider
|
|
185
176
|
)(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.81",
|
|
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.81",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.81",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.81",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.0-rc.81",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.81",
|
|
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
|
},
|