@applicaster/zapp-react-native-ui-components 14.0.0-alpha.3259144304 → 14.0.0-alpha.3497255033

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.
Files changed (150) hide show
  1. package/Components/AnimatedInOut/index.tsx +69 -26
  2. package/Components/AudioPlayer/mobile/Layout.tsx +1 -1
  3. package/Components/AudioPlayer/tv/Artwork.tsx +3 -2
  4. package/Components/AudioPlayer/tv/Channel.tsx +7 -7
  5. package/Components/AudioPlayer/tv/Layout.tsx +100 -93
  6. package/Components/AudioPlayer/tv/Runtime.tsx +7 -1
  7. package/Components/AudioPlayer/tv/Summary.tsx +6 -2
  8. package/Components/AudioPlayer/tv/Title.tsx +6 -2
  9. package/Components/AudioPlayer/tv/__tests__/__snapshots__/Runtime.test.js.snap +2 -2
  10. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +20 -26
  11. package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +8 -17
  12. package/Components/AudioPlayer/tv/__tests__/__snapshots__/summary.test.js.snap +1 -2
  13. package/Components/AudioPlayer/tv/__tests__/__snapshots__/title.test.js.snap +1 -2
  14. package/Components/AudioPlayer/tv/helpers.tsx +10 -3
  15. package/Components/AudioPlayer/tv/index.tsx +6 -0
  16. package/Components/BaseFocusable/index.tsx +23 -12
  17. package/Components/Cell/Cell.tsx +91 -64
  18. package/Components/Cell/CellWithFocusable.tsx +3 -0
  19. package/Components/Cell/FocusableWrapper.tsx +44 -0
  20. package/Components/Cell/TvOSCellComponent.tsx +80 -14
  21. package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
  22. package/Components/Cell/index.js +7 -3
  23. package/Components/ComponentResolver/index.ts +1 -1
  24. package/Components/FeedLoader/FeedLoader.tsx +7 -16
  25. package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
  26. package/Components/FeedLoader/index.js +2 -8
  27. package/Components/Focusable/Focusable.tsx +12 -3
  28. package/Components/Focusable/FocusableTvOS.tsx +2 -2
  29. package/Components/Focusable/FocusableiOS.tsx +2 -2
  30. package/Components/Focusable/Touchable.tsx +5 -3
  31. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  32. package/Components/Focusable/index.android.tsx +19 -11
  33. package/Components/Focusable/index.tsx +1 -1
  34. package/Components/FocusableGroup/FocusableTvOS.tsx +1 -1
  35. package/Components/FocusableList/FocusableItem.tsx +4 -3
  36. package/Components/FocusableList/FocusableListItemWrapper.tsx +2 -1
  37. package/Components/FocusableList/hooks/useCellState.android.ts +13 -3
  38. package/Components/FocusableList/index.tsx +20 -9
  39. package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
  40. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
  41. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +22 -21
  42. package/Components/HandlePlayable/HandlePlayable.tsx +25 -66
  43. package/Components/HandlePlayable/const.ts +3 -0
  44. package/Components/HandlePlayable/utils.ts +74 -0
  45. package/Components/Layout/TV/LayoutBackground.tsx +1 -1
  46. package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
  47. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +6 -2
  48. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
  49. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -39
  50. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
  51. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
  52. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +65 -17
  53. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +21 -3
  54. package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +6 -3
  55. package/Components/MasterCell/DefaultComponents/Text/index.tsx +26 -6
  56. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
  57. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
  58. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
  59. package/Components/MasterCell/index.tsx +1 -1
  60. package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
  61. package/Components/MasterCell/utils/index.ts +11 -5
  62. package/Components/OfflineHandler/__tests__/index.test.tsx +26 -35
  63. package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
  64. package/Components/PlayerContainer/PlayerContainer.tsx +44 -43
  65. package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
  66. package/Components/PlayerContainer/index.ts +1 -1
  67. package/Components/PlayerImageBackground/index.tsx +3 -22
  68. package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -42
  69. package/Components/River/ComponentsMap/ContextProviders/ComponentsMapHeightContext.ts +8 -0
  70. package/Components/River/ComponentsMap/ContextProviders/ComponentsMapRefContext.ts +8 -0
  71. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +378 -0
  72. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
  73. package/Components/River/RefreshControl.tsx +11 -17
  74. package/Components/River/TV/River.tsx +2 -17
  75. package/Components/River/TV/index.tsx +3 -1
  76. package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
  77. package/Components/River/TV/withRiverDataLoader.tsx +17 -0
  78. package/Components/River/__tests__/river.test.js +12 -26
  79. package/Components/River/index.tsx +1 -1
  80. package/Components/Screen/TV/hooks/useInitialFocus.ts +14 -4
  81. package/Components/Screen/__tests__/Screen.test.tsx +28 -29
  82. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
  83. package/Components/Screen/__tests__/navigationHandler.test.ts +133 -22
  84. package/Components/Screen/index.tsx +22 -5
  85. package/Components/Screen/navigationHandler.ts +20 -2
  86. package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
  87. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
  88. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
  89. package/Components/ScreenRevealManager/index.ts +1 -0
  90. package/Components/ScreenRevealManager/utils/index.ts +23 -0
  91. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +109 -0
  92. package/Components/Tabs/TV/Tabs.android.tsx +1 -3
  93. package/Components/Tabs/Tabs.tsx +2 -3
  94. package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
  95. package/Components/TextInputTv/index.tsx +11 -0
  96. package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
  97. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  98. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +120 -133
  99. package/Components/VideoModal/ModalAnimation/index.ts +2 -13
  100. package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
  101. package/Components/VideoModal/PlayerDetails.tsx +29 -7
  102. package/Components/VideoModal/PlayerWrapper.tsx +25 -215
  103. package/Components/VideoModal/VideoModal.tsx +4 -22
  104. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
  105. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +2 -7
  106. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  107. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +9 -1
  108. package/Components/VideoModal/hooks/index.ts +0 -2
  109. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +40 -15
  110. package/Components/VideoModal/hooks/useModalSize.ts +23 -2
  111. package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +2 -2
  112. package/Components/VideoModal/hooks/utils/index.ts +4 -0
  113. package/Components/VideoModal/playerWrapperStyle.ts +70 -0
  114. package/Components/VideoModal/playerWrapperUtils.ts +91 -0
  115. package/Components/VideoModal/utils.ts +6 -0
  116. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  117. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  118. package/Contexts/CellFocusedStateContext/index.tsx +27 -0
  119. package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
  120. package/Contexts/ScreenContext/index.tsx +46 -6
  121. package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
  122. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
  123. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
  124. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
  125. package/Decorators/RiverFeedLoader/index.tsx +22 -4
  126. package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +6 -10
  127. package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
  128. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
  129. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
  130. package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
  131. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
  132. package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
  133. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
  134. package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
  135. package/Decorators/ZappPipesDataConnector/index.tsx +26 -293
  136. package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
  137. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
  138. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +266 -0
  139. package/Decorators/ZappPipesDataConnector/types.ts +29 -0
  140. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
  141. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +157 -0
  142. package/events/index.ts +3 -0
  143. package/package.json +5 -9
  144. package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
  145. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
  146. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -421
  147. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
  148. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
  149. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
  150. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
