@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6944415045 → 13.0.0-alpha.7100577251
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/Components/BaseFocusable/index.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +1 -1
- package/Components/Cell/Cell.tsx +7 -4
- package/Components/Cell/TvOSCellComponent.tsx +22 -20
- package/Components/Cell/index.js +1 -3
- package/Components/Focusable/FocusableTvOS.tsx +1 -5
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/FocusableList/index.tsx +9 -25
- package/Components/FocusableScrollView/index.tsx +12 -39
- package/Components/Layout/TV/NavBarContainer.tsx +7 -8
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -11
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/utils/index.ts +1 -1
- package/Components/ModalComponent/Header/index.tsx +3 -3
- package/Components/PlayerImageBackground/index.tsx +23 -3
- package/Components/River/ComponentsMap/ComponentsMap.tsx +39 -65
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +37 -2
- package/Components/River/TV/index.tsx +1 -6
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
- package/Components/River/__tests__/componentsMap.test.js +17 -5
- package/Components/Screen/hooks.ts +56 -0
- package/Components/Screen/index.tsx +13 -39
- package/Components/Tabs/Tab.tsx +6 -6
- package/Components/TextInputTv/index.tsx +2 -2
- package/Components/Transitioner/AnimationManager.js +8 -8
- package/Components/Transitioner/Scene.tsx +52 -23
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +59 -43
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +29 -21
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +7 -6
- package/Components/VideoModal/ModalAnimation/utils.ts +2 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +4 -1
- package/Components/VideoModal/PlayerWrapper.tsx +16 -35
- package/Components/VideoModal/VideoModal.tsx +14 -23
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +1 -1
- package/Contexts/ScreenContext/index.tsx +3 -2
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +31 -1
- package/package.json +5 -5
- package/Contexts/ComponentsMapOffsetContext/index.tsx +0 -46
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { renderHook } from "@testing-library/react-hooks";
|
|
2
|
+
import { useDelayedPlayerDetails } from "../useDelayedPlayerDetails";
|
|
3
|
+
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
4
|
+
import { showDetails } from "../utils";
|
|
5
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
|
+
|
|
7
|
+
jest.mock("@applicaster/zapp-react-native-utils/idleUtils", () => ({
|
|
8
|
+
withTimeout$: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
jest.mock("../utils", () => ({
|
|
12
|
+
showDetails: jest.fn(),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
16
|
+
useIsTablet: jest.fn(),
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
describe("useDelayedPlayerDetails", () => {
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should return false initially", () => {
|
|
25
|
+
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
26
|
+
subscribe: jest.fn().mockReturnValue({ unsubscribe: jest.fn() }),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const { result } = renderHook(() =>
|
|
30
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
expect(result.current).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("should return true if showDetails returns true", () => {
|
|
37
|
+
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
38
|
+
subscribe: (callback) => {
|
|
39
|
+
callback.next();
|
|
40
|
+
|
|
41
|
+
return { unsubscribe: jest.fn() };
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
(showDetails as jest.Mock).mockReturnValue(true);
|
|
46
|
+
(useIsTablet as jest.Mock).mockReturnValue(false);
|
|
47
|
+
|
|
48
|
+
const { result } = renderHook(() =>
|
|
49
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
expect(result.current).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("should return false if showDetails returns false", () => {
|
|
56
|
+
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
57
|
+
subscribe: (callback) => {
|
|
58
|
+
callback.next();
|
|
59
|
+
|
|
60
|
+
return { unsubscribe: jest.fn() };
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
(showDetails as jest.Mock).mockReturnValue(false);
|
|
65
|
+
(useIsTablet as jest.Mock).mockReturnValue(false);
|
|
66
|
+
|
|
67
|
+
const { result } = renderHook(() =>
|
|
68
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(result.current).toBe(false);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should unsubscribe on unmount", () => {
|
|
75
|
+
const unsubscribeMock = jest.fn();
|
|
76
|
+
|
|
77
|
+
(withTimeout$ as jest.Mock).mockReturnValue({
|
|
78
|
+
subscribe: jest.fn().mockReturnValue({ unsubscribe: unsubscribeMock }),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const { unmount } = renderHook(() =>
|
|
82
|
+
useDelayedPlayerDetails({ isInline: true, isDocked: false, isPip: false })
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
unmount();
|
|
86
|
+
|
|
87
|
+
expect(unsubscribeMock).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
3
|
+
import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
|
|
4
|
+
|
|
5
|
+
import { showDetails } from "./utils";
|
|
6
|
+
|
|
7
|
+
const TIMEOUT = 100; // ms
|
|
8
|
+
|
|
9
|
+
type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Custom hook to determine whether to show player details with a delay.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} params - The parameters object.
|
|
15
|
+
* @param {boolean} params.isInline - Indicates if the player is inline.
|
|
16
|
+
* @param {boolean} params.isDocked - Indicates if the player is docked.
|
|
17
|
+
* @param {boolean} params.isPip - Indicates if the player is in PIP mode.
|
|
18
|
+
* @returns {boolean} - Returns true if player details should be shown, otherwise false.
|
|
19
|
+
*/
|
|
20
|
+
export const useDelayedPlayerDetails = ({
|
|
21
|
+
isInline,
|
|
22
|
+
isDocked,
|
|
23
|
+
isPip,
|
|
24
|
+
}: Props): boolean => {
|
|
25
|
+
const [shouldShowDetails, setShouldShowDetails] = React.useState(false);
|
|
26
|
+
|
|
27
|
+
const isTablet = useIsTablet();
|
|
28
|
+
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const subscription = withTimeout$(TIMEOUT).subscribe({
|
|
31
|
+
next: () => {
|
|
32
|
+
setShouldShowDetails(() => {
|
|
33
|
+
return showDetails({
|
|
34
|
+
isMobile: !isTablet,
|
|
35
|
+
isInline,
|
|
36
|
+
isDocked,
|
|
37
|
+
isPip,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
subscription.unsubscribe();
|
|
45
|
+
};
|
|
46
|
+
}, [isDocked, isTablet, isInline, isPip]);
|
|
47
|
+
|
|
48
|
+
return shouldShowDetails;
|
|
49
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { showDetails } from "..";
|
|
2
|
+
|
|
3
|
+
describe("showDetails", () => {
|
|
4
|
+
it("should return false if isPip is true", () => {
|
|
5
|
+
const result = showDetails({
|
|
6
|
+
isMobile: true,
|
|
7
|
+
isInline: true,
|
|
8
|
+
isDocked: false,
|
|
9
|
+
isPip: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
expect(result).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("should return false if isDocked is true", () => {
|
|
16
|
+
const result = showDetails({
|
|
17
|
+
isMobile: true,
|
|
18
|
+
isInline: true,
|
|
19
|
+
isDocked: true,
|
|
20
|
+
isPip: false,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
expect(result).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("should return true if isMobile is true and isInline is true", () => {
|
|
27
|
+
const result = showDetails({
|
|
28
|
+
isMobile: true,
|
|
29
|
+
isInline: true,
|
|
30
|
+
isDocked: false,
|
|
31
|
+
isPip: false,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
expect(result).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("should return false if isMobile is true and isInline is false", () => {
|
|
38
|
+
const result = showDetails({
|
|
39
|
+
isMobile: true,
|
|
40
|
+
isInline: false,
|
|
41
|
+
isDocked: false,
|
|
42
|
+
isPip: false,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
expect(result).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("should return true if isMobile is false", () => {
|
|
49
|
+
const result = showDetails({
|
|
50
|
+
isMobile: false,
|
|
51
|
+
isInline: true,
|
|
52
|
+
isDocked: false,
|
|
53
|
+
isPip: false,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(result).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should return true if isMobile is false and isInline is false", () => {
|
|
60
|
+
const result = showDetails({
|
|
61
|
+
isMobile: false,
|
|
62
|
+
isInline: false,
|
|
63
|
+
isDocked: false,
|
|
64
|
+
isPip: false,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
expect(result).toBe(true);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("should return false if all properties are false except isMobile", () => {
|
|
71
|
+
const result = showDetails({
|
|
72
|
+
isMobile: true,
|
|
73
|
+
isInline: false,
|
|
74
|
+
isDocked: false,
|
|
75
|
+
isPip: false,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(result).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("should return true if all properties are false except isInline", () => {
|
|
82
|
+
const result = showDetails({
|
|
83
|
+
isMobile: false,
|
|
84
|
+
isInline: true,
|
|
85
|
+
isDocked: false,
|
|
86
|
+
isPip: false,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
expect(result).toBe(true);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -35,3 +35,36 @@ export const orientationWasChangedFromPortraitToLandscape = ({
|
|
|
35
35
|
isOrientationLandscape(toOrientation)
|
|
36
36
|
);
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
export const showDetails = ({
|
|
40
|
+
isMobile,
|
|
41
|
+
isInline,
|
|
42
|
+
isDocked,
|
|
43
|
+
isPip,
|
|
44
|
+
}: {
|
|
45
|
+
isMobile: boolean;
|
|
46
|
+
isInline: boolean;
|
|
47
|
+
isDocked: boolean;
|
|
48
|
+
isPip: boolean;
|
|
49
|
+
}): boolean => {
|
|
50
|
+
if (isPip) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (isDocked) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// for mobile with inline mode(rotation is portrait) we always show details.
|
|
59
|
+
if (isMobile && isInline) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// for mobile with landscape rotation(player is fullscreen) we always hide details. Mounting of it is very heavy operation.
|
|
64
|
+
if (isMobile && !isInline) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// for tablets we always show details
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
@@ -99,8 +99,9 @@ export function ScreenContextProvider({
|
|
|
99
99
|
const isNested = useNestedNavigationContext();
|
|
100
100
|
const currentScreenScreenData = useCurrentScreenData();
|
|
101
101
|
|
|
102
|
-
const screenNavBarStateRef =
|
|
103
|
-
|
|
102
|
+
const screenNavBarStateRef = useRef<null | ReturnType<typeof createStore>>(
|
|
103
|
+
null
|
|
104
|
+
);
|
|
104
105
|
|
|
105
106
|
const getScreenNavBarState = useCallback(() => {
|
|
106
107
|
if (screenNavBarStateRef.current !== null) {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
/// <reference types="@applicaster/zapp-react-native-ui-components" />
|
|
3
3
|
import React, { useEffect, useMemo } from "react";
|
|
4
|
+
import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
|
|
5
|
+
|
|
4
6
|
import * as R from "ramda";
|
|
5
7
|
import { Platform } from "react-native";
|
|
6
8
|
import Url from "url";
|
|
7
|
-
|
|
9
|
+
import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
|
|
8
10
|
import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
|
|
9
11
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
12
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
@@ -19,6 +21,12 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
|
|
|
19
21
|
import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
20
22
|
|
|
21
23
|
import { isVerticalListOrGrid } from "./utils";
|
|
24
|
+
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
25
|
+
import {
|
|
26
|
+
findEndpointForURL,
|
|
27
|
+
HTTP_METHODS,
|
|
28
|
+
} from "@applicaster/zapp-pipes-v2-client";
|
|
29
|
+
import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
|
|
22
30
|
|
|
23
31
|
type Props = {
|
|
24
32
|
component: ZappUIComponent;
|
|
@@ -291,6 +299,28 @@ export function zappPipesDataConnector(
|
|
|
291
299
|
if (addListener) {
|
|
292
300
|
return addListener(reloadData);
|
|
293
301
|
}
|
|
302
|
+
} else {
|
|
303
|
+
const pipesEndpoints = appStore.get("pipesEndpoints");
|
|
304
|
+
|
|
305
|
+
const endpointURL = findEndpointForURL(
|
|
306
|
+
dataSourceUrl,
|
|
307
|
+
pipesEndpoints,
|
|
308
|
+
HTTP_METHODS.GET
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
const endpoint = pipesEndpoints?.[endpointURL];
|
|
312
|
+
|
|
313
|
+
if (endpoint?.tags?.includes(ENDPOINT_TAGS.observe_storage)) {
|
|
314
|
+
const subscriptions: (() => void)[] = endpoint.context_obj.map(
|
|
315
|
+
(data: Record<string, any>) => {
|
|
316
|
+
const { namespace, key } = getNamespaceAndKey(data.key);
|
|
317
|
+
|
|
318
|
+
return localStorage.addListener({ key, namespace }, reloadData);
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
return () => subscriptions.forEach((listener) => listener());
|
|
323
|
+
}
|
|
294
324
|
}
|
|
295
325
|
}, [dataSourceUrl, reloadData]);
|
|
296
326
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.7100577251",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.7100577251",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.7100577251",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.7100577251",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.7100577251",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
2
|
-
import React, { PropsWithChildren } from "react";
|
|
3
|
-
|
|
4
|
-
export const ComponentsMapOffsetContext = React.createContext({
|
|
5
|
-
setComponentsMapOffset: (_offset: number) => void 0,
|
|
6
|
-
componentsMapOffset: 0,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const ComponentsMapOffsetContextProvider = ({
|
|
10
|
-
children,
|
|
11
|
-
}: PropsWithChildren<{}>) => {
|
|
12
|
-
const theme = useTheme<BaseThemePropertiesTV>();
|
|
13
|
-
|
|
14
|
-
const [componentsMapOffset, setComponentsMapOffset] = React.useState(
|
|
15
|
-
theme?.screen_margin_top
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const contextValue = {
|
|
19
|
-
componentsMapOffset,
|
|
20
|
-
setComponentsMapOffset,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<ComponentsMapOffsetContext.Provider value={contextValue}>
|
|
25
|
-
{children}
|
|
26
|
-
</ComponentsMapOffsetContext.Provider>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const withComponentsMapOffsetContext = (Component: any) =>
|
|
31
|
-
function ComponentsMapOffsetContextProviderWrapper(props: {}) {
|
|
32
|
-
return (
|
|
33
|
-
<ComponentsMapOffsetContextProvider>
|
|
34
|
-
<Component {...props} />
|
|
35
|
-
</ComponentsMapOffsetContextProvider>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const withComponentsMapOffsetContextConsumer = (Component: any) =>
|
|
40
|
-
function ComponentsMapOffsetContextConsumerWrapper(props: {}) {
|
|
41
|
-
const { componentsMapOffset } = React.useContext(
|
|
42
|
-
ComponentsMapOffsetContext
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
return <Component {...props} componentsMapOffset={componentsMapOffset} />;
|
|
46
|
-
};
|