@applicaster/zapp-react-native-ui-components 15.0.0-alpha.2239032089 → 15.0.0-alpha.2349550201
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/Cell/Cell.tsx +8 -3
- package/Components/Cell/FocusableWrapper.tsx +44 -0
- package/Components/Cell/TvOSCellComponent.tsx +80 -14
- package/Components/Focusable/Focusable.tsx +2 -4
- package/Components/Focusable/FocusableTvOS.tsx +1 -5
- package/Components/FocusableGroup/FocusableTvOS.tsx +0 -5
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +9 -11
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -65
- package/Components/HandlePlayable/const.ts +3 -0
- package/Components/HandlePlayable/utils.ts +74 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
- package/Components/MasterCell/index.tsx +2 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +1 -16
- package/Components/PlayerImageBackground/index.tsx +3 -22
- package/Components/River/TV/River.tsx +3 -9
- package/Components/River/TV/index.tsx +3 -3
- package/Components/River/TV/withTVEventHandler.tsx +27 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +14 -4
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
- package/Components/Screen/index.tsx +22 -5
- package/Components/ScreenResolver/index.tsx +8 -2
- package/Components/ScreenRevealManager/utils/index.ts +23 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +54 -24
- package/Components/Tabs/TV/Tabs.tsx +20 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +3 -153
- 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/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/hooks/useModalSize.ts +10 -5
- package/Components/VideoModal/playerWrapperStyle.ts +70 -0
- package/Components/VideoModal/playerWrapperUtils.ts +91 -0
- package/Components/ZappFrameworkComponents/BarView/BarView.tsx +4 -6
- package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +2 -2
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +6 -10
- package/events/index.ts +0 -2
- package/index.d.ts +7 -0
- package/package.json +5 -5
- package/Components/River/TV/withFocusableGroupForContent.tsx +0 -60
- 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
|
@@ -46,6 +46,7 @@ jest.mock("@applicaster/zapp-react-native-utils/theme", () => ({
|
|
|
46
46
|
|
|
47
47
|
jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
48
48
|
isTV: jest.fn(() => false),
|
|
49
|
+
isAndroidPlatform: jest.fn(() => false),
|
|
49
50
|
isApplePlatform: jest.fn(() => true),
|
|
50
51
|
platformSelect: jest.fn((props) => props.android),
|
|
51
52
|
}));
|
|
@@ -33,8 +33,12 @@ const MODAL_SIZE_FOR_LANDSCAPE: Size = {
|
|
|
33
33
|
height: "100%",
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
const SAFE_AREA_BREAKING_API_VERSION = 35;
|
|
37
|
+
|
|
36
38
|
const isOldAndroidDevice =
|
|
37
|
-
isAndroidPlatform() &&
|
|
39
|
+
isAndroidPlatform() &&
|
|
40
|
+
!isAndroidVersionAtLeast(SAFE_AREA_BREAKING_API_VERSION) &&
|
|
41
|
+
!isAndroidTablet();
|
|
38
42
|
|
|
39
43
|
export const useModalSize = (): Size => {
|
|
40
44
|
const frame = useSafeAreaFrame();
|
|
@@ -42,7 +46,7 @@ export const useModalSize = (): Size => {
|
|
|
42
46
|
const [modalSize, setModalSize] = React.useState<Size>({
|
|
43
47
|
width: frame.width,
|
|
44
48
|
height: isOldAndroidDevice
|
|
45
|
-
? frame.height + StatusBar.currentHeight
|
|
49
|
+
? frame.height + (StatusBar.currentHeight ?? 0)
|
|
46
50
|
: frame.height,
|
|
47
51
|
});
|
|
48
52
|
|
|
@@ -57,9 +61,10 @@ export const useModalSize = (): Size => {
|
|
|
57
61
|
|
|
58
62
|
return {
|
|
59
63
|
width: newSize.width,
|
|
60
|
-
height:
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
height:
|
|
65
|
+
isOldAndroidDevice && newSize.height !== "100%"
|
|
66
|
+
? newSize.height + (StatusBar.currentHeight ?? 0)
|
|
67
|
+
: newSize.height,
|
|
63
68
|
};
|
|
64
69
|
});
|
|
65
70
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet, ViewStyle } from "react-native";
|
|
3
|
+
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
|
+
import { playerDimensionsHack } from "./utils";
|
|
6
|
+
import { getTabletWidth } from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
7
|
+
import {
|
|
8
|
+
getBaseDimensions,
|
|
9
|
+
calculateAspectRatio,
|
|
10
|
+
getPlayerDimensions,
|
|
11
|
+
getContainerDimensions,
|
|
12
|
+
} from "./playerWrapperUtils";
|
|
13
|
+
|
|
14
|
+
export const defaultStyles = StyleSheet.create({
|
|
15
|
+
playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const useStyle = ({
|
|
19
|
+
style,
|
|
20
|
+
inline,
|
|
21
|
+
isModal,
|
|
22
|
+
isTabletPortrait,
|
|
23
|
+
configuration,
|
|
24
|
+
pip,
|
|
25
|
+
}) => {
|
|
26
|
+
const isTablet = useIsTablet();
|
|
27
|
+
|
|
28
|
+
const isInlineModal = inline && isModal;
|
|
29
|
+
|
|
30
|
+
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
31
|
+
|
|
32
|
+
const tabletWidth = getTabletWidth(
|
|
33
|
+
configuration.tablet_landscape_sidebar_width,
|
|
34
|
+
style
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const baseDimensions: ViewStyle = React.useMemo(
|
|
38
|
+
() => getBaseDimensions(isInlineModal, isTabletLandscape, tabletWidth),
|
|
39
|
+
[isInlineModal, isTabletLandscape, tabletWidth]
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const aspectRatio = React.useMemo(
|
|
43
|
+
() => calculateAspectRatio(isInlineModal, pip),
|
|
44
|
+
// ignoring insets - only initial needed
|
|
45
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
|
+
[isInlineModal, pip]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return React.useMemo(() => {
|
|
50
|
+
const playerDimensions: ViewStyle = getPlayerDimensions(
|
|
51
|
+
baseDimensions,
|
|
52
|
+
aspectRatio
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const containerDimensions: ViewStyle = getContainerDimensions(
|
|
56
|
+
baseDimensions,
|
|
57
|
+
aspectRatio
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const childrenStyles = {
|
|
61
|
+
...playerDimensions,
|
|
62
|
+
...playerDimensionsHack,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return StyleSheet.create({
|
|
66
|
+
containerDimensions,
|
|
67
|
+
childrenStyles,
|
|
68
|
+
});
|
|
69
|
+
}, [baseDimensions, aspectRatio]);
|
|
70
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Dimensions, DimensionValue, Platform, ViewStyle } from "react-native";
|
|
2
|
+
import { Edge } from "react-native-safe-area-context";
|
|
3
|
+
|
|
4
|
+
export type DimensionsT = {
|
|
5
|
+
width: number | string;
|
|
6
|
+
height: number | string | undefined;
|
|
7
|
+
aspectRatio?: number;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type Configuration = {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
tablet_landscape_sidebar_width?: string;
|
|
13
|
+
tablet_landscape_player_container_background_color?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// This is safe, remembering screen dimensions once as they do not change during runtime
|
|
17
|
+
// TODO: consider sharing screen orientation as a shared function for the app
|
|
18
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
19
|
+
|
|
20
|
+
export const getWindowDimensions = () => {
|
|
21
|
+
const { width, height } = Dimensions.get("window");
|
|
22
|
+
|
|
23
|
+
return { width, height };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const getMaxWindowDimension = () => {
|
|
27
|
+
const { width, height } = getWindowDimensions();
|
|
28
|
+
|
|
29
|
+
return Math.max(width, height);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getMinWindowDimension = () => {
|
|
33
|
+
const { width, height } = getWindowDimensions();
|
|
34
|
+
|
|
35
|
+
return Math.min(width, height);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const getScreenAspectRatio = () => {
|
|
39
|
+
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
40
|
+
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
41
|
+
|
|
42
|
+
return longEdge / shortEdge;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const getEdges = (
|
|
46
|
+
isTablet: boolean,
|
|
47
|
+
isInlineModal: boolean
|
|
48
|
+
): readonly Edge[] => {
|
|
49
|
+
if (isTablet) {
|
|
50
|
+
return ["top"];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!isInlineModal && Platform.OS === "android") {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return ["top"];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const getBaseDimensions = (
|
|
61
|
+
isInlineModal: boolean,
|
|
62
|
+
isTabletLandscape: boolean,
|
|
63
|
+
tabletWidth: DimensionValue
|
|
64
|
+
): ViewStyle => ({
|
|
65
|
+
width: isInlineModal && isTabletLandscape ? tabletWidth : "100%",
|
|
66
|
+
height: undefined,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const calculateAspectRatio = (
|
|
70
|
+
isInlineModal: boolean,
|
|
71
|
+
pip?: boolean
|
|
72
|
+
): number => {
|
|
73
|
+
return !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const getPlayerDimensions = (
|
|
77
|
+
baseDimensions: ViewStyle,
|
|
78
|
+
aspectRatio: number
|
|
79
|
+
): ViewStyle => ({
|
|
80
|
+
...(baseDimensions as any),
|
|
81
|
+
width: baseDimensions.width,
|
|
82
|
+
aspectRatio,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const getContainerDimensions = (
|
|
86
|
+
baseDimensions: ViewStyle,
|
|
87
|
+
aspectRatio?: string | number
|
|
88
|
+
): ViewStyle => ({
|
|
89
|
+
...baseDimensions,
|
|
90
|
+
aspectRatio,
|
|
91
|
+
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleSheet } from "react-native";
|
|
3
|
-
import { SafeAreaView } from "react-native-safe-area-context";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
4
3
|
|
|
5
4
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
6
5
|
import CloseButton from "./Buttons/CloseButton";
|
|
@@ -45,15 +44,14 @@ const BarView = ({ screenStyles, barState = defaultState }: Props) => {
|
|
|
45
44
|
);
|
|
46
45
|
|
|
47
46
|
return (
|
|
48
|
-
<
|
|
49
|
-
edges={["top", "left", "right"]}
|
|
47
|
+
<View
|
|
50
48
|
style={[style.view, isRTL ? style.rtlStyle : {}]}
|
|
51
|
-
testID="BarView-
|
|
49
|
+
testID="BarView-Container"
|
|
52
50
|
>
|
|
53
51
|
{backButton}
|
|
54
52
|
<BarTitle title={barState.title} screenStyles={screenStyles} />
|
|
55
53
|
{closeButton}
|
|
56
|
-
</
|
|
54
|
+
</View>
|
|
57
55
|
);
|
|
58
56
|
};
|
|
59
57
|
|
|
@@ -46,7 +46,7 @@ describe("BarView", () => {
|
|
|
46
46
|
<BarView screenStyles={screenStyles} barState={barState} />
|
|
47
47
|
);
|
|
48
48
|
|
|
49
|
-
expect(getByTestId("BarView-
|
|
49
|
+
expect(getByTestId("BarView-Container").props.style).toContainEqual({
|
|
50
50
|
transform: [{ scaleX: -1 }],
|
|
51
51
|
});
|
|
52
52
|
});
|
|
@@ -58,7 +58,7 @@ describe("BarView", () => {
|
|
|
58
58
|
<BarView screenStyles={screenStyles} barState={barState} />
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
-
expect(getByTestId("BarView-
|
|
61
|
+
expect(getByTestId("BarView-Container").props.style).not.toContainEqual({
|
|
62
62
|
transform: [{ scaleX: -1 }],
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -24,16 +24,12 @@ export const getDatasourceUrl: (
|
|
|
24
24
|
) => {
|
|
25
25
|
const { source, mapping } = R.propOr({}, ["data"], component);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
27
|
+
const contexts = {
|
|
28
|
+
entry: entryContext,
|
|
29
|
+
screen: screenContext || screenData,
|
|
30
|
+
search: getSearchContext(searchContext, mapping),
|
|
31
|
+
};
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return source;
|
|
33
|
+
return getInflatedDataSourceUrl({ source, mapping, contexts });
|
|
38
34
|
}
|
|
39
35
|
);
|
package/events/index.ts
CHANGED
|
@@ -5,6 +5,4 @@ export enum QBUIComponentEvents {
|
|
|
5
5
|
scrollVerticallyToInitialOffset = "scrollVerticallyToInitialOffset",
|
|
6
6
|
focusOnSelectedTab = "focusOnSelectedTab",
|
|
7
7
|
focusOnSelectedTopMenuItem = "focusOnSelectedTopMenuItem",
|
|
8
|
-
focusOnHomeTopMenuItem = "focusOnHomeTopMenuItem",
|
|
9
|
-
topMenuBarTV_onLayout = "topMenuBarTV_onLayout",
|
|
10
8
|
}
|
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-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.2349550201",
|
|
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,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.2349550201",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.2349550201",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.2349550201",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.2349550201",
|
|
35
35
|
"promise": "^8.3.0",
|
|
36
36
|
"url": "^0.11.0",
|
|
37
37
|
"uuid": "^3.3.2"
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { FocusableGroup } from "@applicaster/zapp-react-native-ui-components/Components/FocusableGroup";
|
|
5
|
-
import { riverFocusManager } from "@applicaster/zapp-react-native-utils/appUtils/RiverFocusManager";
|
|
6
|
-
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
7
|
-
|
|
8
|
-
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
9
|
-
import { QBUIComponentEvents } from "@applicaster/zapp-react-native-ui-components/events";
|
|
10
|
-
|
|
11
|
-
import { QUICK_BRICK_TOP_CONTAINER } from "@applicaster/quick-brick-core/const";
|
|
12
|
-
|
|
13
|
-
const useTopMenuLayout = () => {
|
|
14
|
-
const [layout, setLayout] = React.useState(undefined);
|
|
15
|
-
|
|
16
|
-
const handleLayout = React.useCallback((layout) => {
|
|
17
|
-
setLayout(layout);
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
useSubscriberFor(QBUIComponentEvents.topMenuBarTV_onLayout, handleLayout);
|
|
21
|
-
|
|
22
|
-
return layout;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const withFocusableGroupForContent = (Component) => {
|
|
26
|
-
return function (props) {
|
|
27
|
-
const { screenId, isInsideContainer } = props;
|
|
28
|
-
|
|
29
|
-
const topMenuLayout = useTopMenuLayout();
|
|
30
|
-
|
|
31
|
-
const focusableId = React.useMemo(
|
|
32
|
-
() =>
|
|
33
|
-
riverFocusManager.screenFocusableGroupId({
|
|
34
|
-
screenId,
|
|
35
|
-
isInsideContainer,
|
|
36
|
-
}),
|
|
37
|
-
[screenId, isInsideContainer]
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
if (isInsideContainer) {
|
|
41
|
-
return <Component {...props} />;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const topMenuHeight = toNumberWithDefaultZero(topMenuLayout?.height);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<FocusableGroup
|
|
48
|
-
key={focusableId}
|
|
49
|
-
id={focusableId}
|
|
50
|
-
// workaround to avoid intersection between FocusableGroup for content and FocusableGroup for top-menu
|
|
51
|
-
style={{ flex: 1, marginTop: topMenuHeight }}
|
|
52
|
-
groupId={QUICK_BRICK_TOP_CONTAINER}
|
|
53
|
-
>
|
|
54
|
-
<View style={{ flex: 1, marginTop: -1 * topMenuHeight }}>
|
|
55
|
-
<Component {...props} groupId={focusableId} />
|
|
56
|
-
</View>
|
|
57
|
-
</FocusableGroup>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
};
|
|
@@ -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
|
-
};
|