@applicaster/zapp-react-native-ui-components 15.0.0-alpha.4069571733 → 15.0.0-alpha.4368022015
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/PlayerImageBackground/index.tsx +2 -11
- package/Components/VideoModal/ModalAnimation/index.ts +1 -3
- package/Components/VideoModal/ModalAnimation/utils.ts +1 -12
- package/Components/VideoModal/PlayerWrapper.tsx +10 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/playerWrapperUtils.ts +21 -4
- package/package.json +5 -5
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -17
|
@@ -2,10 +2,6 @@ import React, { PropsWithChildren } from "react";
|
|
|
2
2
|
import { ImageBackground, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
5
|
-
import {
|
|
6
|
-
AnimationComponent,
|
|
7
|
-
ComponentAnimationType,
|
|
8
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
9
5
|
|
|
10
6
|
type Props = PropsWithChildren<{
|
|
11
7
|
entry: ZappEntry;
|
|
@@ -23,7 +19,6 @@ const PlayerImageBackgroundComponent = ({
|
|
|
23
19
|
style,
|
|
24
20
|
imageStyle,
|
|
25
21
|
imageKey,
|
|
26
|
-
defaultImageDimensions,
|
|
27
22
|
}: Props) => {
|
|
28
23
|
const source = React.useMemo(
|
|
29
24
|
() => ({ uri: imageSrcFromMediaItem(entry, [imageKey]) }),
|
|
@@ -34,11 +29,7 @@ const PlayerImageBackgroundComponent = ({
|
|
|
34
29
|
|
|
35
30
|
return (
|
|
36
31
|
<View style={style}>
|
|
37
|
-
<
|
|
38
|
-
style={style}
|
|
39
|
-
animationType={ComponentAnimationType.player}
|
|
40
|
-
additionalData={defaultImageDimensions}
|
|
41
|
-
>
|
|
32
|
+
<View style={style}>
|
|
42
33
|
<ImageBackground
|
|
43
34
|
resizeMode="cover"
|
|
44
35
|
style={imageSize}
|
|
@@ -47,7 +38,7 @@ const PlayerImageBackgroundComponent = ({
|
|
|
47
38
|
>
|
|
48
39
|
{children}
|
|
49
40
|
</ImageBackground>
|
|
50
|
-
</
|
|
41
|
+
</View>
|
|
51
42
|
</View>
|
|
52
43
|
);
|
|
53
44
|
};
|
|
@@ -2,8 +2,6 @@ export { withModalAnimationProvider } from "./ModalAnimationContext";
|
|
|
2
2
|
|
|
3
3
|
export { useModalAnimationContext } from "./useModalAnimationContext";
|
|
4
4
|
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
export { ComponentAnimationType, defaultAspectRatioWidth } from "./utils";
|
|
5
|
+
export { defaultAspectRatioWidth } from "./utils";
|
|
8
6
|
|
|
9
7
|
export { DURATION_TO_MINIMIZE, DURATION_TO_MAXIMIZE } from "./const";
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/* eslint-disable padding-line-between-statements */
|
|
2
|
-
|
|
3
|
-
export enum ComponentAnimationType {
|
|
4
|
-
bottomBar = "bottomBar",
|
|
5
|
-
player = "player",
|
|
6
|
-
componentFade = "componentFade",
|
|
7
|
-
componentAppears = "componentAppears",
|
|
8
|
-
moveUpComponent = "moveUpComponent",
|
|
9
|
-
moveComponentHorizontal = "moveComponentHorizontal",
|
|
10
|
-
audioPlayerPaddingHorizontal = "audioPlayerPaddingHorizontal",
|
|
11
|
-
}
|
|
12
|
-
|
|
13
1
|
export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
|
|
2
|
+
|
|
14
3
|
export const PROGRESS_BAR_HEIGHT = 3;
|
|
15
4
|
|
|
16
5
|
export const defaultAspectRatioWidth = (height: number): number =>
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StyleSheet, View, ViewStyle } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
Edge,
|
|
5
|
+
SafeAreaView,
|
|
6
|
+
useSafeAreaInsets,
|
|
7
|
+
} from "react-native-safe-area-context";
|
|
4
8
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
9
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
10
|
import { playerDimensionsHack } from "./utils";
|
|
@@ -63,8 +67,12 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
63
67
|
[isInlineModal, isTabletLandscape, tabletWidth]
|
|
64
68
|
);
|
|
65
69
|
|
|
70
|
+
const insets = useSafeAreaInsets();
|
|
71
|
+
|
|
66
72
|
const aspectRatio = React.useMemo(
|
|
67
|
-
() => calculateAspectRatio(isInlineModal, pip),
|
|
73
|
+
() => calculateAspectRatio(isInlineModal, pip, insets),
|
|
74
|
+
// ignoring insets - only initial needed
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
68
76
|
[isInlineModal, pip]
|
|
69
77
|
);
|
|
70
78
|
|
|
@@ -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
|
}));
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Dimensions, Platform } from "react-native";
|
|
2
2
|
import { Edge } from "react-native-safe-area-context";
|
|
3
3
|
|
|
4
|
+
import {
|
|
5
|
+
isAndroidPlatform,
|
|
6
|
+
isAndroidVersionAtLeast,
|
|
7
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
8
|
+
|
|
9
|
+
const MIN_SUPPORTED_ANDROID_API = 34;
|
|
10
|
+
|
|
11
|
+
export const isOldAndroidDevice =
|
|
12
|
+
isAndroidPlatform() && !isAndroidVersionAtLeast(MIN_SUPPORTED_ANDROID_API);
|
|
13
|
+
|
|
4
14
|
export type DimensionsT = {
|
|
5
15
|
width: number | string;
|
|
6
16
|
height: number | string | undefined;
|
|
@@ -31,11 +41,15 @@ export const getMinWindowDimension = () => {
|
|
|
31
41
|
return Math.min(width, height);
|
|
32
42
|
};
|
|
33
43
|
|
|
34
|
-
export const getScreenAspectRatio = (
|
|
44
|
+
export const getScreenAspectRatio = (insets?: {
|
|
45
|
+
top: number;
|
|
46
|
+
bottom: number;
|
|
47
|
+
}) => {
|
|
35
48
|
const longEdge = getMaxWindowDimension();
|
|
36
49
|
const shortEdge = getMinWindowDimension();
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
// subtract insets to get correct aspect ratio on devices with notches
|
|
52
|
+
return longEdge / (shortEdge - ((insets?.top ?? 0) + (insets?.bottom ?? 0)));
|
|
39
53
|
};
|
|
40
54
|
|
|
41
55
|
export const getEdges = (
|
|
@@ -64,9 +78,12 @@ export const getBaseDimensions = (
|
|
|
64
78
|
|
|
65
79
|
export const calculateAspectRatio = (
|
|
66
80
|
isInlineModal: boolean,
|
|
67
|
-
pip?: boolean
|
|
81
|
+
pip?: boolean,
|
|
82
|
+
insets?: { top: number; bottom: number }
|
|
68
83
|
): number => {
|
|
69
|
-
return !isInlineModal && !pip
|
|
84
|
+
return !isInlineModal && !pip
|
|
85
|
+
? getScreenAspectRatio(isOldAndroidDevice ? insets : undefined)
|
|
86
|
+
: 16 / 9;
|
|
70
87
|
};
|
|
71
88
|
|
|
72
89
|
export const getPlayerDimensions = (
|
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.4368022015",
|
|
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.4368022015",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.4368022015",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.4368022015",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.4368022015",
|
|
35
35
|
"promise": "^8.3.0",
|
|
36
36
|
"url": "^0.11.0",
|
|
37
37
|
"uuid": "^3.3.2"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
animationType: string;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
style?: Record<string, any>;
|
|
8
|
-
additionalData?: { [key: string]: any };
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const AnimationComponent = (props: Props) => {
|
|
12
|
-
const { style } = props;
|
|
13
|
-
|
|
14
|
-
const Component = style ? View : React.Fragment;
|
|
15
|
-
|
|
16
|
-
return <Component {...props}>{props.children}</Component>;
|
|
17
|
-
};
|