@applicaster/zapp-react-native-ui-components 13.0.0-rc.98 → 13.0.0
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/tv/Artwork.tsx +41 -0
- package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +7 -7
- package/Components/AudioPlayer/tv/Layout.tsx +166 -0
- package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +9 -2
- package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +17 -10
- package/Components/AudioPlayer/tv/Title.tsx +46 -0
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +4 -4
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +9 -4
- 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 +2 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +2 -3
- package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
- package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -6
- package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +17 -67
- package/Components/AudioPlayer/types.ts +40 -0
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/ModalComponent/BottomSheetModalContent.tsx +32 -46
- package/Components/ModalComponent/Button/index.tsx +25 -29
- package/Components/ModalComponent/Header/index.tsx +9 -8
- package/Components/PlayerContainer/PlayerContainer.tsx +31 -41
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +7 -3
- package/Components/River/RiverItem.tsx +8 -4
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/RouteManager/TestId.tsx +1 -5
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +0 -1
- package/Components/RouteManager/__tests__/testId.test.js +0 -4
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/__tests__/Screen.test.tsx +22 -14
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -2
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +1 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +3 -9
- package/Components/VideoModal/PlayerDetails.tsx +5 -0
- package/Components/VideoModal/PlayerWrapper.tsx +9 -19
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +60 -0
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
- package/package.json +5 -5
- package/Components/AudioPlayer/Artwork.tsx +0 -35
- package/Components/AudioPlayer/AudioPlayerLayout.tsx +0 -203
- package/Components/AudioPlayer/Title.tsx +0 -39
- 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__}/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
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { QBImage } from "@applicaster/zapp-react-native-ui-components/Components/Image";
|
|
4
|
+
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
5
|
+
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
container: {
|
|
8
|
+
marginHorizontal: 24,
|
|
9
|
+
},
|
|
10
|
+
image: {
|
|
11
|
+
width: 400,
|
|
12
|
+
height: 400,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
type Props = {
|
|
17
|
+
srcImage: string;
|
|
18
|
+
config?: {
|
|
19
|
+
titleColor: string;
|
|
20
|
+
summaryColor: string;
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
backgroundImage: string;
|
|
23
|
+
isRTL: boolean;
|
|
24
|
+
artworkBorderRadius: Option<number>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function Artwork({ srcImage, config }: Props) {
|
|
29
|
+
const borderRadius = toNumberWithDefaultZero(config.artworkBorderRadius);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View style={styles.container}>
|
|
33
|
+
<QBImage
|
|
34
|
+
fadeDuration={0}
|
|
35
|
+
source={{ uri: srcImage }}
|
|
36
|
+
style={[styles.image, { borderRadius }]}
|
|
37
|
+
resizeMode="cover"
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -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,166 @@
|
|
|
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
|
+
margin: "auto",
|
|
114
|
+
display: "flex",
|
|
115
|
+
flexWrap: "wrap",
|
|
116
|
+
width: "100vw",
|
|
117
|
+
flex: 1,
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
justifyContent: "center",
|
|
120
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
121
|
+
backgroundColor: backgroundColorStyle,
|
|
122
|
+
},
|
|
123
|
+
lg_tv: {
|
|
124
|
+
margin: "auto",
|
|
125
|
+
display: "flex",
|
|
126
|
+
flexWrap: "wrap",
|
|
127
|
+
width: "100vw",
|
|
128
|
+
flex: 1,
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
flexDirection: directionStyles(isRTL).flexDirection,
|
|
132
|
+
backgroundColor: backgroundColorStyle,
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
[backgroundColorStyle, isRTL, style]
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const backgroundOverlayStyles = React.useMemo(
|
|
139
|
+
() => ({
|
|
140
|
+
backgroundColor: backgroundImageOverlay,
|
|
141
|
+
}),
|
|
142
|
+
[backgroundImageOverlay]
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
if (backgroundImage) {
|
|
146
|
+
return (
|
|
147
|
+
<ImageBackground
|
|
148
|
+
source={backgroundImageSource}
|
|
149
|
+
style={backgroundImgStyles}
|
|
150
|
+
resizeMode="cover"
|
|
151
|
+
>
|
|
152
|
+
<View style={[mainContainerStyles, backgroundOverlayStyles]}>
|
|
153
|
+
<Artwork srcImage={artwork} config={config} />
|
|
154
|
+
<View style={textContainerStyles}>{children}</View>
|
|
155
|
+
</View>
|
|
156
|
+
</ImageBackground>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return (
|
|
161
|
+
<View style={mainContainerStyles}>
|
|
162
|
+
<Artwork srcImage={artwork} config={config} />
|
|
163
|
+
<View style={textContainerStyles}>{children}</View>
|
|
164
|
+
</View>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, Text, ViewStyle, TextStyle } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
5
|
+
|
|
3
6
|
import { directionStyles } from "./helpers";
|
|
4
7
|
|
|
5
8
|
type Props = {
|
|
@@ -18,7 +21,6 @@ type Props = {
|
|
|
18
21
|
|
|
19
22
|
const containerStyles = ({ isRTL }) => ({
|
|
20
23
|
width: 600,
|
|
21
|
-
height: 40,
|
|
22
24
|
justifyContent: directionStyles(isRTL)
|
|
23
25
|
.justifyContent as ViewStyle["justifyContent"],
|
|
24
26
|
});
|
|
@@ -31,17 +33,22 @@ const textStyles = ({
|
|
|
31
33
|
}) => ({
|
|
32
34
|
color: summaryColor,
|
|
33
35
|
opacity: 0.8,
|
|
34
|
-
fontSize:
|
|
36
|
+
fontSize: toNumberWithDefault(20, runTimeFontSize),
|
|
35
37
|
fontFamily: runTimeFontFamily || null,
|
|
36
38
|
...directionStyles(isRTL),
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
export function Runtime({ start_time, end_time, config }: Props) {
|
|
42
|
+
if (isNilOrEmpty(start_time) && isNilOrEmpty(end_time)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
return (
|
|
41
47
|
<View style={containerStyles({ isRTL: config.isRTL })}>
|
|
42
48
|
{!!start_time && !!end_time && (
|
|
43
49
|
<Text
|
|
44
50
|
style={textStyles(config) as TextStyle}
|
|
51
|
+
numberOfLines={1}
|
|
45
52
|
>{`${start_time} - ${end_time}`}</Text>
|
|
46
53
|
)}
|
|
47
54
|
</View>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, Text, TextStyle } from "react-native";
|
|
2
|
+
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
3
5
|
|
|
4
6
|
type Props = {
|
|
5
7
|
config: {
|
|
@@ -14,11 +16,12 @@ type Props = {
|
|
|
14
16
|
summary: string | number;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
width: 600,
|
|
22
|
+
marginBottom: 30,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
22
25
|
|
|
23
26
|
const textStyles = ({
|
|
24
27
|
summaryColor,
|
|
@@ -26,8 +29,8 @@ const textStyles = ({
|
|
|
26
29
|
summaryFontFamily,
|
|
27
30
|
summaryFontSize,
|
|
28
31
|
}) => ({
|
|
29
|
-
textAlign: (isRTL ? "
|
|
30
|
-
fontSize:
|
|
32
|
+
textAlign: (isRTL ? "right" : "left") as TextStyle["textAlign"],
|
|
33
|
+
fontSize: toNumberWithDefault(20, summaryFontSize),
|
|
31
34
|
color: summaryColor,
|
|
32
35
|
fontWeight: "600" as TextStyle["fontWeight"],
|
|
33
36
|
opacity: 0.8,
|
|
@@ -35,9 +38,13 @@ const textStyles = ({
|
|
|
35
38
|
});
|
|
36
39
|
|
|
37
40
|
export function Summary({ summary, config }: Props) {
|
|
41
|
+
if (isNilOrEmpty(summary)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
return (
|
|
39
|
-
<View style={
|
|
40
|
-
<Text style={textStyles(config)} numberOfLines={
|
|
46
|
+
<View style={styles.container}>
|
|
47
|
+
<Text style={textStyles(config)} numberOfLines={3}>
|
|
41
48
|
{summary}
|
|
42
49
|
</Text>
|
|
43
50
|
</View>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text, TextStyle, StyleSheet } from "react-native";
|
|
3
|
+
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
config: {
|
|
8
|
+
titleColor: string;
|
|
9
|
+
summaryColor: string;
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
backgroundImage: string;
|
|
12
|
+
isRTL: boolean;
|
|
13
|
+
titleFontFamily: string;
|
|
14
|
+
titleFontSize: number;
|
|
15
|
+
};
|
|
16
|
+
title: string | number;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
width: 600,
|
|
22
|
+
marginBottom: 12,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const textStyles = ({ titleColor, isRTL, titleFontFamily, titleFontSize }) => ({
|
|
27
|
+
textAlign: (isRTL ? "right" : "left") as TextStyle["textAlign"],
|
|
28
|
+
fontSize: toNumberWithDefault(38, titleFontSize),
|
|
29
|
+
fontWeight: "600" as TextStyle["fontWeight"],
|
|
30
|
+
color: titleColor,
|
|
31
|
+
fontFamily: titleFontFamily || null,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export function Title({ title, config }: Props) {
|
|
35
|
+
if (isNilOrEmpty(title)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<View style={styles.container}>
|
|
41
|
+
<Text style={textStyles(config)} numberOfLines={3}>
|
|
42
|
+
{title}
|
|
43
|
+
</Text>
|
|
44
|
+
</View>
|
|
45
|
+
);
|
|
46
|
+
}
|
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",
|
|
@@ -20,7 +20,7 @@ exports[`<Runtime /> LTR renders correctly 1`] = `
|
|
|
20
20
|
"fontSize": 20,
|
|
21
21
|
"justifyContent": "flex-start",
|
|
22
22
|
"opacity": 0.8,
|
|
23
|
-
"textAlign": "
|
|
23
|
+
"textAlign": "left",
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
>
|
|
@@ -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",
|
|
@@ -49,7 +49,7 @@ exports[`<Runtime /> RTL renders correctly 1`] = `
|
|
|
49
49
|
"fontSize": 20,
|
|
50
50
|
"justifyContent": "flex-end",
|
|
51
51
|
"opacity": 0.8,
|
|
52
|
-
"textAlign": "
|
|
52
|
+
"textAlign": "right",
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
>
|