@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5071825192 → 14.0.0-alpha.5395814692
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/AudioPlayer/index.tsx +15 -0
- package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
- package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -2
- package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
- package/Components/AudioPlayer/mobile/index.tsx +18 -0
- package/Components/AudioPlayer/{Artwork.tsx → tv/Artwork.tsx} +3 -2
- package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
- package/Components/AudioPlayer/tv/Layout.tsx +168 -0
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +7 -1
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +6 -2
- package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +6 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +164 -0
- package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +19 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -2
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +1 -2
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +17 -58
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/MasterCell/index.tsx +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +1 -4
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/package.json +5 -5
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -202
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
- package/Components/AudioPlayer/__tests__/__snapshots__/channel.test.js.snap +0 -28
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
- package/Components/AudioPlayer/index.ts +0 -1
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
- /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerTV } from "./tv";
|
|
5
|
+
import { AudioPlayerMobile } from "./mobile";
|
|
6
|
+
|
|
7
|
+
import { Props } from "./types";
|
|
8
|
+
|
|
9
|
+
export function AudioPlayer(props: Props) {
|
|
10
|
+
if (isTV()) {
|
|
11
|
+
return <AudioPlayerTV {...props} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return <AudioPlayerMobile {...props} />;
|
|
15
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
ImageBackground,
|
|
5
|
+
Animated,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
10
|
+
|
|
11
|
+
const THREE_SECONDS = 3000;
|
|
12
|
+
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
flex: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
type Props = {
|
|
20
|
+
backgroundImageSource: { uri: string };
|
|
21
|
+
style: ViewStyle;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function AudioPlayerMobileLayout({
|
|
25
|
+
backgroundImageSource,
|
|
26
|
+
style,
|
|
27
|
+
}: Props) {
|
|
28
|
+
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
29
|
+
|
|
30
|
+
const mainContainerStyles = platformSelect({
|
|
31
|
+
native: {
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
overflow: "hidden",
|
|
34
|
+
...style,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
Animated.timing(fadeAnimation, {
|
|
40
|
+
toValue: 1,
|
|
41
|
+
duration: THREE_SECONDS,
|
|
42
|
+
useNativeDriver: true,
|
|
43
|
+
}).start();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View style={mainContainerStyles} pointerEvents="none">
|
|
48
|
+
<Animated.View
|
|
49
|
+
style={[
|
|
50
|
+
mainContainerStyles,
|
|
51
|
+
{
|
|
52
|
+
opacity: fadeAnimation,
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
>
|
|
56
|
+
<ImageBackground
|
|
57
|
+
source={backgroundImageSource}
|
|
58
|
+
style={styles.flex}
|
|
59
|
+
resizeMode="cover"
|
|
60
|
+
>
|
|
61
|
+
<View style={mainContainerStyles} />
|
|
62
|
+
</ImageBackground>
|
|
63
|
+
</Animated.View>
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<
|
|
3
|
+
exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
pointerEvents="none"
|
|
6
6
|
style={
|
|
@@ -32,7 +32,7 @@ exports[`<AudioPlayer /> renders correctly 1`] = `
|
|
|
32
32
|
resizeMode="cover"
|
|
33
33
|
source={
|
|
34
34
|
{
|
|
35
|
-
"uri": "
|
|
35
|
+
"uri": "background_image_url",
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
style={
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerMobileLayout } from "../Layout";
|
|
5
|
+
|
|
6
|
+
const audioPlayerLayoutProps = {
|
|
7
|
+
backgroundImageSource: { uri: "background_image_url" },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
describe("<AudioPlayerMobileLayout />", () => {
|
|
11
|
+
it("renders correctly", () => {
|
|
12
|
+
const { toJSON } = render(
|
|
13
|
+
<AudioPlayerMobileLayout {...audioPlayerLayoutProps} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(toJSON()).toMatchSnapshot();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useBackgroundImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
3
|
+
|
|
4
|
+
import { AudioPlayerMobileLayout } from "./Layout";
|
|
5
|
+
import { Props } from "../types";
|
|
6
|
+
|
|
7
|
+
export function AudioPlayerMobile(props: Props) {
|
|
8
|
+
const { audio_item, style = {} } = props;
|
|
9
|
+
|
|
10
|
+
const backgroundImageSource = useBackgroundImage(audio_item);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<AudioPlayerMobileLayout
|
|
14
|
+
backgroundImageSource={backgroundImageSource}
|
|
15
|
+
style={style}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { QBImage } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
3
4
|
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
5
|
|
|
5
6
|
const styles = StyleSheet.create({
|
|
@@ -29,7 +30,7 @@ export function Artwork({ srcImage, config }: Props) {
|
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
32
|
<View style={styles.container}>
|
|
32
|
-
<
|
|
33
|
+
<QBImage
|
|
33
34
|
fadeDuration={0}
|
|
34
35
|
source={{ uri: srcImage }}
|
|
35
36
|
style={[styles.image, { borderRadius }]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Image } from "react-native";
|
|
3
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
3
4
|
|
|
4
5
|
type Props = {
|
|
5
6
|
srcImage: string;
|
|
@@ -15,17 +16,16 @@ type Props = {
|
|
|
15
16
|
const imageStyles = {
|
|
16
17
|
width: 128,
|
|
17
18
|
height: 72,
|
|
18
|
-
};
|
|
19
19
|
|
|
20
|
-
const containerStyles = {
|
|
21
|
-
...imageStyles,
|
|
22
20
|
marginBottom: 30,
|
|
23
21
|
};
|
|
24
22
|
|
|
25
23
|
export function Channel({ srcImage }: Props) {
|
|
24
|
+
if (isNilOrEmpty(srcImage)) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
26
28
|
return (
|
|
27
|
-
<
|
|
28
|
-
<Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
|
|
29
|
-
</View>
|
|
29
|
+
<Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
|
|
30
30
|
);
|
|
31
31
|
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ImageBackground, View, ViewStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
+
|
|
6
|
+
import { Artwork } from "./Artwork";
|
|
7
|
+
import { directionStyles } from "./helpers";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
artwork: string;
|
|
11
|
+
config: {
|
|
12
|
+
titleColor: string;
|
|
13
|
+
summaryColor: string;
|
|
14
|
+
backgroundImageOverlay?: string;
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
backgroundImage: Option<string>;
|
|
17
|
+
isRTL: boolean;
|
|
18
|
+
artworkBorderRadius: Option<number>;
|
|
19
|
+
};
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
style: ViewStyle;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const backgroundImgStyles = platformSelect({
|
|
25
|
+
tvos: {
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "center",
|
|
30
|
+
},
|
|
31
|
+
android_tv: {
|
|
32
|
+
width: "100%",
|
|
33
|
+
height: "100%",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "center",
|
|
36
|
+
},
|
|
37
|
+
web: {
|
|
38
|
+
position: "absolute",
|
|
39
|
+
margin: "auto",
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexWrap: "wrap",
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
flex: 1,
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export function AudioPlayerTVLayout({
|
|
51
|
+
artwork,
|
|
52
|
+
config,
|
|
53
|
+
children,
|
|
54
|
+
style,
|
|
55
|
+
}: Props) {
|
|
56
|
+
const { backgroundColor, backgroundImage, backgroundImageOverlay, isRTL } =
|
|
57
|
+
config;
|
|
58
|
+
|
|
59
|
+
const backgroundImageSource = { uri: backgroundImage };
|
|
60
|
+
|
|
61
|
+
const backgroundColorStyle = backgroundImage
|
|
62
|
+
? "transparent"
|
|
63
|
+
: backgroundColor;
|
|
64
|
+
|
|
65
|
+
const textContainerStyles = platformSelect({
|
|
66
|
+
tvos: {
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
alignItems: directionStyles(isRTL).justifyContent,
|
|
69
|
+
},
|
|
70
|
+
android_tv: {
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
alignItems: directionStyles(isRTL).justifyContent,
|
|
73
|
+
},
|
|
74
|
+
web: {
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
alignItems: directionStyles(isRTL).justifyContent,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const mainContainerStyles = React.useMemo(
|
|
81
|
+
() =>
|
|
82
|
+
platformSelect({
|
|
83
|
+
tvos: {
|
|
84
|
+
width: "100%",
|
|
85
|
+
height: "100%",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
89
|
+
backgroundColor: backgroundColorStyle,
|
|
90
|
+
},
|
|
91
|
+
android_tv: {
|
|
92
|
+
width: "100%",
|
|
93
|
+
height: "100%",
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
justifyContent: "center",
|
|
96
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
97
|
+
backgroundColor: backgroundColorStyle,
|
|
98
|
+
},
|
|
99
|
+
web: {
|
|
100
|
+
width: 1920,
|
|
101
|
+
height: 1080,
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
105
|
+
backgroundColor: backgroundColorStyle,
|
|
106
|
+
},
|
|
107
|
+
native: {
|
|
108
|
+
backgroundColor: backgroundColorStyle,
|
|
109
|
+
overflow: "hidden",
|
|
110
|
+
...style,
|
|
111
|
+
},
|
|
112
|
+
samsung_tv: {
|
|
113
|
+
position: "absolute",
|
|
114
|
+
margin: "auto",
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexWrap: "wrap",
|
|
117
|
+
height: "100vh",
|
|
118
|
+
width: "100vw",
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
justifyContent: "center",
|
|
121
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
122
|
+
backgroundColor: backgroundColorStyle,
|
|
123
|
+
},
|
|
124
|
+
lg_tv: {
|
|
125
|
+
position: "absolute",
|
|
126
|
+
margin: "auto",
|
|
127
|
+
display: "flex",
|
|
128
|
+
flexWrap: "wrap",
|
|
129
|
+
height: "100vh",
|
|
130
|
+
width: "100vw",
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
134
|
+
backgroundColor: backgroundColorStyle,
|
|
135
|
+
},
|
|
136
|
+
}),
|
|
137
|
+
[backgroundColorStyle, isRTL, style]
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const backgroundOverlayStyles = React.useMemo(
|
|
141
|
+
() => ({
|
|
142
|
+
backgroundColor: backgroundImageOverlay,
|
|
143
|
+
}),
|
|
144
|
+
[backgroundImageOverlay]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
if (backgroundImage) {
|
|
148
|
+
return (
|
|
149
|
+
<ImageBackground
|
|
150
|
+
source={backgroundImageSource}
|
|
151
|
+
style={backgroundImgStyles}
|
|
152
|
+
resizeMode="cover"
|
|
153
|
+
>
|
|
154
|
+
<View style={[mainContainerStyles, backgroundOverlayStyles]}>
|
|
155
|
+
<Artwork srcImage={artwork} config={config} />
|
|
156
|
+
<View style={textContainerStyles}>{children}</View>
|
|
157
|
+
</View>
|
|
158
|
+
</ImageBackground>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<View style={mainContainerStyles}>
|
|
164
|
+
<Artwork srcImage={artwork} config={config} />
|
|
165
|
+
<View style={textContainerStyles}>{children}</View>
|
|
166
|
+
</View>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, ViewStyle, TextStyle } from "react-native";
|
|
3
3
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
5
|
+
|
|
4
6
|
import { directionStyles } from "./helpers";
|
|
5
7
|
|
|
6
8
|
type Props = {
|
|
@@ -19,7 +21,6 @@ type Props = {
|
|
|
19
21
|
|
|
20
22
|
const containerStyles = ({ isRTL }) => ({
|
|
21
23
|
width: 600,
|
|
22
|
-
height: 40,
|
|
23
24
|
justifyContent: directionStyles(isRTL)
|
|
24
25
|
.justifyContent as ViewStyle["justifyContent"],
|
|
25
26
|
});
|
|
@@ -38,11 +39,16 @@ const textStyles = ({
|
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
export function Runtime({ start_time, end_time, config }: Props) {
|
|
42
|
+
if (isNilOrEmpty(start_time) && isNilOrEmpty(end_time)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
return (
|
|
42
47
|
<View style={containerStyles({ isRTL: config.isRTL })}>
|
|
43
48
|
{!!start_time && !!end_time && (
|
|
44
49
|
<Text
|
|
45
50
|
style={textStyles(config) as TextStyle}
|
|
51
|
+
numberOfLines={1}
|
|
46
52
|
>{`${start_time} - ${end_time}`}</Text>
|
|
47
53
|
)}
|
|
48
54
|
</View>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
3
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
config: {
|
|
@@ -18,7 +19,6 @@ type Props = {
|
|
|
18
19
|
const styles = StyleSheet.create({
|
|
19
20
|
container: {
|
|
20
21
|
width: 600,
|
|
21
|
-
height: 80,
|
|
22
22
|
marginBottom: 30,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
@@ -38,9 +38,13 @@ const textStyles = ({
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
export function Summary({ summary, config }: Props) {
|
|
41
|
+
if (isNilOrEmpty(summary)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
41
45
|
return (
|
|
42
46
|
<View style={styles.container}>
|
|
43
|
-
<Text style={textStyles(config)} numberOfLines={
|
|
47
|
+
<Text style={textStyles(config)} numberOfLines={3}>
|
|
44
48
|
{summary}
|
|
45
49
|
</Text>
|
|
46
50
|
</View>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
3
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
config: {
|
|
@@ -18,7 +19,6 @@ type Props = {
|
|
|
18
19
|
const styles = StyleSheet.create({
|
|
19
20
|
container: {
|
|
20
21
|
width: 600,
|
|
21
|
-
height: 100,
|
|
22
22
|
marginBottom: 12,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
@@ -32,9 +32,13 @@ const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
export function Title({ title, config }: Props) {
|
|
35
|
+
if (isNilOrEmpty(title)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
return (
|
|
36
40
|
<View style={styles.container}>
|
|
37
|
-
<Text style={textStyles(config)} numberOfLines={
|
|
41
|
+
<Text style={textStyles(config)} numberOfLines={3}>
|
|
38
42
|
{title}
|
|
39
43
|
</Text>
|
|
40
44
|
</View>
|
package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap
RENAMED
|
@@ -4,13 +4,13 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
{
|
|
7
|
-
"height": 40,
|
|
8
7
|
"justifyContent": "flex-start",
|
|
9
8
|
"width": 600,
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
>
|
|
13
12
|
<Text
|
|
13
|
+
numberOfLines={1}
|
|
14
14
|
style={
|
|
15
15
|
{
|
|
16
16
|
"alignItems": "flex-end",
|
|
@@ -33,13 +33,13 @@ exports[`<Runtime /> RTL renders correctly 1`] = `
|
|
|
33
33
|
<View
|
|
34
34
|
style={
|
|
35
35
|
{
|
|
36
|
-
"height": 40,
|
|
37
36
|
"justifyContent": "flex-end",
|
|
38
37
|
"width": 600,
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
>
|
|
42
41
|
<Text
|
|
42
|
+
numberOfLines={1}
|
|
43
43
|
style={
|
|
44
44
|
{
|
|
45
45
|
"alignItems": "flex-start",
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<AudioPlayerTV /> renders correctly 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
accessibilityIgnoresInvertColors={true}
|
|
6
|
+
>
|
|
7
|
+
<Image
|
|
8
|
+
resizeMode="cover"
|
|
9
|
+
source={
|
|
10
|
+
{
|
|
11
|
+
"uri": "https://example.com",
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
style={
|
|
15
|
+
[
|
|
16
|
+
{
|
|
17
|
+
"bottom": 0,
|
|
18
|
+
"left": 0,
|
|
19
|
+
"position": "absolute",
|
|
20
|
+
"right": 0,
|
|
21
|
+
"top": 0,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"height": undefined,
|
|
25
|
+
"width": undefined,
|
|
26
|
+
},
|
|
27
|
+
undefined,
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
<View
|
|
32
|
+
style={
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
"backgroundColor": "transparent",
|
|
36
|
+
"overflow": "hidden",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"backgroundColor": undefined,
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
>
|
|
44
|
+
<View
|
|
45
|
+
style={
|
|
46
|
+
{
|
|
47
|
+
"marginHorizontal": 24,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
>
|
|
51
|
+
<Image
|
|
52
|
+
fadeDuration={0}
|
|
53
|
+
resizeMode="cover"
|
|
54
|
+
source={
|
|
55
|
+
{
|
|
56
|
+
"uri": "artwork_url",
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
style={
|
|
60
|
+
[
|
|
61
|
+
{
|
|
62
|
+
"height": 400,
|
|
63
|
+
"width": 400,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"borderRadius": 0,
|
|
67
|
+
},
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
<View>
|
|
73
|
+
<Image
|
|
74
|
+
fadeDuration={0}
|
|
75
|
+
source={
|
|
76
|
+
{
|
|
77
|
+
"uri": "https://example.com",
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
style={
|
|
81
|
+
{
|
|
82
|
+
"height": 72,
|
|
83
|
+
"marginBottom": 30,
|
|
84
|
+
"width": 128,
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/>
|
|
88
|
+
<View
|
|
89
|
+
style={
|
|
90
|
+
{
|
|
91
|
+
"marginBottom": 12,
|
|
92
|
+
"width": 600,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
>
|
|
96
|
+
<Text
|
|
97
|
+
numberOfLines={3}
|
|
98
|
+
style={
|
|
99
|
+
{
|
|
100
|
+
"color": "white",
|
|
101
|
+
"fontFamily": null,
|
|
102
|
+
"fontSize": 38,
|
|
103
|
+
"fontWeight": "600",
|
|
104
|
+
"textAlign": "right",
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
>
|
|
108
|
+
tittle
|
|
109
|
+
</Text>
|
|
110
|
+
</View>
|
|
111
|
+
<View
|
|
112
|
+
style={
|
|
113
|
+
{
|
|
114
|
+
"marginBottom": 30,
|
|
115
|
+
"width": 600,
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
>
|
|
119
|
+
<Text
|
|
120
|
+
numberOfLines={3}
|
|
121
|
+
style={
|
|
122
|
+
{
|
|
123
|
+
"color": "white",
|
|
124
|
+
"fontFamily": null,
|
|
125
|
+
"fontSize": 20,
|
|
126
|
+
"fontWeight": "600",
|
|
127
|
+
"opacity": 0.8,
|
|
128
|
+
"textAlign": "right",
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
Summary
|
|
133
|
+
</Text>
|
|
134
|
+
</View>
|
|
135
|
+
<View
|
|
136
|
+
style={
|
|
137
|
+
{
|
|
138
|
+
"justifyContent": "flex-end",
|
|
139
|
+
"width": 600,
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
<Text
|
|
144
|
+
numberOfLines={1}
|
|
145
|
+
style={
|
|
146
|
+
{
|
|
147
|
+
"alignItems": "flex-start",
|
|
148
|
+
"color": "white",
|
|
149
|
+
"flexDirection": "row-reverse",
|
|
150
|
+
"fontFamily": null,
|
|
151
|
+
"fontSize": 20,
|
|
152
|
+
"justifyContent": "flex-end",
|
|
153
|
+
"opacity": 0.8,
|
|
154
|
+
"textAlign": "right",
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
>
|
|
158
|
+
10:10 - 11:11
|
|
159
|
+
</Text>
|
|
160
|
+
</View>
|
|
161
|
+
</View>
|
|
162
|
+
</View>
|
|
163
|
+
</View>
|
|
164
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Channel /> renders correctly 1`] = `
|
|
4
|
+
<Image
|
|
5
|
+
fadeDuration={0}
|
|
6
|
+
source={
|
|
7
|
+
{
|
|
8
|
+
"uri": "https://example.com",
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
style={
|
|
12
|
+
{
|
|
13
|
+
"height": 72,
|
|
14
|
+
"marginBottom": 30,
|
|
15
|
+
"width": 128,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/>
|
|
19
|
+
`;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@testing-library/react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { AudioPlayerTV } from "..";
|
|
5
|
+
|
|
6
|
+
jest.mock("@applicaster/zapp-react-native-utils/audioPlayerUtils", () => ({
|
|
7
|
+
useArtworkImage: jest.fn(() => "artwork_url"),
|
|
8
|
+
}));
|
|
5
9
|
|
|
6
10
|
const audioPlayerProps = {
|
|
7
11
|
audio_item: {
|
|
@@ -45,9 +49,9 @@ const audioPlayerProps = {
|
|
|
45
49
|
styles: {},
|
|
46
50
|
};
|
|
47
51
|
|
|
48
|
-
describe("<
|
|
52
|
+
describe("<AudioPlayerTV />", () => {
|
|
49
53
|
it("renders correctly", () => {
|
|
50
|
-
const { toJSON } = render(<
|
|
54
|
+
const { toJSON } = render(<AudioPlayerTV {...audioPlayerProps} />);
|
|
51
55
|
expect(toJSON()).toMatchSnapshot();
|
|
52
56
|
});
|
|
53
57
|
});
|
|
@@ -2,9 +2,8 @@ const defaults = {
|
|
|
2
2
|
audio_player_title_color: "white",
|
|
3
3
|
audio_player_summary_color: "white",
|
|
4
4
|
audio_player_background_color: "black",
|
|
5
|
-
|
|
5
|
+
audio_player_background_image: undefined,
|
|
6
6
|
audio_player_rtl: false,
|
|
7
|
-
audio_player_background_image_default_color: "",
|
|
8
7
|
};
|
|
9
8
|
|
|
10
9
|
export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
|
|
@@ -1,60 +1,24 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
|
|
3
3
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
|
+
import { useArtworkImage } from "@applicaster/zapp-react-native-utils/audioPlayerUtils";
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { AudioPlayerTVLayout } from "./Layout";
|
|
6
7
|
|
|
7
|
-
import { AudioPlayerLayout } from "./AudioPlayerLayout";
|
|
8
8
|
import { Channel } from "./Channel";
|
|
9
9
|
import { Title } from "./Title";
|
|
10
10
|
import { Summary } from "./Summary";
|
|
11
11
|
import { Runtime } from "./Runtime";
|
|
12
12
|
import { getPropertyFromEntryOrConfig } from "./helpers";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
audio_player_artwork_aspect_ratio?: string;
|
|
19
|
-
audio_player_background_image?: string;
|
|
20
|
-
audio_player_background_color?: string;
|
|
21
|
-
audio_player_channel_icon?: string;
|
|
22
|
-
audio_player_title_color?: string;
|
|
23
|
-
audio_player_summary_color?: string;
|
|
24
|
-
audio_player_rtl?: boolean;
|
|
25
|
-
audio_player_background_image_default_color?: string;
|
|
26
|
-
start_time?: string;
|
|
27
|
-
end_time?: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
plugin_configuration: {
|
|
31
|
-
audio_player_background_color?: string;
|
|
32
|
-
audio_player_title_color?: string;
|
|
33
|
-
audio_player_summary_color?: string;
|
|
34
|
-
audio_player_rtl?: string;
|
|
35
|
-
audio_player_background_image_default_color?: string;
|
|
36
|
-
audio_player_background_image?: string;
|
|
37
|
-
audio_player_artwork_aspect_ratio?: string;
|
|
38
|
-
lg_tv_audio_player_title_font_family?: string;
|
|
39
|
-
lg_tv_audio_player_title_font_size?: number;
|
|
40
|
-
lg_tv_audio_player_summary_font_family?: string;
|
|
41
|
-
lg_tv_audio_player_summary_font_size?: number;
|
|
42
|
-
samsung_tv_audio_player_title_font_family?: string;
|
|
43
|
-
samsung_tv_audio_player_title_font_size?: number;
|
|
44
|
-
samsung_tv_audio_player_summary_font_family?: string;
|
|
45
|
-
samsung_tv_audio_player_summary_font_size?: number;
|
|
46
|
-
tv_os_audio_player_title_font_family?: string;
|
|
47
|
-
tv_os_audio_player_title_font_size?: number;
|
|
48
|
-
tv_os_audio_player_summary_font_family?: string;
|
|
49
|
-
tv_os_audio_player_summary_font_size?: number;
|
|
50
|
-
};
|
|
51
|
-
style?: ViewStyle;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export function AudioPlayer(props: Props) {
|
|
55
|
-
const { audio_item, plugin_configuration, style } = props;
|
|
13
|
+
|
|
14
|
+
import { Props } from "../types";
|
|
15
|
+
|
|
16
|
+
export function AudioPlayerTV(props: Props) {
|
|
17
|
+
const { audio_item, plugin_configuration, style = {} } = props;
|
|
56
18
|
const { extensions, title, summary } = audio_item;
|
|
57
19
|
|
|
20
|
+
const artwork = useArtworkImage(audio_item);
|
|
21
|
+
|
|
58
22
|
const getProp = useCallback(
|
|
59
23
|
getPropertyFromEntryOrConfig({
|
|
60
24
|
entry: audio_item,
|
|
@@ -64,20 +28,20 @@ export function AudioPlayer(props: Props) {
|
|
|
64
28
|
);
|
|
65
29
|
|
|
66
30
|
const config = useMemo(() => {
|
|
67
|
-
// Checking if we are
|
|
31
|
+
// Checking if we are receiving items from the DSP
|
|
68
32
|
const titleColor = getProp("audio_player_title_color");
|
|
69
33
|
const summaryColor = getProp("audio_player_summary_color");
|
|
70
34
|
const backgroundColor = getProp("audio_player_background_color");
|
|
71
35
|
const backgroundImage = getProp("audio_player_background_image");
|
|
72
|
-
const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
|
|
73
36
|
const channelIcon = getProp("audio_player_channel_icon");
|
|
74
37
|
const rtlFlag = getProp("audio_player_rtl");
|
|
75
|
-
const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
|
|
76
38
|
|
|
77
|
-
const
|
|
78
|
-
"
|
|
39
|
+
const backgroundImageOverlay = getProp(
|
|
40
|
+
"audio_player_background_image_overlay"
|
|
79
41
|
);
|
|
80
42
|
|
|
43
|
+
const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
|
|
44
|
+
|
|
81
45
|
const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
|
|
82
46
|
|
|
83
47
|
const titleFontFamily = getProp(
|
|
@@ -152,23 +116,18 @@ export function AudioPlayer(props: Props) {
|
|
|
152
116
|
summaryFontSize,
|
|
153
117
|
runTimeFontFamily,
|
|
154
118
|
runTimeFontSize,
|
|
155
|
-
artworkAspectRatio,
|
|
156
119
|
channelIcon,
|
|
157
|
-
audioPlayerBackgroundImageDefaultColor,
|
|
158
120
|
artworkBorderRadius,
|
|
121
|
+
backgroundImageOverlay,
|
|
159
122
|
};
|
|
160
123
|
}, [getProp]);
|
|
161
124
|
|
|
162
|
-
const artwork = imageSrcFromMediaItem(audio_item, [
|
|
163
|
-
config?.artworkAspectRatio,
|
|
164
|
-
]);
|
|
165
|
-
|
|
166
125
|
return (
|
|
167
|
-
<
|
|
126
|
+
<AudioPlayerTVLayout artwork={artwork} config={config} style={style}>
|
|
168
127
|
<Channel srcImage={config?.channelIcon} config={config} />
|
|
169
128
|
<Title title={title} config={config} />
|
|
170
129
|
<Summary summary={summary} config={config} />
|
|
171
130
|
<Runtime {...extensions} config={config} />
|
|
172
|
-
</
|
|
131
|
+
</AudioPlayerTVLayout>
|
|
173
132
|
);
|
|
174
133
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ViewStyle } from "react-native";
|
|
2
|
+
|
|
3
|
+
export type Props = {
|
|
4
|
+
audio_item: ZappEntry & {
|
|
5
|
+
extensions?: {
|
|
6
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
7
|
+
audio_player_background_image?: string;
|
|
8
|
+
audio_player_background_color?: string;
|
|
9
|
+
audio_player_channel_icon?: string;
|
|
10
|
+
audio_player_title_color?: string;
|
|
11
|
+
audio_player_summary_color?: string;
|
|
12
|
+
audio_player_rtl?: boolean;
|
|
13
|
+
audio_player_background_image_default_color?: string;
|
|
14
|
+
start_time?: string;
|
|
15
|
+
end_time?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
plugin_configuration: {
|
|
19
|
+
audio_player_background_color?: string;
|
|
20
|
+
audio_player_title_color?: string;
|
|
21
|
+
audio_player_summary_color?: string;
|
|
22
|
+
audio_player_rtl?: string;
|
|
23
|
+
audio_player_background_image_default_color?: string;
|
|
24
|
+
audio_player_background_image?: string;
|
|
25
|
+
audio_player_artwork_aspect_ratio?: string;
|
|
26
|
+
lg_tv_audio_player_title_font_family?: string;
|
|
27
|
+
lg_tv_audio_player_title_font_size?: number;
|
|
28
|
+
lg_tv_audio_player_summary_font_family?: string;
|
|
29
|
+
lg_tv_audio_player_summary_font_size?: number;
|
|
30
|
+
samsung_tv_audio_player_title_font_family?: string;
|
|
31
|
+
samsung_tv_audio_player_title_font_size?: number;
|
|
32
|
+
samsung_tv_audio_player_summary_font_family?: string;
|
|
33
|
+
samsung_tv_audio_player_summary_font_size?: number;
|
|
34
|
+
tv_os_audio_player_title_font_family?: string;
|
|
35
|
+
tv_os_audio_player_title_font_size?: number;
|
|
36
|
+
tv_os_audio_player_summary_font_family?: string;
|
|
37
|
+
tv_os_audio_player_summary_font_size?: number;
|
|
38
|
+
};
|
|
39
|
+
style?: ViewStyle;
|
|
40
|
+
};
|
|
@@ -86,7 +86,7 @@ export function masterCellBuilder({
|
|
|
86
86
|
entry: item,
|
|
87
87
|
state: getEntryState(state, entryIsSelected),
|
|
88
88
|
}),
|
|
89
|
-
[state, item
|
|
89
|
+
[state, item, entryIsSelected] // Assuming that item won't mutate
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
const wrapperRef = React.useRef(null);
|
|
@@ -135,9 +135,6 @@ const webStyles = {
|
|
|
135
135
|
},
|
|
136
136
|
inlineRiver: {
|
|
137
137
|
height: INLINE_CONTAINER_CONTENT_HEIGHT,
|
|
138
|
-
|
|
139
|
-
borderWidth: 4,
|
|
140
|
-
borderColor: "yellow",
|
|
141
138
|
},
|
|
142
139
|
};
|
|
143
140
|
|
|
@@ -719,7 +716,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
719
716
|
key={item.id}
|
|
720
717
|
groupId={FocusableGroupMainContainerId}
|
|
721
718
|
cellTapAction={onCellTap}
|
|
722
|
-
extraAnchorPointYOffset={
|
|
719
|
+
extraAnchorPointYOffset={0}
|
|
723
720
|
isScreenWrappedInContainer={true}
|
|
724
721
|
containerHeight={styles.inlineRiver.height}
|
|
725
722
|
componentsMapExtraProps={{
|
|
@@ -28,7 +28,7 @@ const PlayerImageBackgroundComponent = ({
|
|
|
28
28
|
defaultImageDimensions,
|
|
29
29
|
}: Props) => {
|
|
30
30
|
const source = React.useMemo(
|
|
31
|
-
() => ({ uri: imageSrcFromMediaItem(entry, imageKey) }),
|
|
31
|
+
() => ({ uri: imageSrcFromMediaItem(entry, [imageKey]) }),
|
|
32
32
|
[imageKey, entry]
|
|
33
33
|
);
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.5395814692",
|
|
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",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"redux-mock-store": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "14.0.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.5395814692",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "14.0.0-alpha.5395814692",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "14.0.0-alpha.5395814692",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "14.0.0-alpha.5395814692",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"url": "^0.11.0",
|
|
40
40
|
"uuid": "^3.3.2"
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { View, ImageBackground, Animated, ViewStyle } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
-
|
|
6
|
-
import { Artwork } from "./Artwork";
|
|
7
|
-
import { directionStyles } from "./helpers";
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
artwork?: string;
|
|
11
|
-
config: {
|
|
12
|
-
titleColor: string;
|
|
13
|
-
summaryColor: string;
|
|
14
|
-
backgroundColor: string;
|
|
15
|
-
backgroundImage: string;
|
|
16
|
-
isRTL: boolean;
|
|
17
|
-
artworkBorderRadius: Option<number>;
|
|
18
|
-
};
|
|
19
|
-
children: React.ReactNode;
|
|
20
|
-
style: ViewStyle;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
|
|
24
|
-
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
25
|
-
|
|
26
|
-
const fadeAudioPlayerIn = () => {
|
|
27
|
-
Animated.timing(fadeAnimation, {
|
|
28
|
-
toValue: 1,
|
|
29
|
-
duration: 3000,
|
|
30
|
-
useNativeDriver: true,
|
|
31
|
-
}).start();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const { isRTL, backgroundColor, backgroundImage } = config;
|
|
35
|
-
|
|
36
|
-
const backgroundImageSource = { uri: backgroundImage };
|
|
37
|
-
|
|
38
|
-
const backgroundColorStyle = backgroundImage
|
|
39
|
-
? "transparent"
|
|
40
|
-
: backgroundColor;
|
|
41
|
-
|
|
42
|
-
const mainContainerStyles = platformSelect({
|
|
43
|
-
tvos: {
|
|
44
|
-
width: "100%",
|
|
45
|
-
height: "100%",
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
49
|
-
backgroundColor: backgroundColorStyle,
|
|
50
|
-
},
|
|
51
|
-
android_tv: {
|
|
52
|
-
width: "100%",
|
|
53
|
-
height: "100%",
|
|
54
|
-
alignItems: "center",
|
|
55
|
-
justifyContent: "center",
|
|
56
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
57
|
-
backgroundColor: backgroundColorStyle,
|
|
58
|
-
},
|
|
59
|
-
web: {
|
|
60
|
-
width: 1920,
|
|
61
|
-
height: 1080,
|
|
62
|
-
alignItems: "center",
|
|
63
|
-
justifyContent: "center",
|
|
64
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
65
|
-
backgroundColor: backgroundColorStyle,
|
|
66
|
-
},
|
|
67
|
-
native: {
|
|
68
|
-
backgroundColor: backgroundColorStyle,
|
|
69
|
-
overflow: "hidden",
|
|
70
|
-
...style,
|
|
71
|
-
},
|
|
72
|
-
samsung_tv: {
|
|
73
|
-
position: "absolute",
|
|
74
|
-
margin: "auto",
|
|
75
|
-
display: "flex",
|
|
76
|
-
flexWrap: "wrap",
|
|
77
|
-
width: "100vw",
|
|
78
|
-
flex: 1,
|
|
79
|
-
alignItems: "center",
|
|
80
|
-
justifyContent: "center",
|
|
81
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
82
|
-
backgroundColor: backgroundColorStyle,
|
|
83
|
-
},
|
|
84
|
-
lg_tv: {
|
|
85
|
-
position: "absolute",
|
|
86
|
-
margin: "auto",
|
|
87
|
-
display: "flex",
|
|
88
|
-
flexWrap: "wrap",
|
|
89
|
-
width: "100vw",
|
|
90
|
-
flex: 1,
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
justifyContent: "center",
|
|
93
|
-
flexDirection: directionStyles(isRTL).flexDirection,
|
|
94
|
-
backgroundColor: backgroundColorStyle,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const backgroundImgStyles = platformSelect({
|
|
99
|
-
tvos: {
|
|
100
|
-
width: "100%",
|
|
101
|
-
height: "100%",
|
|
102
|
-
alignItems: "center",
|
|
103
|
-
justifyContent: "center",
|
|
104
|
-
},
|
|
105
|
-
android_tv: {
|
|
106
|
-
width: "100%",
|
|
107
|
-
height: "100%",
|
|
108
|
-
alignItems: "center",
|
|
109
|
-
justifyContent: "center",
|
|
110
|
-
},
|
|
111
|
-
web: {
|
|
112
|
-
position: "absolute",
|
|
113
|
-
margin: "auto",
|
|
114
|
-
display: "flex",
|
|
115
|
-
flexWrap: "wrap",
|
|
116
|
-
width: "100%",
|
|
117
|
-
height: "100%",
|
|
118
|
-
flex: 1,
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
justifyContent: "center",
|
|
121
|
-
},
|
|
122
|
-
native: {
|
|
123
|
-
flex: 1,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const textContainerStyles = platformSelect({
|
|
128
|
-
tvos: {
|
|
129
|
-
width: 600,
|
|
130
|
-
height: 362,
|
|
131
|
-
marginHorizontal: 24,
|
|
132
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
133
|
-
},
|
|
134
|
-
android_tv: {
|
|
135
|
-
width: 600,
|
|
136
|
-
height: 362,
|
|
137
|
-
marginHorizontal: 24,
|
|
138
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
139
|
-
},
|
|
140
|
-
web: {
|
|
141
|
-
margin: 10,
|
|
142
|
-
height: "100vh",
|
|
143
|
-
alignItems: directionStyles(isRTL).justifyContent,
|
|
144
|
-
justifyContent: "center",
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
|
|
149
|
-
<ImageBackground
|
|
150
|
-
source={backgroundImageSource}
|
|
151
|
-
style={backgroundImgStyles}
|
|
152
|
-
resizeMode="cover"
|
|
153
|
-
>
|
|
154
|
-
<View style={mainContainerStyles}>
|
|
155
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
156
|
-
<View style={textContainerStyles}>{children}</View>
|
|
157
|
-
</View>
|
|
158
|
-
</ImageBackground>
|
|
159
|
-
) : (
|
|
160
|
-
<View style={mainContainerStyles}>
|
|
161
|
-
{!!artwork && <Artwork srcImage={artwork} config={config} />}
|
|
162
|
-
<View style={textContainerStyles}>{children}</View>
|
|
163
|
-
</View>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
const audioPlayerLayoutMobile = () => {
|
|
167
|
-
fadeAudioPlayerIn();
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<View style={mainContainerStyles} pointerEvents="none">
|
|
171
|
-
<Animated.View
|
|
172
|
-
style={[
|
|
173
|
-
mainContainerStyles,
|
|
174
|
-
{
|
|
175
|
-
opacity: fadeAnimation,
|
|
176
|
-
},
|
|
177
|
-
]}
|
|
178
|
-
>
|
|
179
|
-
<ImageBackground
|
|
180
|
-
source={backgroundImageSource}
|
|
181
|
-
style={backgroundImgStyles}
|
|
182
|
-
resizeMode="cover"
|
|
183
|
-
>
|
|
184
|
-
<View style={mainContainerStyles} />
|
|
185
|
-
</ImageBackground>
|
|
186
|
-
</Animated.View>
|
|
187
|
-
</View>
|
|
188
|
-
);
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const audioPlayerLayout = platformSelect({
|
|
192
|
-
tvos: audioPlayerLayoutTV,
|
|
193
|
-
android_tv: audioPlayerLayoutTV,
|
|
194
|
-
web: audioPlayerLayoutTV,
|
|
195
|
-
samsung_tv: audioPlayerLayoutTV,
|
|
196
|
-
lg_tv: audioPlayerLayoutTV,
|
|
197
|
-
ios: audioPlayerLayoutMobile(),
|
|
198
|
-
android: audioPlayerLayoutMobile(),
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
return audioPlayerLayout;
|
|
202
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<AudioPlayerLayout /> renders correctly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
pointerEvents="none"
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"backgroundColor": "transparent",
|
|
9
|
-
"overflow": "hidden",
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
<View
|
|
14
|
-
collapsable={false}
|
|
15
|
-
style={
|
|
16
|
-
{
|
|
17
|
-
"backgroundColor": "transparent",
|
|
18
|
-
"opacity": 0,
|
|
19
|
-
"overflow": "hidden",
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
>
|
|
23
|
-
<View
|
|
24
|
-
accessibilityIgnoresInvertColors={true}
|
|
25
|
-
style={
|
|
26
|
-
{
|
|
27
|
-
"flex": 1,
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
>
|
|
31
|
-
<Image
|
|
32
|
-
resizeMode="cover"
|
|
33
|
-
source={
|
|
34
|
-
{
|
|
35
|
-
"uri": "https://example.com",
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
style={
|
|
39
|
-
[
|
|
40
|
-
{
|
|
41
|
-
"bottom": 0,
|
|
42
|
-
"left": 0,
|
|
43
|
-
"position": "absolute",
|
|
44
|
-
"right": 0,
|
|
45
|
-
"top": 0,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"height": undefined,
|
|
49
|
-
"width": undefined,
|
|
50
|
-
},
|
|
51
|
-
undefined,
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
/>
|
|
55
|
-
<View
|
|
56
|
-
style={
|
|
57
|
-
{
|
|
58
|
-
"backgroundColor": "transparent",
|
|
59
|
-
"overflow": "hidden",
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
</View>
|
|
66
|
-
`;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<Channel /> renders correctly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
style={
|
|
6
|
-
{
|
|
7
|
-
"height": 72,
|
|
8
|
-
"marginBottom": 30,
|
|
9
|
-
"width": 128,
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
<Image
|
|
14
|
-
fadeDuration={0}
|
|
15
|
-
source={
|
|
16
|
-
{
|
|
17
|
-
"uri": "https://example.com",
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
style={
|
|
21
|
-
{
|
|
22
|
-
"height": 72,
|
|
23
|
-
"width": 128,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/>
|
|
27
|
-
</View>
|
|
28
|
-
`;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@testing-library/react-native";
|
|
3
|
-
|
|
4
|
-
import { AudioPlayerLayout } from "../AudioPlayerLayout";
|
|
5
|
-
|
|
6
|
-
const audioPlayerLayoutProps = {
|
|
7
|
-
artwork: "string",
|
|
8
|
-
config: {
|
|
9
|
-
titleColor: "white",
|
|
10
|
-
summaryColor: "white",
|
|
11
|
-
backgroundColor: "black",
|
|
12
|
-
backgroundImage: "https://example.com",
|
|
13
|
-
isRTL: true,
|
|
14
|
-
},
|
|
15
|
-
children: [],
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
describe("<AudioPlayerLayout />", () => {
|
|
19
|
-
it("renders correctly", () => {
|
|
20
|
-
const { toJSON } = render(
|
|
21
|
-
<AudioPlayerLayout {...audioPlayerLayoutProps} />
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(toJSON()).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AudioPlayer } from "./AudioPlayer";
|
|
File without changes
|
/package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|