@applicaster/zapp-react-native-ui-components 15.0.0-rc.11 → 15.0.0-rc.110
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/AnimatedInOut/index.tsx +69 -26
- package/Components/BaseFocusable/index.ios.ts +12 -2
- package/Components/Cell/Cell.tsx +14 -3
- package/Components/Cell/CellWithFocusable.tsx +9 -0
- package/Components/Cell/FocusableWrapper.tsx +47 -0
- package/Components/Cell/TvOSCellComponent.tsx +106 -19
- 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 +32 -1
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +1 -1
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -6
- package/Components/HandlePlayable/HandlePlayable.tsx +33 -94
- package/Components/HandlePlayable/const.ts +3 -0
- package/Components/HandlePlayable/utils.ts +105 -0
- package/Components/Layout/TV/LayoutBackground.tsx +5 -2
- package/Components/Layout/TV/ScreenContainer.tsx +2 -6
- 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/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +5 -1
- 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/LiveImage/index.tsx +10 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +40 -39
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +95 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +86 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/index.test.ts +141 -0
- package/Components/MasterCell/DefaultComponents/SecondaryImage/hooks/__tests__/useGetImageDimensions.test.ts +7 -6
- package/Components/MasterCell/DefaultComponents/SecondaryImage/index.ts +1 -1
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -2
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/__tests__/getPluginIdentifier.test.ts +233 -11
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/utils/index.ts +19 -15
- package/Components/MasterCell/hoc/__tests__/withAsyncRender.test.tsx +219 -0
- package/Components/MasterCell/hoc/withAsyncRender.tsx +9 -7
- package/Components/MasterCell/index.tsx +2 -0
- package/Components/MasterCell/utils/__tests__/resolveColor.test.js +82 -3
- package/Components/MasterCell/utils/index.ts +61 -31
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +102 -87
- package/Components/MeasurmentsPortal/__tests__/MeasurementsPortal.test.tsx +355 -0
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +17 -9
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +16 -8
- package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
- package/Components/OfflineHandler/NotificationView/utils.ts +34 -0
- package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
- package/Components/PlayerContainer/PlayerContainer.tsx +43 -55
- package/Components/PlayerImageBackground/index.tsx +3 -22
- package/Components/River/ComponentsMap/ComponentsMap.tsx +16 -0
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +1 -1
- 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 +2 -0
- package/Components/River/__tests__/componentsMap.test.js +38 -0
- package/Components/Screen/TV/index.web.tsx +4 -2
- package/Components/Screen/__tests__/Screen.test.tsx +66 -42
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
- package/Components/Screen/hooks.ts +75 -6
- package/Components/Screen/index.tsx +9 -4
- package/Components/Screen/navigationHandler.ts +49 -24
- package/Components/Screen/orientationHandler.ts +10 -13
- package/Components/ScreenResolver/index.tsx +26 -16
- package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +44 -26
- package/Components/Tabs/TV/Tabs.tsx +20 -3
- package/Components/Tabs/TabContent.tsx +7 -4
- package/Components/Transitioner/Scene.tsx +10 -3
- package/Components/Transitioner/index.js +3 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +118 -171
- package/Components/VideoModal/ModalAnimation/index.ts +2 -13
- package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
- package/Components/VideoModal/PlayerWrapper.tsx +14 -88
- package/Components/VideoModal/VideoModal.tsx +1 -5
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +15 -7
- package/Components/VideoModal/hooks/useModalSize.ts +10 -5
- package/Components/VideoModal/playerWrapperStyle.ts +70 -0
- package/Components/VideoModal/playerWrapperUtils.ts +91 -0
- package/Components/VideoModal/utils.ts +19 -9
- 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/Contexts/ScreenContext/index.tsx +54 -19
- package/Contexts/ScreenTrackedViewPositionsContext/__tests__/index.test.tsx +1 -1
- package/Contexts/ZappHookModalContext/index.tsx +37 -61
- package/Contexts/ZappPipesContext/ZappPipesContextFactory.tsx +18 -7
- package/Contexts/index.ts +0 -2
- 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/ResolverSelector.tsx +25 -7
- package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +212 -5
- 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/events/index.ts +3 -0
- package/events/scrollEndReached.ts +15 -0
- package/index.d.ts +7 -0
- package/package.json +6 -5
- package/Components/River/TV/withTVEventHandler.tsx +0 -27
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -417
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +0 -294
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +0 -93
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
- package/Helpers/DataSourceHelper/index.js +0 -19
|
@@ -3,7 +3,7 @@ import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUt
|
|
|
3
3
|
|
|
4
4
|
import * as zappPipesRedux from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
5
|
import configureStore from "redux-mock-store";
|
|
6
|
-
import thunk from "redux-thunk";
|
|
6
|
+
import { thunk } from "redux-thunk";
|
|
7
7
|
|
|
8
8
|
import { zappPipesDataConnector } from "../index";
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="@applicaster/zapp-react-native-ui-components" />
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
5
|
-
import {
|
|
5
|
+
import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
6
|
import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
7
7
|
import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
|
|
8
8
|
import { ResolverSelector } from "./ResolverSelector";
|
|
@@ -23,7 +23,7 @@ export function zappPipesDataConnector(
|
|
|
23
23
|
) {
|
|
24
24
|
return function WrappedWithZappPipesData(props: Props) {
|
|
25
25
|
const { screenData } = useRoute();
|
|
26
|
-
const
|
|
26
|
+
const plugins = usePlugins();
|
|
27
27
|
const screenContextData = useScreenContext();
|
|
28
28
|
|
|
29
29
|
const {
|
|
@@ -76,7 +76,7 @@ export function StaticFeedResolver({
|
|
|
76
76
|
|
|
77
77
|
const zappPipesDataProps = useMemo(
|
|
78
78
|
() => ({
|
|
79
|
-
zappPipesData: { url, loading, data, error },
|
|
79
|
+
zappPipesData: { url, loading, data, error }, // todo: add applyItemLimit
|
|
80
80
|
reloadData,
|
|
81
81
|
loadNextData: undefined, // Static resolver doesn't support pagination
|
|
82
82
|
}),
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
getInflatedDataSourceUrl,
|
|
10
10
|
getSearchContext,
|
|
11
11
|
useFeedLoader,
|
|
12
|
-
useFeedRefresh,
|
|
13
12
|
useRoute,
|
|
14
13
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
14
|
+
import { refreshCoordinator } from "@applicaster/zapp-react-native-utils/refreshUtils/RefreshCoordinator";
|
|
15
15
|
|
|
16
16
|
import { ComponentDataSourceContext, ZappPipesDataProps } from "../types";
|
|
17
17
|
import { useScreenStateStore } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useScreenStateStore";
|
|
@@ -199,6 +199,8 @@ export function UrlFeedResolver({
|
|
|
199
199
|
const { pathname } = useRoute();
|
|
200
200
|
const screenStateStore = useScreenStateStore();
|
|
201
201
|
|
|
202
|
+
const screenId = (screenContext?.id || "unknown_screen_id") as string;
|
|
203
|
+
|
|
202
204
|
// Setup listeners for data source URL
|
|
203
205
|
useEffect(() => {
|
|
204
206
|
if (!reloadData) {
|
|
@@ -214,10 +216,19 @@ export function UrlFeedResolver({
|
|
|
214
216
|
url: dataSourceUrl,
|
|
215
217
|
pathname,
|
|
216
218
|
screenStateStore,
|
|
219
|
+
component,
|
|
220
|
+
screenId,
|
|
217
221
|
callback: reloadData,
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
|
-
}, [
|
|
224
|
+
}, [
|
|
225
|
+
dataSourceUrl,
|
|
226
|
+
reloadData,
|
|
227
|
+
pathname,
|
|
228
|
+
screenStateStore,
|
|
229
|
+
component,
|
|
230
|
+
screenId,
|
|
231
|
+
]);
|
|
221
232
|
|
|
222
233
|
// Setup favorites listener
|
|
223
234
|
useEffect(() => {
|
|
@@ -230,11 +241,11 @@ export function UrlFeedResolver({
|
|
|
230
241
|
}
|
|
231
242
|
}, [type, reloadData]);
|
|
232
243
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
const unregister = refreshCoordinator.register(component, screenId);
|
|
246
|
+
|
|
247
|
+
return () => unregister();
|
|
248
|
+
}, [component, screenId]);
|
|
238
249
|
|
|
239
250
|
const loadNextData = useMemo(
|
|
240
251
|
() => (!isLast && isVerticalListOrGrid(component) ? undefined : loadNext),
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { itemLimitForData } from "..";
|
|
2
|
+
|
|
3
|
+
describe("itemLimitForData (no mocks)", () => {
|
|
4
|
+
test("returns full array when item_limit is undefined (default Infinity)", () => {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const result = itemLimitForData([1, 2, 3], {
|
|
7
|
+
rules: { item_limit: undefined },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
expect(result).toEqual([1, 2, 3]);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("enforces positive numeric item_limit", () => {
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
const result = itemLimitForData([1, 2, 3, 4], {
|
|
16
|
+
rules: { item_limit: 2 },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
expect(result).toEqual([1, 2]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("returns empty array when entry is empty", () => {
|
|
23
|
+
const result = itemLimitForData([], {
|
|
24
|
+
rules: { item_limit: 3 },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
expect(result).toEqual([]);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test("defaults entry to empty array when it is undefined", () => {
|
|
31
|
+
const result = itemLimitForData(undefined, {
|
|
32
|
+
rules: { item_limit: 5 },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(result).toEqual([]);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test("handles missing component", () => {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
const result = itemLimitForData([10, 20, 30], undefined);
|
|
41
|
+
// missing component → item_limit = undefined → fallback to Infinity
|
|
42
|
+
expect(result).toEqual([10, 20, 30]);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("handles missing rules object", () => {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
const result = itemLimitForData([10, 20, 30], {});
|
|
48
|
+
|
|
49
|
+
expect(result).toEqual([10, 20, 30]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test("non-positive item_limit should fall back to Infinity", () => {
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
const result = itemLimitForData([1, 2, 3], {
|
|
55
|
+
rules: { item_limit: -10 },
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// -10 → invalid → fallback to Infinity → no limit
|
|
59
|
+
expect(result).toEqual([1, 2, 3]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("zero item_limit should fall back to Infinity", () => {
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
const result = itemLimitForData([1, 2, 3], {
|
|
65
|
+
rules: { item_limit: 0 },
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// 0 → invalid → fallback to Infinity
|
|
69
|
+
expect(result).toEqual([1, 2, 3]);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("NaN item_limit should fall back to Infinity", () => {
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
const result = itemLimitForData([1, 2, 3], {
|
|
75
|
+
rules: { item_limit: NaN },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(result).toEqual([1, 2, 3]);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { toPositiveNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
2
|
+
|
|
3
|
+
export function itemLimitForData(
|
|
4
|
+
entry: ZappEntry[],
|
|
5
|
+
component: {
|
|
6
|
+
rules?: { item_limit?: number | string };
|
|
7
|
+
}
|
|
8
|
+
) {
|
|
9
|
+
if (!component?.rules?.item_limit) {
|
|
10
|
+
return entry;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const itemLimit = toPositiveNumberWithDefault(
|
|
14
|
+
Infinity,
|
|
15
|
+
component?.rules?.item_limit
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
return (entry || []).slice(0, itemLimit);
|
|
19
|
+
}
|
package/events/index.ts
CHANGED
|
@@ -5,4 +5,7 @@ export enum QBUIComponentEvents {
|
|
|
5
5
|
scrollVerticallyToInitialOffset = "scrollVerticallyToInitialOffset",
|
|
6
6
|
focusOnSelectedTab = "focusOnSelectedTab",
|
|
7
7
|
focusOnSelectedTopMenuItem = "focusOnSelectedTopMenuItem",
|
|
8
|
+
scrollToTopForScreenWrappedInContainer = "scrollToTopForScreenWrappedInContainer",
|
|
8
9
|
}
|
|
10
|
+
|
|
11
|
+
export { scrollEndReached$, emitScrollEndReached } from "./scrollEndReached";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Subject } from "rxjs";
|
|
2
|
+
import { throttleTime } from "rxjs/operators";
|
|
3
|
+
|
|
4
|
+
const SCROLL_END_THROTTLE_MS = 1000;
|
|
5
|
+
const scrollEndReachedSubject = new Subject<void>();
|
|
6
|
+
|
|
7
|
+
/* Throttle so we only emit at most once per second; RN often fires onEndReached repeatedly (e.g. on Android) when near the bottom. */
|
|
8
|
+
export const scrollEndReached$ = scrollEndReachedSubject.pipe(
|
|
9
|
+
throttleTime(SCROLL_END_THROTTLE_MS)
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
/* Call from scroll container (ComponentsMap or Tabs) when scroll reaches end. */
|
|
13
|
+
export const emitScrollEndReached = (): void => {
|
|
14
|
+
scrollEndReachedSubject.next();
|
|
15
|
+
};
|
package/index.d.ts
CHANGED
|
@@ -228,6 +228,12 @@ declare type TabsSelectionContextType = {
|
|
|
228
228
|
selectedEntryIndex: number;
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
+
declare type TabsAccessibility = {
|
|
232
|
+
announcement?: string;
|
|
233
|
+
selectedHint?: string;
|
|
234
|
+
hint?: string;
|
|
235
|
+
};
|
|
236
|
+
|
|
231
237
|
declare type TabsProps = {
|
|
232
238
|
entry: ZappEntry[];
|
|
233
239
|
groupId: string;
|
|
@@ -235,6 +241,7 @@ declare type TabsProps = {
|
|
|
235
241
|
focused?: boolean;
|
|
236
242
|
parentFocus?: ParentFocus;
|
|
237
243
|
style?: ReactViewStyle;
|
|
244
|
+
accessibility?: TabsAccessibility;
|
|
238
245
|
};
|
|
239
246
|
|
|
240
247
|
declare type TabContentProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.110",
|
|
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",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-rc.110",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.110",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-rc.110",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-rc.110",
|
|
35
|
+
"fast-json-stable-stringify": "^2.1.0",
|
|
35
36
|
"promise": "^8.3.0",
|
|
36
37
|
"url": "^0.11.0",
|
|
37
38
|
"uuid": "^3.3.2"
|
|
@@ -1,27 +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
|
-
|
|
7
|
-
export const withTvEventHandler = (Component) => {
|
|
8
|
-
return function WithTVEventHandler(props) {
|
|
9
|
-
const navigator = useNavigation();
|
|
10
|
-
|
|
11
|
-
const remoteHandler = (event) => {
|
|
12
|
-
const { eventType } = event;
|
|
13
|
-
|
|
14
|
-
const canGoBack = navigator.canGoBack();
|
|
15
|
-
|
|
16
|
-
if (eventType === "menu" && canGoBack) {
|
|
17
|
-
navigator.goBack();
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<TVEventHandlerComponent tvEventHandler={remoteHandler}>
|
|
23
|
-
<Component {...props} />
|
|
24
|
-
</TVEventHandlerComponent>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Animated, ViewStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
useModalAnimationContext,
|
|
6
|
-
PlayerAnimationStateEnum,
|
|
7
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
style: ViewStyle[];
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const AnimatedPlayerModalWrapper = (props: Props) => {
|
|
15
|
-
const {
|
|
16
|
-
playerAnimationState,
|
|
17
|
-
animatedValues: { lastScrollY, dragScrollY, translateYOffset },
|
|
18
|
-
modalSnapPoints,
|
|
19
|
-
setStartComponentsAnimation,
|
|
20
|
-
} = useModalAnimationContext();
|
|
21
|
-
|
|
22
|
-
const interpolateConfig: Animated.InterpolationConfigType = React.useMemo(
|
|
23
|
-
() => ({
|
|
24
|
-
inputRange: modalSnapPoints,
|
|
25
|
-
outputRange: modalSnapPoints,
|
|
26
|
-
extrapolate: "clamp",
|
|
27
|
-
}),
|
|
28
|
-
[modalSnapPoints]
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
let translateY;
|
|
32
|
-
|
|
33
|
-
if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
|
|
34
|
-
translateY = translateYOffset.interpolate(interpolateConfig);
|
|
35
|
-
} else {
|
|
36
|
-
const reverseLastScrollY = Animated.multiply(
|
|
37
|
-
new Animated.Value(-1),
|
|
38
|
-
lastScrollY
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
translateY = Animated.add(
|
|
42
|
-
translateYOffset,
|
|
43
|
-
Animated.add(dragScrollY, reverseLastScrollY)
|
|
44
|
-
).interpolate(interpolateConfig);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
(playerAnimationState === PlayerAnimationStateEnum.minimize ||
|
|
49
|
-
playerAnimationState === PlayerAnimationStateEnum.maximize) &&
|
|
50
|
-
setStartComponentsAnimation(true);
|
|
51
|
-
}, [playerAnimationState]);
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Animated.View
|
|
55
|
-
style={[props.style, { transform: [{ translateY: translateY }] }]}
|
|
56
|
-
>
|
|
57
|
-
{props.children}
|
|
58
|
-
</Animated.View>
|
|
59
|
-
);
|
|
60
|
-
};
|