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