@applicaster/quick-brick-core 16.0.0-rc.50 → 16.0.0-rc.52
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.
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { renderHook } from "@testing-library/react-native";
|
|
2
2
|
|
|
3
3
|
let mockInsets = { top: 0 };
|
|
4
|
+
const mockGetNavbarHeight = jest.fn();
|
|
4
5
|
|
|
5
6
|
jest.mock("react-native-safe-area-context", () => ({
|
|
6
7
|
useSafeAreaInsets: () => mockInsets,
|
|
7
8
|
}));
|
|
8
9
|
|
|
9
|
-
jest.mock("@applicaster/zapp-react-native-utils/
|
|
10
|
-
|
|
11
|
-
platformSelect: jest.fn(({ ios, android }) => ({ ios, android })),
|
|
10
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/layout", () => ({
|
|
11
|
+
getNavbarHeight: () => mockGetNavbarHeight(),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
15
14
|
import { useNotificationHeight } from "../useNotificationHeight";
|
|
16
15
|
|
|
17
16
|
describe("useNotificationHeight", () => {
|
|
18
17
|
beforeEach(() => {
|
|
19
|
-
|
|
18
|
+
mockGetNavbarHeight.mockClear();
|
|
20
19
|
});
|
|
21
20
|
|
|
22
|
-
it("adds the safe area top inset to the
|
|
21
|
+
it("adds the safe area top inset to the nav bar height", () => {
|
|
23
22
|
mockInsets = { top: 44 };
|
|
24
|
-
|
|
23
|
+
mockGetNavbarHeight.mockReturnValueOnce(56);
|
|
25
24
|
|
|
26
25
|
const { result } = renderHook(() => useNotificationHeight());
|
|
27
26
|
|
|
@@ -33,7 +32,7 @@ describe("useNotificationHeight", () => {
|
|
|
33
32
|
|
|
34
33
|
it("falls back to a 0 status height when there is no top inset", () => {
|
|
35
34
|
mockInsets = { top: 0 };
|
|
36
|
-
|
|
35
|
+
mockGetNavbarHeight.mockReturnValueOnce(44);
|
|
37
36
|
|
|
38
37
|
const { result } = renderHook(() => useNotificationHeight());
|
|
39
38
|
|
|
@@ -43,11 +42,17 @@ describe("useNotificationHeight", () => {
|
|
|
43
42
|
});
|
|
44
43
|
});
|
|
45
44
|
|
|
46
|
-
it("
|
|
45
|
+
it("uses getNavbarHeight for the nav bar height", () => {
|
|
47
46
|
mockInsets = { top: 20 };
|
|
47
|
+
mockGetNavbarHeight.mockReturnValueOnce(56);
|
|
48
48
|
|
|
49
|
-
renderHook(() => useNotificationHeight());
|
|
49
|
+
const { result } = renderHook(() => useNotificationHeight());
|
|
50
|
+
|
|
51
|
+
expect(mockGetNavbarHeight).toHaveBeenCalled();
|
|
50
52
|
|
|
51
|
-
expect(
|
|
53
|
+
expect(result.current).toEqual({
|
|
54
|
+
statusHeight: 20,
|
|
55
|
+
notificationHeight: 76,
|
|
56
|
+
});
|
|
52
57
|
});
|
|
53
58
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
2
|
-
|
|
3
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
+
import { getNavbarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
|
|
4
3
|
|
|
5
4
|
export const useNotificationHeight = () => {
|
|
6
5
|
const insets = useSafeAreaInsets();
|
|
7
6
|
|
|
8
|
-
const navBarHeight =
|
|
7
|
+
const navBarHeight = getNavbarHeight();
|
|
9
8
|
|
|
10
9
|
const statusHeight = insets.top;
|
|
11
10
|
const notificationHeight = statusHeight + navBarHeight;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.52",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-rc.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "16.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "16.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-rc.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-rc.52",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "16.0.0-rc.52",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "16.0.0-rc.52",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.52",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-rc.52",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.52",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.52",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|