@applicaster/zapp-react-native-app 14.0.0-rc.9 → 12.0.26-rc.1
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.
- package/App/Layout/__tests__/__snapshots__/index.test.tsx.snap +70 -51
- package/App/Layout/__tests__/index.test.tsx +36 -76
- package/App/Layout/index.tsx +22 -28
- package/App/__tests__/__snapshots__/app.test.js.snap +49 -1
- package/App/__tests__/app.test.js +15 -11
- package/App/index.ts +6 -0
- package/package.json +12 -28
|
@@ -4,8 +4,8 @@ exports[`Layout should match snapshot when appReady is true 1`] = `
|
|
|
4
4
|
<RNCSafeAreaProvider
|
|
5
5
|
onInsetsChange={[Function]}
|
|
6
6
|
style={
|
|
7
|
-
[
|
|
8
|
-
{
|
|
7
|
+
Array [
|
|
8
|
+
Object {
|
|
9
9
|
"flex": 1,
|
|
10
10
|
},
|
|
11
11
|
undefined,
|
|
@@ -13,66 +13,85 @@ exports[`Layout should match snapshot when appReady is true 1`] = `
|
|
|
13
13
|
}
|
|
14
14
|
>
|
|
15
15
|
<View
|
|
16
|
+
onLayout={[Function]}
|
|
16
17
|
style={
|
|
17
|
-
{
|
|
18
|
-
"
|
|
18
|
+
Object {
|
|
19
|
+
"flex": 1,
|
|
19
20
|
}
|
|
20
21
|
}
|
|
22
|
+
testID="on-layout-view"
|
|
21
23
|
>
|
|
22
24
|
<View
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"paddingBottom": 50,
|
|
25
|
+
style={
|
|
26
|
+
Object {
|
|
27
|
+
"display": "none",
|
|
28
|
+
"flex": 1,
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
isRTL={false}
|
|
31
|
-
testID="transitioner"
|
|
32
|
-
transitionConfig={[Function]}
|
|
33
31
|
>
|
|
34
32
|
<View
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
style={
|
|
34
|
+
Object {
|
|
35
|
+
"height": "100%",
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<View
|
|
40
|
+
contentStyle={
|
|
41
|
+
Object {
|
|
42
|
+
"height": "100%",
|
|
43
|
+
"opacity": 1,
|
|
44
|
+
"paddingBottom": 50,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
isRTL={false}
|
|
48
|
+
testID="transitioner"
|
|
49
|
+
transitionConfig={[Function]}
|
|
50
|
+
>
|
|
51
|
+
<View
|
|
52
|
+
pathname="home"
|
|
53
|
+
screenData={Object {}}
|
|
54
|
+
/>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
<View
|
|
58
|
+
bottomTabBarHeight={50}
|
|
59
|
+
closeMenu={[MockFunction]}
|
|
60
|
+
dimensions={
|
|
61
|
+
Object {
|
|
62
|
+
"window": Object {
|
|
63
|
+
"height": 100,
|
|
64
|
+
"width": 100,
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
id="home"
|
|
69
|
+
isRTL={false}
|
|
70
|
+
navigator={
|
|
71
|
+
Object {
|
|
72
|
+
"activeRiver": Object {
|
|
73
|
+
"navigations": Array [],
|
|
74
|
+
},
|
|
75
|
+
"currentRoute": "home",
|
|
76
|
+
"data": Object {},
|
|
77
|
+
"isVideoModalDocked": false,
|
|
78
|
+
"videoModalState": Object {
|
|
79
|
+
"mode": "MINIMIZED",
|
|
80
|
+
"visible": false,
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
openMenu={[MockFunction]}
|
|
85
|
+
setCloseMenu={[MockFunction]}
|
|
86
|
+
setOpenMenu={[MockFunction]}
|
|
87
|
+
setToggleMenu={[MockFunction]}
|
|
88
|
+
testID="menu"
|
|
89
|
+
toggleMenu={[MockFunction]}
|
|
90
|
+
/>
|
|
91
|
+
<View
|
|
92
|
+
testID="zappHooksModal"
|
|
37
93
|
/>
|
|
38
94
|
</View>
|
|
39
95
|
</View>
|
|
40
|
-
<View
|
|
41
|
-
bottomTabBarHeight={50}
|
|
42
|
-
closeMenu={[MockFunction]}
|
|
43
|
-
dimensions={
|
|
44
|
-
{
|
|
45
|
-
"window": {
|
|
46
|
-
"height": 100,
|
|
47
|
-
"width": 100,
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
id="home"
|
|
52
|
-
isRTL={false}
|
|
53
|
-
navigator={
|
|
54
|
-
{
|
|
55
|
-
"activeRiver": {
|
|
56
|
-
"navigations": [],
|
|
57
|
-
},
|
|
58
|
-
"currentRoute": "home",
|
|
59
|
-
"data": {},
|
|
60
|
-
"isVideoModalDocked": false,
|
|
61
|
-
"videoModalState": {
|
|
62
|
-
"mode": "MINIMIZED",
|
|
63
|
-
"visible": false,
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
openMenu={[MockFunction]}
|
|
68
|
-
setCloseMenu={[MockFunction]}
|
|
69
|
-
setOpenMenu={[MockFunction]}
|
|
70
|
-
setToggleMenu={[MockFunction]}
|
|
71
|
-
testID="menu"
|
|
72
|
-
toggleMenu={[MockFunction]}
|
|
73
|
-
/>
|
|
74
|
-
<View
|
|
75
|
-
testID="zappHooksModal"
|
|
76
|
-
/>
|
|
77
96
|
</RNCSafeAreaProvider>
|
|
78
97
|
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
2
3
|
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
3
4
|
|
|
4
5
|
const mockUseMenuToggleContext = jest.fn(() => ({
|
|
@@ -10,39 +11,25 @@ const mockUseMenuToggleContext = jest.fn(() => ({
|
|
|
10
11
|
setCloseMenu: jest.fn(),
|
|
11
12
|
}));
|
|
12
13
|
|
|
13
|
-
jest.mock("../layoutHelpers", () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line react/display-name
|
|
18
|
-
getNavigationPluginModule: () => (props) => (
|
|
19
|
-
<View testID="menu" {...props} />
|
|
20
|
-
),
|
|
21
|
-
};
|
|
22
|
-
});
|
|
14
|
+
jest.mock("../layoutHelpers", () => ({
|
|
15
|
+
// eslint-disable-next-line react/display-name
|
|
16
|
+
getNavigationPluginModule: () => (props) => <View testID="menu" {...props} />,
|
|
17
|
+
}));
|
|
23
18
|
|
|
24
19
|
jest.mock(
|
|
25
20
|
"@applicaster/zapp-react-native-ui-components/Components/Transitioner",
|
|
26
|
-
() => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line react/display-name
|
|
31
|
-
Transitioner: (props) => <View testID="transitioner" {...props} />,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
21
|
+
() => ({
|
|
22
|
+
// eslint-disable-next-line react/display-name
|
|
23
|
+
Transitioner: (props) => <View testID="transitioner" {...props} />,
|
|
24
|
+
})
|
|
34
25
|
);
|
|
35
26
|
|
|
36
27
|
jest.mock(
|
|
37
28
|
"@applicaster/zapp-react-native-ui-components/Components/Screen",
|
|
38
|
-
() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line react/display-name
|
|
43
|
-
Screen: (props) => <View {...props} />,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
29
|
+
() => ({
|
|
30
|
+
// eslint-disable-next-line react/display-name
|
|
31
|
+
Screen: (props) => <View {...props} />,
|
|
32
|
+
})
|
|
46
33
|
);
|
|
47
34
|
|
|
48
35
|
jest.mock(
|
|
@@ -61,12 +48,12 @@ jest.mock(
|
|
|
61
48
|
})
|
|
62
49
|
);
|
|
63
50
|
|
|
64
|
-
jest.mock(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
51
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
52
|
+
...(jest.requireActual(
|
|
53
|
+
"@applicaster/zapp-react-native-utils/reactHooks/navigation"
|
|
54
|
+
) as {}),
|
|
55
|
+
useGetBottomTabBarHeight: jest.fn(() => 50),
|
|
56
|
+
}));
|
|
70
57
|
|
|
71
58
|
jest.mock(
|
|
72
59
|
"@applicaster/zapp-react-native-utils/reactHooks/layout/useDimensions",
|
|
@@ -87,25 +74,17 @@ jest.mock("@applicaster/zapp-react-native-utils/localizationUtils", () => ({
|
|
|
87
74
|
}));
|
|
88
75
|
|
|
89
76
|
jest.mock(
|
|
90
|
-
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation",
|
|
91
|
-
() => ({
|
|
92
|
-
withModalAnimationProvider: jest.fn((Component) => Component),
|
|
93
|
-
})
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
jest.mock(
|
|
97
|
-
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/useModalAnimationContext",
|
|
77
|
+
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext",
|
|
98
78
|
() => ({
|
|
79
|
+
...(jest.requireActual(
|
|
80
|
+
"@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation/ModalAnimationContext"
|
|
81
|
+
) as {}),
|
|
99
82
|
useModalAnimationContext: jest.fn(() => ({
|
|
100
83
|
isActiveGesture: false,
|
|
101
84
|
})),
|
|
102
85
|
})
|
|
103
86
|
);
|
|
104
87
|
|
|
105
|
-
jest.mock("@applicaster/zapp-react-native-utils/dimensionsProvider", () => ({
|
|
106
|
-
withDimensionsProvider: jest.fn((Component) => Component),
|
|
107
|
-
}));
|
|
108
|
-
|
|
109
88
|
jest.mock(
|
|
110
89
|
"@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler",
|
|
111
90
|
() => ({
|
|
@@ -115,26 +94,18 @@ jest.mock(
|
|
|
115
94
|
|
|
116
95
|
jest.mock(
|
|
117
96
|
"@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal",
|
|
118
|
-
() => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// eslint-disable-next-line react/display-name
|
|
123
|
-
ZappHooksModal: (props) => <View testID="zappHooksModal" {...props} />,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
97
|
+
() => ({
|
|
98
|
+
// eslint-disable-next-line react/display-name
|
|
99
|
+
ZappHooksModal: (props) => <View testID="zappHooksModal" {...props} />,
|
|
100
|
+
})
|
|
126
101
|
);
|
|
127
102
|
|
|
128
103
|
jest.mock(
|
|
129
104
|
"@applicaster/zapp-react-native-ui-components/Components/VideoModal",
|
|
130
|
-
() => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
// eslint-disable-next-line react/display-name
|
|
135
|
-
VideoModal: (props) => <View testID="videoModal" {...props} />,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
105
|
+
() => ({
|
|
106
|
+
// eslint-disable-next-line react/display-name
|
|
107
|
+
VideoModal: (props) => <View testID="videoModal" {...props} />,
|
|
108
|
+
})
|
|
138
109
|
);
|
|
139
110
|
|
|
140
111
|
jest.mock("@applicaster/zapp-react-native-utils/navigationUtils", () => ({
|
|
@@ -147,16 +118,6 @@ jest.mock("@applicaster/zapp-react-native-utils/navigationUtils", () => ({
|
|
|
147
118
|
const { Layout } = require("../");
|
|
148
119
|
|
|
149
120
|
describe("Layout", () => {
|
|
150
|
-
beforeAll(() => {
|
|
151
|
-
mockUseNavigation.mockImplementation(() => ({
|
|
152
|
-
activeRiver: { navigations: [] },
|
|
153
|
-
videoModalState: { visible: false, mode: "MINIMIZED" },
|
|
154
|
-
isVideoModalDocked: false,
|
|
155
|
-
currentRoute: "home",
|
|
156
|
-
data: {},
|
|
157
|
-
}));
|
|
158
|
-
});
|
|
159
|
-
|
|
160
121
|
beforeEach(() => {
|
|
161
122
|
jest.clearAllMocks();
|
|
162
123
|
|
|
@@ -171,7 +132,6 @@ describe("Layout", () => {
|
|
|
171
132
|
|
|
172
133
|
it("should match snapshot when appReady is true", () => {
|
|
173
134
|
const { toJSON } = renderWithProviders(<Layout />);
|
|
174
|
-
|
|
175
135
|
expect(toJSON()).toMatchSnapshot();
|
|
176
136
|
});
|
|
177
137
|
|
|
@@ -187,8 +147,8 @@ describe("Layout", () => {
|
|
|
187
147
|
});
|
|
188
148
|
|
|
189
149
|
it("should render menu when showMenu is true", () => {
|
|
190
|
-
const {
|
|
191
|
-
expect(
|
|
150
|
+
const { getByTestId } = renderWithProviders(<Layout />);
|
|
151
|
+
expect(getByTestId("menu")).toBeTruthy();
|
|
192
152
|
});
|
|
193
153
|
|
|
194
154
|
it("should render VideoModal when visible & VideoModal is true", () => {
|
|
@@ -220,9 +180,9 @@ describe("Layout", () => {
|
|
|
220
180
|
|
|
221
181
|
const { getByTestId } = renderWithProviders(<Layout />);
|
|
222
182
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
)
|
|
183
|
+
expect(getByTestId("transitioner").props.contentStyle.paddingBottom).toBe(
|
|
184
|
+
50
|
|
185
|
+
);
|
|
226
186
|
});
|
|
227
187
|
|
|
228
188
|
it("transitioner should have contentStyle with specific styles", () => {
|
package/App/Layout/index.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
|
-
import { View
|
|
4
|
+
import { View } from "react-native";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
getNavigationProps,
|
|
@@ -24,13 +24,15 @@ import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Comp
|
|
|
24
24
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
|
-
MenuToggleContextType,
|
|
28
27
|
useMenuToggleContext,
|
|
28
|
+
MenuToggleContextType,
|
|
29
29
|
} from "@applicaster/zapp-react-native-ui-components/Contexts/MenuToggleContext";
|
|
30
30
|
import { VideoModal } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal";
|
|
31
31
|
import { withDimensionsProvider } from "@applicaster/zapp-react-native-utils/dimensionsProvider";
|
|
32
|
-
import {
|
|
33
|
-
|
|
32
|
+
import {
|
|
33
|
+
withModalAnimationProvider,
|
|
34
|
+
useModalAnimationContext,
|
|
35
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
34
36
|
|
|
35
37
|
import { ZappHooksModal } from "@applicaster/zapp-react-dom-ui-components/Components/ZappHooksModal";
|
|
36
38
|
import { useListenEventBusEvent } from "@applicaster/zapp-react-native-utils/reactHooks/useListenEventBusEvent";
|
|
@@ -39,13 +41,10 @@ import {
|
|
|
39
41
|
PushTopicManagerConsts,
|
|
40
42
|
PushTopicManagerEvents,
|
|
41
43
|
} from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
42
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
43
44
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
});
|
|
45
|
+
const containerStyle = {
|
|
46
|
+
height: "100%",
|
|
47
|
+
};
|
|
49
48
|
|
|
50
49
|
const LayoutWithMenu = () => {
|
|
51
50
|
const {
|
|
@@ -66,7 +65,6 @@ const LayoutWithMenu = () => {
|
|
|
66
65
|
const isRTL = useIsRTL();
|
|
67
66
|
const navigator = useNavigation();
|
|
68
67
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
69
|
-
const { bottom: safeAreaBottomInset } = useSafeAreaInsets();
|
|
70
68
|
const { title } = useNavbarState();
|
|
71
69
|
|
|
72
70
|
const { activeRiver, videoModalState, isVideoModalDocked } = navigator;
|
|
@@ -115,21 +113,17 @@ const LayoutWithMenu = () => {
|
|
|
115
113
|
|
|
116
114
|
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
117
115
|
|
|
118
|
-
const paddingBottom =
|
|
119
|
-
showMenu && isBottomTabsPlugin
|
|
120
|
-
|
|
121
|
-
: 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
|
|
116
|
+
const paddingBottom = React.useMemo(() => {
|
|
117
|
+
return showMenu && isBottomTabsPlugin ? bottomTabBarHeight : 0; // if activeRiver?.navigations has quick-brick-bottom-tabs - append bottomTabBarHeight as padding
|
|
118
|
+
}, [showMenu, isBottomTabsPlugin, bottomTabBarHeight]);
|
|
122
119
|
|
|
123
120
|
const contentStyle = React.useMemo(
|
|
124
|
-
() =>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
]),
|
|
132
|
-
[videoModalState.visible, isVideoModalDocked]
|
|
121
|
+
() => ({
|
|
122
|
+
...containerStyle,
|
|
123
|
+
paddingBottom,
|
|
124
|
+
opacity: videoModalState.visible && !isVideoModalDocked ? 0 : 1,
|
|
125
|
+
}),
|
|
126
|
+
[videoModalState.visible, isVideoModalDocked, paddingBottom]
|
|
133
127
|
);
|
|
134
128
|
|
|
135
129
|
const menuProps = React.useMemo(() => {
|
|
@@ -173,7 +167,7 @@ const LayoutWithMenu = () => {
|
|
|
173
167
|
return (
|
|
174
168
|
<>
|
|
175
169
|
{appReady ? (
|
|
176
|
-
<View style={
|
|
170
|
+
<View style={containerStyle}>
|
|
177
171
|
<Transitioner
|
|
178
172
|
transitionConfig={transitionConfig}
|
|
179
173
|
contentStyle={contentStyle}
|
|
@@ -187,7 +181,7 @@ const LayoutWithMenu = () => {
|
|
|
187
181
|
</Transitioner>
|
|
188
182
|
</View>
|
|
189
183
|
) : null}
|
|
190
|
-
{showMenu
|
|
184
|
+
{showMenu && (
|
|
191
185
|
<Menu
|
|
192
186
|
{...menuProps}
|
|
193
187
|
setToggleMenu={setToggleMenu}
|
|
@@ -197,9 +191,9 @@ const LayoutWithMenu = () => {
|
|
|
197
191
|
closeMenu={closeMenu}
|
|
198
192
|
setCloseMenu={setCloseMenu}
|
|
199
193
|
/>
|
|
200
|
-
)
|
|
194
|
+
)}
|
|
201
195
|
{/* depends on active river. @TODO move below screen context */}
|
|
202
|
-
{VideoModal && videoModalState.visible
|
|
196
|
+
{VideoModal && videoModalState.visible && <VideoModal />}
|
|
203
197
|
<ZappHooksModal />
|
|
204
198
|
</>
|
|
205
199
|
);
|
|
@@ -1,3 +1,51 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<ZappApp /> renders correctly 1`] = `
|
|
3
|
+
exports[`<ZappApp /> renders correctly 1`] = `
|
|
4
|
+
<ContextProvider
|
|
5
|
+
value={null}
|
|
6
|
+
>
|
|
7
|
+
<WithContextProviderComponent
|
|
8
|
+
appSettings={
|
|
9
|
+
Object {
|
|
10
|
+
"runtimeConfigurationUrls": Object {
|
|
11
|
+
"cell_styles_url": "http://zapp.com/cell_styles.json",
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
components={
|
|
16
|
+
Object {
|
|
17
|
+
"AppContainer": [Function],
|
|
18
|
+
"Screen": [Function],
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
dispatch={[Function]}
|
|
22
|
+
rivers={
|
|
23
|
+
Array [
|
|
24
|
+
Object {
|
|
25
|
+
"home": false,
|
|
26
|
+
"id": "1",
|
|
27
|
+
},
|
|
28
|
+
Object {
|
|
29
|
+
"home": true,
|
|
30
|
+
"id": 2,
|
|
31
|
+
},
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
store={
|
|
35
|
+
Object {
|
|
36
|
+
"clearActions": [Function],
|
|
37
|
+
"dispatch": [Function],
|
|
38
|
+
"getActions": [Function],
|
|
39
|
+
"getState": [Function],
|
|
40
|
+
"replaceReducer": [Function],
|
|
41
|
+
"subscribe": [Function],
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
styles={
|
|
45
|
+
Object {
|
|
46
|
+
"color": "blue",
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/>
|
|
50
|
+
</ContextProvider>
|
|
51
|
+
`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { shallow } from "enzyme";
|
|
3
|
+
import { shallowToJson } from "enzyme-to-json";
|
|
3
4
|
import configureStore from "redux-mock-store";
|
|
4
5
|
import * as R from "ramda";
|
|
5
6
|
|
|
@@ -7,7 +8,7 @@ const MockNetInfo = {
|
|
|
7
8
|
connection: { type: "none " },
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
class
|
|
11
|
+
class NativeEventEmitter {
|
|
11
12
|
constructor(eventEmitter) {
|
|
12
13
|
this.eventEmitter = eventEmitter;
|
|
13
14
|
this.listeners = [];
|
|
@@ -97,7 +98,7 @@ jest.mock("react-native", () => {
|
|
|
97
98
|
},
|
|
98
99
|
UIManager: {},
|
|
99
100
|
},
|
|
100
|
-
NativeEventEmitter:
|
|
101
|
+
NativeEventEmitter: NativeEventEmitter,
|
|
101
102
|
Easing: {
|
|
102
103
|
in: jest.fn(),
|
|
103
104
|
bezier: jest.fn(),
|
|
@@ -110,9 +111,13 @@ jest.mock("react-native", () => {
|
|
|
110
111
|
};
|
|
111
112
|
});
|
|
112
113
|
|
|
113
|
-
jest.mock("react-native-
|
|
114
|
-
const
|
|
114
|
+
jest.mock("react-native-svg", () => {
|
|
115
|
+
const SvgXml = (props) => <View {...props} mock="SvgXml" />;
|
|
116
|
+
|
|
117
|
+
return { SvgXml };
|
|
118
|
+
});
|
|
115
119
|
|
|
120
|
+
jest.mock("react-native-webview", () => {
|
|
116
121
|
return {
|
|
117
122
|
WebView: jest.fn(() => <View mock="react-native-webview" />),
|
|
118
123
|
};
|
|
@@ -128,8 +133,7 @@ const store = configureStore()({});
|
|
|
128
133
|
const Screen = () => <View />;
|
|
129
134
|
Screen.displayName = "Screen";
|
|
130
135
|
|
|
131
|
-
|
|
132
|
-
const AppContainer = ({ children }) => <View>{children(dimensions)}</View>;
|
|
136
|
+
const AppContainer = ({ children }: any) => <View>{children(dimensions)}</View>;
|
|
133
137
|
AppContainer.displayName = "AppContainer";
|
|
134
138
|
|
|
135
139
|
const runtimeConfigurationUrls = {
|
|
@@ -152,10 +156,10 @@ const zappAppProps = {
|
|
|
152
156
|
dispatch: jest.fn(),
|
|
153
157
|
};
|
|
154
158
|
|
|
155
|
-
|
|
156
|
-
describe.skip("<ZappApp />", () => {
|
|
159
|
+
describe("<ZappApp />", () => {
|
|
157
160
|
it("renders correctly", () => {
|
|
158
|
-
const
|
|
159
|
-
|
|
161
|
+
const wrapper = shallow(<ZappApp {...zappAppProps} store={store} />);
|
|
162
|
+
|
|
163
|
+
expect(shallowToJson(wrapper)).toMatchSnapshot();
|
|
160
164
|
});
|
|
161
165
|
});
|
package/App/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
+
import { NativeRouter, useHistory, useLocation } from "react-router-native";
|
|
3
4
|
// @ts-ignore
|
|
4
5
|
import { createQuickBrickApp } from "@applicaster/quick-brick-core";
|
|
5
6
|
import * as Contexts from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
@@ -13,6 +14,11 @@ import { Layout } from "./Layout";
|
|
|
13
14
|
type Props = ZappScreenProps & ZappRiver;
|
|
14
15
|
|
|
15
16
|
export const ZappApp: React.ComponentType<Props> = createQuickBrickApp({
|
|
17
|
+
navigations: {
|
|
18
|
+
Router: NativeRouter,
|
|
19
|
+
useHistory,
|
|
20
|
+
useLocation,
|
|
21
|
+
},
|
|
16
22
|
QuickBrickManager,
|
|
17
23
|
Layout,
|
|
18
24
|
OfflineHandler,
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.26-rc.1",
|
|
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'",
|
|
9
|
+
"flow-types": "node_modules/.bin/flow-copy-source -v -i '**/__tests__**' . ."
|
|
8
10
|
},
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
@@ -27,38 +29,20 @@
|
|
|
27
29
|
},
|
|
28
30
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@applicaster/quick-brick-core": "
|
|
31
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
32
|
-
"@applicaster/zapp-react-native-redux": "
|
|
33
|
-
"@applicaster/zapp-react-native-ui-components": "
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "
|
|
32
|
+
"@applicaster/quick-brick-core": "12.0.26-rc.1",
|
|
33
|
+
"@applicaster/zapp-react-native-bridge": "12.0.26-rc.1",
|
|
34
|
+
"@applicaster/zapp-react-native-redux": "12.0.26-rc.1",
|
|
35
|
+
"@applicaster/zapp-react-native-ui-components": "12.0.26-rc.1",
|
|
36
|
+
"@applicaster/zapp-react-native-utils": "12.0.26-rc.1",
|
|
35
37
|
"axios": "^0.28.0",
|
|
36
38
|
"camelize": "^1.0.0",
|
|
37
39
|
"query-string": "7.1.3",
|
|
40
|
+
"react-router-native": "5.1.2",
|
|
38
41
|
"url": "^0.11.0"
|
|
39
42
|
},
|
|
40
43
|
"peerDependencies": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"@applicaster/zapp-pipes-v2-client": "*",
|
|
44
|
-
"@applicaster/zapp-react-dom-ui-components": "*",
|
|
45
|
-
"@applicaster/zapp-react-native-tvos-app": "*",
|
|
46
|
-
"@applicaster/zapp-react-native-tvos-ui-components": "*",
|
|
47
|
-
"@babel/runtime": "*",
|
|
48
|
-
"@react-native-community/netinfo": "*",
|
|
49
|
-
"immer": "*",
|
|
50
|
-
"react": "*",
|
|
51
|
-
"react-native": "*",
|
|
52
|
-
"react-native-fs": "*",
|
|
53
|
-
"react-native-gesture-handler": "*",
|
|
54
|
-
"react-native-linear-gradient": "*",
|
|
55
|
-
"react-native-safe-area-context": "*",
|
|
56
|
-
"react-native-svg": "*",
|
|
57
|
-
"react-native-web": "*",
|
|
58
|
-
"react-native-webview": "*",
|
|
59
|
-
"uglify-js": "*",
|
|
60
|
-
"validate-color": "*",
|
|
61
|
-
"zustand": "*"
|
|
44
|
+
"react": "17.0.2",
|
|
45
|
+
"react-native": "0.68.6"
|
|
62
46
|
},
|
|
63
47
|
"devDependencies": {
|
|
64
48
|
"nock": "^10.0.0",
|