@applicaster/zapp-react-native-ui-components 15.1.4 → 16.0.0-alpha.1042942411
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/BackgroundImage/index.ts +1 -8
- package/Components/BaseFocusable/index.ios.ts +12 -2
- package/Components/Cell/FocusableWrapper.tsx +3 -0
- package/Components/Cell/TvOSCellComponent.tsx +6 -3
- package/Components/CellRendererResolver/index.ts +1 -1
- package/Components/Focusable/Focusable.tsx +4 -2
- package/Components/Focusable/FocusableTvOS.tsx +18 -1
- package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
- package/Components/FocusableGroup/FocusableTvOS.tsx +30 -1
- package/Components/GeneralContentScreen/GeneralContentScreenHookAdapter.tsx +39 -0
- package/Components/GeneralContentScreen/__tests__/GeneralContentScreenHookAdapter.test.tsx +64 -0
- package/Components/GeneralContentScreen/__tests__/HookContentFocusGroup.web.test.tsx +91 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/networkService.test.ts +74 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/runInBackground.test.ts +139 -0
- package/Components/GeneralContentScreen/hookAdapter/__tests__/validationHelper.test.ts +124 -0
- package/Components/GeneralContentScreen/hookAdapter/logger.ts +6 -0
- package/Components/GeneralContentScreen/hookAdapter/networkService.ts +53 -0
- package/Components/GeneralContentScreen/hookAdapter/runInBackground.ts +48 -0
- package/Components/GeneralContentScreen/hookAdapter/validationHelper.ts +72 -0
- package/Components/GeneralContentScreen/hookFocus/index.tsx +13 -0
- package/Components/GeneralContentScreen/hookFocus/index.web.tsx +69 -0
- package/Components/GeneralContentScreen/index.ts +2 -0
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +13 -8
- package/Components/Layout/TV/NavBarContainer.tsx +1 -10
- package/Components/Layout/TV/ScreenContainer.tsx +2 -6
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +7 -12
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +7 -12
- package/Components/Layout/TV/index.tsx +3 -4
- package/Components/Layout/TV/index.web.tsx +3 -4
- package/Components/LinkHandler/LinkHandler.tsx +2 -2
- package/Components/MasterCell/CONFIG_BUILDER_TO_REACT_COMPONENT.md +144 -0
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +27 -48
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/model.test.ts +80 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/placement.test.ts +213 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/selectors.test.ts +45 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/__tests__/style.test.ts +49 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/ActionButtonController.tsx +165 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/__tests__/ActionButtonController.test.tsx +405 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/components/index.ts +1 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/model.ts +47 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/placement.ts +198 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/selectors.ts +26 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/style.ts +29 -0
- package/Components/MasterCell/DefaultComponents/ActionButtonsCore/types.ts +37 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +217 -46
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +50 -119
- package/Components/MasterCell/DefaultComponents/Button.tsx +50 -58
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/components/HorizontalSeparator.tsx +8 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.android.tv.tsx +58 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.tsx +15 -0
- package/Components/MasterCell/DefaultComponents/{tv/ButtonContainerView/index.tsx → ButtonContainerView/index.tv.tsx} +3 -11
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/index.web.ts +1 -0
- package/Components/MasterCell/DefaultComponents/ButtonContainerView/types.ts +40 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/__tests__/__snapshots__/index.test.tsx.snap +18 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/__tests__/index.test.tsx +90 -0
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +13 -14
- package/Components/MasterCell/DefaultComponents/DataProvider/index.tsx +163 -0
- package/Components/MasterCell/DefaultComponents/FocusableView/index.android.tsx +2 -23
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -22
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +8 -2
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +1 -2
- package/Components/MasterCell/DefaultComponents/PressableView.tsx +54 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +46 -50
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +47 -39
- package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +19 -6
- package/Components/MasterCell/DefaultComponents/Text/hooks/useText.ts +15 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +45 -15
- package/Components/MasterCell/DefaultComponents/UIKitAdapters/Badge.tsx +49 -0
- package/Components/MasterCell/DefaultComponents/__tests__/ActionButton.test.tsx +122 -0
- package/Components/MasterCell/DefaultComponents/__tests__/Button.test.tsx +186 -0
- package/Components/MasterCell/DefaultComponents/__tests__/DataProvider.test.tsx +141 -0
- package/Components/MasterCell/DefaultComponents/__tests__/DynamicBadge.test.tsx +156 -0
- package/Components/MasterCell/DefaultComponents/__tests__/__snapshots__/ActionButton.test.tsx.snap +60 -0
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +196 -67
- package/Components/MasterCell/DefaultComponents/index.ts +13 -3
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/ActionButton.tsx +189 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Asset.ts +33 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/AssetComponent.tsx +33 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Button.ts +159 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/Spacer.ts +18 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabel.ts +67 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/TextLabelsContainer.ts +39 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/PressableView.test.tsx +402 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/builders.test.ts +141 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/__tests__/index.test.ts +354 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/helpers.ts +105 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/index.ts +129 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/__tests__/insertButtons.test.ts +123 -0
- package/Components/MasterCell/DefaultComponents/mobile/MobileActionButtons/utils/index.ts +238 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Asset.ts +4 -18
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/Button.ts +24 -73
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TextLabelsContainer.ts +37 -18
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/TvActionButton.tsx +27 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/index.test.ts +89 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/__tests__/renderedTree.test.tsx +231 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +47 -48
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +115 -29
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/insertButtonsBetweenLabels.test.ts +45 -13
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +101 -144
- package/Components/MasterCell/MappingFunctions/index.js +3 -2
- package/Components/MasterCell/README.md +4 -0
- package/Components/MasterCell/__tests__/__snapshots__/dataAdapter.test.js.snap +24 -0
- package/Components/MasterCell/__tests__/configInflater.test.js +1 -0
- package/Components/MasterCell/__tests__/elementMapper.test.js +46 -0
- package/Components/MasterCell/contexts/PressedStateContext.ts +3 -0
- package/Components/MasterCell/dataAdapter.ts +4 -1
- package/Components/MasterCell/elementMapper.tsx +54 -7
- package/Components/MasterCell/hooks/index.ts +2 -0
- package/Components/MasterCell/hooks/usePressedState.ts +4 -0
- package/Components/MasterCell/index.tsx +20 -4
- package/Components/MasterCell/utils/__tests__/cloneChildrenWithIds.test.tsx +43 -0
- package/Components/MasterCell/utils/__tests__/useFilterChildren.test.tsx +80 -0
- package/Components/MasterCell/utils/index.ts +82 -16
- package/Components/ModalComponent/AudioPlayer/Components/Action.tsx +33 -69
- package/Components/ModalComponent/AudioPlayer/Components/Button.tsx +25 -47
- package/Components/ModalComponent/AudioPlayer/Components/Header.tsx +122 -39
- package/Components/ModalComponent/AudioPlayer/Components/Input.tsx +671 -0
- package/Components/ModalComponent/AudioPlayer/Components/Item.tsx +257 -88
- package/Components/ModalComponent/AudioPlayer/Components/index.ts +6 -4
- package/Components/ModalComponent/BottomSheetDragArea.tsx +33 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +17 -10
- package/Components/ModalComponent/__tests__/BottomSheetDragArea.test.tsx +74 -0
- package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +4 -85
- package/Components/OfflineHandler/__tests__/index.test.tsx +101 -32
- package/Components/OfflineHandler/hooks.ts +123 -0
- package/Components/OfflineHandler/index.tsx +51 -73
- package/Components/OfflineHandler/utils/index.ts +1 -13
- package/Components/PlayerContainer/PlayerContainer.tsx +6 -5
- package/Components/PlayerContainer/__tests__/PlayerContainer.test.tsx +2 -4
- package/Components/PreloaderWrapper/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +8 -21
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
- package/Components/River/RefreshControl.tsx +19 -105
- package/Components/River/River.tsx +9 -82
- package/Components/River/TV/River.tsx +31 -14
- package/Components/River/TV/index.tsx +8 -4
- package/Components/River/TV/utils/__tests__/toStringOrEmpty.test.ts +30 -0
- package/Components/River/TV/utils/index.ts +4 -0
- package/Components/River/TV/withFocusableGroupForContent.tsx +71 -0
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +4 -0
- package/Components/River/__tests__/componentsMap.test.js +38 -0
- package/Components/River/hooks/__tests__/usePullToRefresh.test.ts +132 -0
- package/Components/River/hooks/index.ts +1 -0
- package/Components/River/hooks/usePullToRefresh.ts +51 -0
- package/Components/Screen/TV/index.web.tsx +4 -2
- package/Components/Screen/__tests__/Screen.test.tsx +65 -42
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
- package/Components/Screen/hooks.ts +2 -3
- package/Components/Screen/index.tsx +2 -3
- package/Components/Screen/orientationHandler.ts +3 -3
- package/Components/ScreenFeedLoader/ScreenFeedLoader.tsx +5 -3
- package/Components/ScreenResolver/index.tsx +9 -5
- package/Components/ScreenResolverFeedProvider/ScreenResolverFeedProvider.tsx +1 -1
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +1 -1
- package/Components/Tabs/TabContent.tsx +7 -4
- package/Components/TopCutoffOverlay/__tests__/TopCutoffOverlay.test.tsx +201 -0
- package/Components/TopCutoffOverlay/hooks/__tests__/useMarginTop.test.ts +130 -0
- package/Components/TopCutoffOverlay/hooks/index.ts +1 -0
- package/Components/TopCutoffOverlay/hooks/useMarginTop.ts +59 -0
- package/Components/TopCutoffOverlay/index.tsx +55 -0
- package/Components/Transitioner/index.js +3 -3
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +5 -5
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
- package/Components/VideoModal/utils.ts +12 -10
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +0 -2
- package/Components/Viewport/ViewportAware/index.tsx +16 -7
- package/Components/Viewport/ViewportEvents/__tests__/viewportEvents.test.js +1 -1
- package/Components/default-cell-renderer/viewTrees/mobile/index.ts +0 -3
- package/Contexts/CachedDimensionsContext/__tests__/index.test.ts +154 -0
- package/Contexts/ScreenContext/index.tsx +25 -18
- package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
- package/Decorators/Analytics/index.tsx +6 -5
- package/Decorators/ConfigurationWrapper/__tests__/__snapshots__/withConfigurationProvider.test.tsx.snap +1 -0
- package/Decorators/ConfigurationWrapper/const.ts +1 -0
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +39 -21
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +1 -1
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
- package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +18 -7
- package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
- package/Helpers/DataSourceHelper/index.ts +19 -0
- package/package.json +5 -5
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +0 -135
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/types.ts +0 -25
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +0 -112
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +0 -107
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +0 -153
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -67
- package/Components/OfflineHandler/NotificationView/utils.ts +0 -34
- package/Components/River/TV/withTVEventHandler.tsx +0 -36
- package/Helpers/DataSourceHelper/index.js +0 -19
- /package/Components/BackgroundImage/{BackgroundImage.tv.android.tsx → BackgroundImage.android.tv.tsx} +0 -0
- /package/Components/BackgroundImage/{BackgroundImage.tv.ios.tsx → BackgroundImage.ios.tv.tsx} +0 -0
- /package/Components/BackgroundImage/{BackgroundImage.tv.web.tsx → BackgroundImage.tsx} +0 -0
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
3
|
-
import { useNetworkStatusLocalizations } from "./utils";
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
online?: boolean;
|
|
8
|
-
previousOnline?: boolean;
|
|
9
|
-
dismiss: () => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const DURATION_TO_HIDE_AFTER_BACK_TO_ONLINE = 4500; // ms
|
|
13
|
-
|
|
14
|
-
const styles: Record<any, React.CSSProperties> = {
|
|
15
|
-
body: {
|
|
16
|
-
position: "absolute",
|
|
17
|
-
top: 0,
|
|
18
|
-
width: 1920,
|
|
19
|
-
height: 200,
|
|
20
|
-
background:
|
|
21
|
-
"linear-gradient(180deg, rgba(17,17,17,0.9) 0%, rgba(17,17,17,1) 49%, rgba(0,0,0,0.85) 100%)",
|
|
22
|
-
display: "flex",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
justifyContent: "center",
|
|
25
|
-
flexDirection: "column",
|
|
26
|
-
color: "#fff",
|
|
27
|
-
paddingTop: 15,
|
|
28
|
-
},
|
|
29
|
-
title: {
|
|
30
|
-
fontSize: 28,
|
|
31
|
-
margin: 0,
|
|
32
|
-
padding: 0,
|
|
33
|
-
},
|
|
34
|
-
subtitle: {
|
|
35
|
-
fontSize: 20,
|
|
36
|
-
margin: 0,
|
|
37
|
-
padding: 0,
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
let timer: NodeJS.Timeout;
|
|
42
|
-
|
|
43
|
-
export const NotificationView = (props: Props) => {
|
|
44
|
-
const { children, dismiss, previousOnline = true, online } = props;
|
|
45
|
-
|
|
46
|
-
const theme = useTheme<BaseThemePropertiesTV>();
|
|
47
|
-
const storedLocalizations = useNetworkStatusLocalizations();
|
|
48
|
-
|
|
49
|
-
const [shown, setShown] = React.useState<boolean>(false);
|
|
50
|
-
|
|
51
|
-
const onClose = () => {
|
|
52
|
-
setShown(false);
|
|
53
|
-
dismiss();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
React.useEffect(() => {
|
|
57
|
-
if (previousOnline && online) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (!previousOnline && !online) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (previousOnline && !online) {
|
|
66
|
-
// went to offline
|
|
67
|
-
clearTimeout(timer);
|
|
68
|
-
setShown(true);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!previousOnline && online) {
|
|
72
|
-
// back to online
|
|
73
|
-
setShown(true);
|
|
74
|
-
|
|
75
|
-
timer = setTimeout(() => {
|
|
76
|
-
setShown(false);
|
|
77
|
-
}, DURATION_TO_HIDE_AFTER_BACK_TO_ONLINE);
|
|
78
|
-
}
|
|
79
|
-
}, [online, previousOnline]);
|
|
80
|
-
|
|
81
|
-
const title = online
|
|
82
|
-
? (theme?.online_notification_title ??
|
|
83
|
-
storedLocalizations?.online_notification_title)
|
|
84
|
-
: (theme?.offline_notification_title ??
|
|
85
|
-
storedLocalizations?.offline_notification_title);
|
|
86
|
-
|
|
87
|
-
const subtitle = online
|
|
88
|
-
? (theme?.online_notification_subtitle ??
|
|
89
|
-
storedLocalizations?.online_notification_subtitle)
|
|
90
|
-
: (theme?.offline_notification_subtitle ??
|
|
91
|
-
storedLocalizations?.offline_notification_subtitle);
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<div onClick={onClose}>
|
|
95
|
-
{children}
|
|
96
|
-
{shown ? (
|
|
97
|
-
<div style={styles.body}>
|
|
98
|
-
<div style={styles.title}>
|
|
99
|
-
<h2>{title}</h2>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<h4 style={styles.subtitle}>{subtitle}</h4>
|
|
103
|
-
</div>
|
|
104
|
-
) : null}
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
};
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
-
import * as R from "ramda";
|
|
3
|
-
import {
|
|
4
|
-
View,
|
|
5
|
-
Text,
|
|
6
|
-
Animated,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
TouchableWithoutFeedback,
|
|
9
|
-
} from "react-native";
|
|
10
|
-
|
|
11
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
12
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
13
|
-
import { textTransform } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
14
|
-
import { useNotificationHeight } from "../utils";
|
|
15
|
-
|
|
16
|
-
export const onlinePhrase = "You are back online";
|
|
17
|
-
|
|
18
|
-
export const offlinePhrase = "No internet connection";
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
notificationView: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
position: "absolute",
|
|
24
|
-
alignItems: "center",
|
|
25
|
-
justifyContent: "center",
|
|
26
|
-
top: 0,
|
|
27
|
-
left: 0,
|
|
28
|
-
right: 0,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
type Props = {
|
|
33
|
-
children?: React.ReactNode;
|
|
34
|
-
hidden?: boolean;
|
|
35
|
-
online?: boolean;
|
|
36
|
-
dismiss: () => void;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type NumberBoolean = 0 | 1;
|
|
40
|
-
|
|
41
|
-
const OFFLINE_EXPERIENCE = "offline-experience";
|
|
42
|
-
|
|
43
|
-
export const NotificationView = ({
|
|
44
|
-
children,
|
|
45
|
-
hidden = true,
|
|
46
|
-
online = true,
|
|
47
|
-
dismiss,
|
|
48
|
-
}: Props) => {
|
|
49
|
-
const { plugins } = usePickFromState(["plugins"]);
|
|
50
|
-
const { statusHeight, notificationHeight } = useNotificationHeight();
|
|
51
|
-
|
|
52
|
-
const offlinePlugin = R.find(
|
|
53
|
-
R.propEq("identifier", OFFLINE_EXPERIENCE),
|
|
54
|
-
plugins
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const { useOfflineExperienceConfiguration } = offlinePlugin.module;
|
|
58
|
-
|
|
59
|
-
const {
|
|
60
|
-
configurationFields,
|
|
61
|
-
localizations,
|
|
62
|
-
}: {
|
|
63
|
-
configurationFields: OfflineExperiencePluginConfiguration;
|
|
64
|
-
localizations: OfflineExperienceLocalizations;
|
|
65
|
-
} = useOfflineExperienceConfiguration?.();
|
|
66
|
-
|
|
67
|
-
const [notificationOpacity, setNotificationOpacity] =
|
|
68
|
-
useState<NumberBoolean>(0);
|
|
69
|
-
|
|
70
|
-
const yPosition = useRef(new Animated.Value(0)).current;
|
|
71
|
-
|
|
72
|
-
const showNotification = () => {
|
|
73
|
-
setNotificationOpacity(1);
|
|
74
|
-
|
|
75
|
-
Animated.timing(yPosition, {
|
|
76
|
-
toValue: 1,
|
|
77
|
-
useNativeDriver: true,
|
|
78
|
-
duration: 300,
|
|
79
|
-
}).start();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const hideNotification = () => {
|
|
83
|
-
Animated.timing(yPosition, {
|
|
84
|
-
toValue: 0,
|
|
85
|
-
useNativeDriver: true,
|
|
86
|
-
duration: 300,
|
|
87
|
-
}).start(() => {
|
|
88
|
-
setNotificationOpacity(0);
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
hidden ? hideNotification() : showNotification();
|
|
94
|
-
}, [hidden]);
|
|
95
|
-
|
|
96
|
-
const backgroundColor = online
|
|
97
|
-
? configurationFields.offline_toast_online_background_color
|
|
98
|
-
: configurationFields.offline_toast_offline_background_color;
|
|
99
|
-
|
|
100
|
-
const animatedViewStyles = {
|
|
101
|
-
...styles.notificationView,
|
|
102
|
-
transform: [
|
|
103
|
-
{
|
|
104
|
-
translateY: yPosition.interpolate({
|
|
105
|
-
inputRange: [0, 1],
|
|
106
|
-
outputRange: [-notificationHeight, 0],
|
|
107
|
-
}),
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
opacity: notificationOpacity,
|
|
111
|
-
height: notificationHeight,
|
|
112
|
-
width: "100%",
|
|
113
|
-
backgroundColor,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const textStyles = {
|
|
117
|
-
color: online
|
|
118
|
-
? configurationFields.offline_toast_message_online_font_color
|
|
119
|
-
: configurationFields.offline_toast_message_font_color,
|
|
120
|
-
fontFamily: platformSelect({
|
|
121
|
-
ios: configurationFields.offline_toast_message_ios_font_family,
|
|
122
|
-
android: configurationFields.offline_toast_message_android_font_family,
|
|
123
|
-
}),
|
|
124
|
-
fontSize: configurationFields.offline_toast_message_font_size,
|
|
125
|
-
lineHeight: configurationFields.offline_toast_message_line_height,
|
|
126
|
-
letterSpacing: platformSelect({
|
|
127
|
-
ios: configurationFields.offline_toast_message_letter_spacing_ios,
|
|
128
|
-
android: configurationFields.offline_toast_message_letter_spacing_android,
|
|
129
|
-
}),
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const message = textTransform(
|
|
133
|
-
configurationFields.offline_toast_message_text_transform,
|
|
134
|
-
online
|
|
135
|
-
? localizations.online_toast_message
|
|
136
|
-
: localizations.offline_toast_message
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<View style={StyleSheet.absoluteFill}>
|
|
141
|
-
{children}
|
|
142
|
-
<TouchableWithoutFeedback
|
|
143
|
-
style={styles.notificationView}
|
|
144
|
-
onPress={dismiss}
|
|
145
|
-
>
|
|
146
|
-
<Animated.View style={animatedViewStyles}>
|
|
147
|
-
<View style={{ height: statusHeight, backgroundColor }} />
|
|
148
|
-
<Text style={textStyles}>{message}</Text>
|
|
149
|
-
</Animated.View>
|
|
150
|
-
</TouchableWithoutFeedback>
|
|
151
|
-
</View>
|
|
152
|
-
);
|
|
153
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Text, Animated } from "react-native";
|
|
3
|
-
import { render } from "@testing-library/react-native";
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
NotificationView,
|
|
7
|
-
onlinePhrase,
|
|
8
|
-
offlinePhrase,
|
|
9
|
-
} from "../NotificationView";
|
|
10
|
-
|
|
11
|
-
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
12
|
-
usePickFromState: () => ({
|
|
13
|
-
plugins: [
|
|
14
|
-
{
|
|
15
|
-
name: "offline experience",
|
|
16
|
-
identifier: "offline-experience",
|
|
17
|
-
type: "general",
|
|
18
|
-
module: {
|
|
19
|
-
useOfflineExperienceConfiguration: () => ({
|
|
20
|
-
configurationFields: {},
|
|
21
|
-
localizations: {
|
|
22
|
-
offline_toast_message: "No internet connection",
|
|
23
|
-
online_toast_message: "You are back online",
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
}),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
jest.mock("react-native-safe-area-context", () => ({
|
|
33
|
-
useSafeAreaInsets: () => ({ top: 44 }),
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
const dismiss = jest.fn();
|
|
37
|
-
|
|
38
|
-
describe("NotificationView", () => {
|
|
39
|
-
it("Show online message when Online", () => {
|
|
40
|
-
const component = render(<NotificationView online dismiss={dismiss} />);
|
|
41
|
-
|
|
42
|
-
expect(component.UNSAFE_getByType(Text).props.children).toBe(onlinePhrase);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("Show offline message when Online", () => {
|
|
46
|
-
const component = render(
|
|
47
|
-
<NotificationView online={false} dismiss={dismiss} />
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
expect(component.UNSAFE_getByType(Text).props.children).toBe(offlinePhrase);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it("When hidden is false to true notification is visible", () => {
|
|
54
|
-
const component = render(
|
|
55
|
-
<NotificationView online={false} hidden={false} dismiss={dismiss} />
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
component.rerender(
|
|
59
|
-
<NotificationView online={false} hidden={true} dismiss={dismiss} />
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const animatedView = component.UNSAFE_getByType(Animated.View);
|
|
63
|
-
const animatedViewStyles = animatedView.props.style;
|
|
64
|
-
|
|
65
|
-
expect(animatedViewStyles.opacity).toBe(1);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
|
|
3
|
-
|
|
4
|
-
export const NETWORK_STATUS_LOCALIZATIONS_KEY = "network_status_localizations";
|
|
5
|
-
|
|
6
|
-
export const THEME_STORAGE_NAMESPACE = "quick-brick-theme";
|
|
7
|
-
|
|
8
|
-
export function useNetworkStatusLocalizations() {
|
|
9
|
-
const [storedLocalizations, setStoredLocalizations] = React.useState<Record<
|
|
10
|
-
string,
|
|
11
|
-
string
|
|
12
|
-
> | null>(null);
|
|
13
|
-
|
|
14
|
-
React.useEffect(() => {
|
|
15
|
-
async function loadStoredLocalizations() {
|
|
16
|
-
try {
|
|
17
|
-
const stored = await sessionStorage.getItem(
|
|
18
|
-
NETWORK_STATUS_LOCALIZATIONS_KEY,
|
|
19
|
-
THEME_STORAGE_NAMESPACE
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
if (stored) {
|
|
23
|
-
setStoredLocalizations(stored);
|
|
24
|
-
}
|
|
25
|
-
} catch (error) {
|
|
26
|
-
console.error("Error loading network status localizations", error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
loadStoredLocalizations();
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
return storedLocalizations;
|
|
34
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint max-len: off */
|
|
2
|
-
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
|
|
5
|
-
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
|
-
import { useIsStandaloneFullscreen } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
7
|
-
|
|
8
|
-
export const withTvEventHandler = (Component) => {
|
|
9
|
-
return function WithTVEventHandler(props) {
|
|
10
|
-
const navigator = useNavigation();
|
|
11
|
-
|
|
12
|
-
const isStandaloneFullscreen = useIsStandaloneFullscreen();
|
|
13
|
-
|
|
14
|
-
const remoteHandler = (event) => {
|
|
15
|
-
const { eventType } = event;
|
|
16
|
-
|
|
17
|
-
const canGoBack = navigator.canGoBack();
|
|
18
|
-
|
|
19
|
-
if (eventType === "menu" && isStandaloneFullscreen) {
|
|
20
|
-
navigator.goHome();
|
|
21
|
-
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (eventType === "menu" && canGoBack) {
|
|
26
|
-
navigator.goBack();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<TVEventHandlerComponent tvEventHandler={remoteHandler}>
|
|
32
|
-
<Component {...props} />
|
|
33
|
-
</TVEventHandlerComponent>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as R from "ramda";
|
|
2
|
-
|
|
3
|
-
export function itemLimitForData(entry = [], component) {
|
|
4
|
-
const itemLimitValue = Number(R.path(["rules", "item_limit"], component));
|
|
5
|
-
|
|
6
|
-
const itemLimit =
|
|
7
|
-
itemLimitValue && itemLimitValue > 0
|
|
8
|
-
? itemLimitValue
|
|
9
|
-
: Number.MAX_SAFE_INTEGER;
|
|
10
|
-
|
|
11
|
-
const isInRange = (min, max) => R.both(R.gte(R.__, min), R.lt(R.__, max));
|
|
12
|
-
|
|
13
|
-
const entryShouldBeSliced = (entry) =>
|
|
14
|
-
isInRange(0, R.length(entry))(itemLimit);
|
|
15
|
-
|
|
16
|
-
const sliceEntriesUpToItemLimit = R.slice(0, itemLimit);
|
|
17
|
-
|
|
18
|
-
return R.when(entryShouldBeSliced, sliceEntriesUpToItemLimit)(entry);
|
|
19
|
-
}
|
|
File without changes
|
/package/Components/BackgroundImage/{BackgroundImage.tv.ios.tsx → BackgroundImage.ios.tv.tsx}
RENAMED
|
File without changes
|
|
File without changes
|