@@ -6,10 +6,6 @@ import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
6
6
 
7
7
  type AnimatedInterpolatedStyle = any;
8
8
 
9
- // type AnimatedInterpolatedStyle =
10
- // | Animated.AnimatedInterpolation
11
- // | [{ [Key: string]: Animated.AnimatedInterpolation }];
12
-
13
9
  type AnimationConfig = {
14
10
  duration: number;
15
11
  easing: EasingFunction;
@@ -45,32 +41,57 @@ export function AnimatedInOut({
45
41
  children,
46
42
  }: Props) {
47
43
  const [animatedValue] = React.useState(new Animated.Value(visible ? 1 : 0));
48
- const [animating, setAnimating] = React.useState(undefined);
44
+ const animationRef = React.useRef<Animated.CompositeAnimation | null>(null);
45
+ const delayTimerRef = React.useRef<NodeJS.Timeout | null>(null);
49
46
 
50
47
  const previousVisible = usePrevious(toBooleanWithDefaultFalse(visible));
51
48
 
52
- function startAnimation(toValue, config) {
53
- if (animating) {
54
- animating.reset();
55
- }
56
-
57
- const { duration, easing, delay = 0, onAnimationEnd = noop } = config;
49
+ const startAnimation = React.useCallback(
50
+ (toValue: number, config: AnimationConfig) => {
51
+ if (delayTimerRef.current) {
52
+ clearTimeout(delayTimerRef.current);
53
+ delayTimerRef.current = null;
54
+ }
55
+
56
+ if (animationRef.current) {
57
+ animationRef.current.stop();
58
+ animationRef.current = null;
59
+ }
60
+
61
+ const { duration, easing, delay = 0, onAnimationEnd = noop } = config;
62
+
63
+ const runAnimation = () => {
64
+ animationRef.current = Animated.timing(animatedValue, {
65
+ duration,
66
+ toValue,
67
+ easing,
68
+ useNativeDriver: true,
69
+ });
70
+
71
+ animationRef.current.start(({ finished }) => {
72
+ if (finished) {
73
+ animationRef.current = null;
74
+ onAnimationEnd();
75
+ }
76
+ });
77
+ };
78
+
79
+ if (delay > 0) {
80
+ delayTimerRef.current = setTimeout(runAnimation, delay);
81
+ } else {
82
+ runAnimation();
83
+ }
84
+ },
85
+ [animatedValue]
86
+ );
58
87
 
59
- const compositeAnimation = Animated.timing(animatedValue, {
60
- duration,
61
- toValue,
62
- easing,
63
- delay,
64
- useNativeDriver: true,
65
- }).start(() => {
66
- setAnimating(undefined);
67
- onAnimationEnd();
68
- });
88
+ React.useEffect(() => {
89
+ if (previousVisible === undefined) {
90
+ animatedValue.setValue(visible ? 1 : 0);
69
91
 
70
- setAnimating(compositeAnimation);
71
- }
92
+ return;
93
+ }
72
94
 
73
- React.useEffect(() => {
74
95
  if (!previousVisible && visible) {
75
96
  startAnimation(1.0, getAnimation(animationConfig, "in"));
76
97
  }
@@ -78,7 +99,29 @@ export function AnimatedInOut({
78
99
  if (previousVisible && !visible) {
79
100
  startAnimation(0.0, getAnimation(animationConfig, "out"));
80
101
  }
81
- }, [visible, previousVisible]);
102
+ }, [
103
+ visible,
104
+ previousVisible,
105
+ animatedValue,
106
+ startAnimation,
107
+ animationConfig,
108
+ ]);
109
+
110
+ React.useEffect(() => {
111
+ return () => {
112
+ if (delayTimerRef.current) {
113
+ clearTimeout(delayTimerRef.current);
114
+ delayTimerRef.current = null;
115
+ }
116
+
117
+ if (animationRef.current) {
118
+ animationRef.current.stop();
119
+ animationRef.current = null;
120
+ }
121
+
122
+ animatedValue.stopAnimation();
123
+ };
124
+ }, [animatedValue]);
82
125
 
83
126
  const styles = visible
84
127
  ? getAnimation(animationConfig, "in").styles
@@ -86,7 +129,7 @@ export function AnimatedInOut({
86
129
 
87
130
  return (
88
131
  <Animated.View
89
- renderToHardwareTextureAndroid={animating}
132
+ renderToHardwareTextureAndroid={!!animationRef.current}
90
133
  style={[styles(animatedValue), staticStyles]}
91
134
  >
92
135
  {children}
@@ -27,7 +27,7 @@ export function AudioPlayerMobileLayout({
27
27
  }: Props) {
28
28
  const fadeAnimation = useRef(new Animated.Value(0)).current;
29
29
 
30
- const mainContainerStyles = platformSelect({
30
+ const mainContainerStyles: ViewStyle = platformSelect({
31
31
  native: {
32
32
  backgroundColor: "transparent",
33
33
  overflow: "hidden",
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- import { View, Image, StyleSheet } from "react-native";
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
- <Image
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 { View, Image } from "react-native";
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
- <View style={containerStyles}>
28
- <Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
29
- </View>
29
+ <Image fadeDuration={0} source={{ uri: srcImage }} style={imageStyles} />
30
30
  );
31
31
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { View, ImageBackground, ViewStyle } from "react-native";
2
+ import { ImageBackground, View, ViewStyle } from "react-native";
3
3
 
4
4
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
5
 
@@ -11,6 +11,7 @@ type Props = {
11
11
  config: {
12
12
  titleColor: string;
13
13
  summaryColor: string;
14
+ backgroundImageOverlay?: string;
14
15
  backgroundColor: string;
15
16
  backgroundImage: Option<string>;
16
17
  isRTL: boolean;
@@ -20,13 +21,40 @@ type Props = {
20
21
  style: ViewStyle;
21
22
  };
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
+
23
50
  export function AudioPlayerTVLayout({
24
51
  artwork,
25
52
  config,
26
53
  children,
27
54
  style,
28
55
  }: Props) {
29
- const { isRTL, backgroundColor, backgroundImage } = config;
56
+ const { backgroundColor, backgroundImage, backgroundImageOverlay, isRTL } =
57
+ config;
30
58
 
31
59
  const backgroundImageSource = { uri: backgroundImage };
32
60
 
@@ -34,108 +62,87 @@ export function AudioPlayerTVLayout({
34
62
  ? "transparent"
35
63
  : backgroundColor;
36
64
 
37
- const mainContainerStyles = platformSelect({
65
+ const textContainerStyles = platformSelect({
38
66
  tvos: {
39
- width: "100%",
40
- height: "100%",
41
- alignItems: "center",
42
67
  justifyContent: "center",
43
- flexDirection: directionStyles(isRTL).flexDirection,
44
- backgroundColor: backgroundColorStyle,
68
+ alignItems: directionStyles(isRTL).justifyContent,
45
69
  },
46
70
  android_tv: {
47
- width: "100%",
48
- height: "100%",
49
- alignItems: "center",
50
71
  justifyContent: "center",
51
- flexDirection: directionStyles(isRTL).flexDirection,
52
- backgroundColor: backgroundColorStyle,
72
+ alignItems: directionStyles(isRTL).justifyContent,
53
73
  },
54
74
  web: {
55
- width: 1920,
56
- height: 1080,
57
- alignItems: "center",
58
- justifyContent: "center",
59
- flexDirection: directionStyles(isRTL).flexDirection,
60
- backgroundColor: backgroundColorStyle,
61
- },
62
- native: {
63
- backgroundColor: backgroundColorStyle,
64
- overflow: "hidden",
65
- ...style,
66
- },
67
- samsung_tv: {
68
- position: "absolute",
69
- margin: "auto",
70
- display: "flex",
71
- flexWrap: "wrap",
72
- width: "100vw",
73
- flex: 1,
74
- alignItems: "center",
75
- justifyContent: "center",
76
- flexDirection: directionStyles(isRTL).flexDirection,
77
- backgroundColor: backgroundColorStyle,
78
- },
79
- lg_tv: {
80
- position: "absolute",
81
- margin: "auto",
82
- display: "flex",
83
- flexWrap: "wrap",
84
- width: "100vw",
85
- flex: 1,
86
- alignItems: "center",
87
75
  justifyContent: "center",
88
- flexDirection: directionStyles(isRTL).flexDirection,
89
- backgroundColor: backgroundColorStyle,
76
+ alignItems: directionStyles(isRTL).justifyContent,
90
77
  },
91
78
  });
92
79
 
93
- const backgroundImgStyles = platformSelect({
94
- tvos: {
95
- width: "100%",
96
- height: "100%",
97
- alignItems: "center",
98
- justifyContent: "center",
99
- },
100
- android_tv: {
101
- width: "100%",
102
- height: "100%",
103
- alignItems: "center",
104
- justifyContent: "center",
105
- },
106
- web: {
107
- position: "absolute",
108
- margin: "auto",
109
- display: "flex",
110
- flexWrap: "wrap",
111
- width: "100%",
112
- height: "100%",
113
- flex: 1,
114
- alignItems: "center",
115
- justifyContent: "center",
116
- },
117
- });
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
+ );
118
139
 
119
- const textContainerStyles = platformSelect({
120
- tvos: {
121
- width: 600,
122
- height: 362,
123
- marginHorizontal: 24,
124
- alignItems: directionStyles(isRTL).justifyContent,
125
- },
126
- android_tv: {
127
- width: 600,
128
- height: 362,
129
- marginHorizontal: 24,
130
- alignItems: directionStyles(isRTL).justifyContent,
131
- },
132
- web: {
133
- margin: 10,
134
- height: "100vh",
135
- alignItems: directionStyles(isRTL).justifyContent,
136
- justifyContent: "center",
137
- },
138
- });
140
+ const backgroundOverlayStyles = React.useMemo(
141
+ () => ({
142
+ backgroundColor: backgroundImageOverlay,
143
+ }),
144
+ [backgroundImageOverlay]
145
+ );
139
146
 
140
147
  if (backgroundImage) {
141
148
  return (
@@ -144,7 +151,7 @@ export function AudioPlayerTVLayout({
144
151
  style={backgroundImgStyles}
145
152
  resizeMode="cover"
146
153
  >
147
- <View style={mainContainerStyles}>
154
+ <View style={[mainContainerStyles, backgroundOverlayStyles]}>
148
155
  <Artwork srcImage={artwork} config={config} />
149
156
  <View style={textContainerStyles}>{children}</View>
150
157
  </View>
@@ -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={2}>
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={2}>
41
+ <Text style={textStyles(config)} numberOfLines={3}>
38
42
  {title}
39
43
  </Text>
40
44
  </View>
@@ -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",
@@ -30,10 +30,15 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
30
30
  />
31
31
  <View
32
32
  style={
33
- {
34
- "backgroundColor": "transparent",
35
- "overflow": "hidden",
36
- }
33
+ [
34
+ {
35
+ "backgroundColor": "transparent",
36
+ "overflow": "hidden",
37
+ },
38
+ {
39
+ "backgroundColor": undefined,
40
+ },
41
+ ]
37
42
  }
38
43
  >
39
44
  <View
@@ -65,7 +70,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
65
70
  />
66
71
  </View>
67
72
  <View>
68
- <View
73
+ <Image
74
+ fadeDuration={0}
75
+ source={
76
+ {
77
+ "uri": "https://example.com",
78
+ }
79
+ }
69
80
  style={
70
81
  {
71
82
  "height": 72,
@@ -73,33 +84,17 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
73
84
  "width": 128,
74
85
  }
75
86
  }
76
- >
77
- <Image
78
- fadeDuration={0}
79
- source={
80
- {
81
- "uri": "https://example.com",
82
- }
83
- }
84
- style={
85
- {
86
- "height": 72,
87
- "width": 128,
88
- }
89
- }
90
- />
91
- </View>
87
+ />
92
88
  <View
93
89
  style={
94
90
  {
95
- "height": 100,
96
91
  "marginBottom": 12,
97
92
  "width": 600,
98
93
  }
99
94
  }
100
95
  >
101
96
  <Text
102
- numberOfLines={2}
97
+ numberOfLines={3}
103
98
  style={
104
99
  {
105
100
  "color": "white",
@@ -116,14 +111,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
116
111
  <View
117
112
  style={
118
113
  {
119
- "height": 80,
120
114
  "marginBottom": 30,
121
115
  "width": 600,
122
116
  }
123
117
  }
124
118
  >
125
119
  <Text
126
- numberOfLines={2}
120
+ numberOfLines={3}
127
121
  style={
128
122
  {
129
123
  "color": "white",
@@ -141,13 +135,13 @@ exports[`<AudioPlayerTV /> renders correctly 1`] = `
141
135
  <View
142
136
  style={
143
137
  {
144
- "height": 40,
145
138
  "justifyContent": "flex-end",
146
139
  "width": 600,
147
140
  }
148
141
  }
149
142
  >
150
143
  <Text
144
+ numberOfLines={1}
151
145
  style={
152
146
  {
153
147
  "alignItems": "flex-start",
@@ -1,7 +1,13 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<Channel /> renders correctly 1`] = `
4
- <View
4
+ <Image
5
+ fadeDuration={0}
6
+ source={
7
+ {
8
+ "uri": "https://example.com",
9
+ }
10
+ }
5
11
  style={
6
12
  {
7
13
  "height": 72,
@@ -9,20 +15,5 @@ exports[`<Channel /> renders correctly 1`] = `
9
15
  "width": 128,
10
16
  }
11
17
  }
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>
18
+ />
28
19
  `;