@applicaster/zapp-react-native-ui-components 14.0.0-rc.2 → 14.0.0-rc.3

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.
@@ -1,5 +1,16 @@
1
1
  import React from "react";
2
- import { View, Image } from "react-native";
2
+ import { View, Image, StyleSheet } from "react-native";
3
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
4
+
5
+ const styles = StyleSheet.create({
6
+ container: {
7
+ marginHorizontal: 24,
8
+ },
9
+ image: {
10
+ width: 400,
11
+ height: 400,
12
+ },
13
+ });
3
14
 
4
15
  type Props = {
5
16
  srcImage: string;
@@ -9,25 +20,19 @@ type Props = {
9
20
  backgroundColor: string;
10
21
  backgroundImage: string;
11
22
  isRTL: boolean;
23
+ artworkBorderRadius: Option<number>;
12
24
  };
13
25
  };
14
26
 
15
- const containerStyles = {
16
- marginHorizontal: 24,
17
- };
18
-
19
- const imageStyles = {
20
- width: 400,
21
- height: 400,
22
- };
27
+ export function Artwork({ srcImage, config }: Props) {
28
+ const borderRadius = toNumberWithDefaultZero(config.artworkBorderRadius);
23
29
 
24
- export function Artwork({ srcImage }: Props) {
25
30
  return (
26
- <View style={containerStyles}>
31
+ <View style={styles.container}>
27
32
  <Image
28
33
  fadeDuration={0}
29
34
  source={{ uri: srcImage }}
30
- style={imageStyles}
35
+ style={[styles.image, { borderRadius }]}
31
36
  resizeMode="cover"
32
37
  />
33
38
  </View>
@@ -72,6 +72,7 @@ export function AudioPlayer(props: Props) {
72
72
  const artworkAspectRatio = getProp("audio_player_artwork_aspect_ratio");
73
73
  const channelIcon = getProp("audio_player_channel_icon");
74
74
  const rtlFlag = getProp("audio_player_rtl");
75
+ const artworkBorderRadius = getProp("audio_player_artwork_border_radius");
75
76
 
76
77
  const audioPlayerBackgroundImageDefaultColor = getProp(
77
78
  "audio_player_background_image_default_color"
@@ -154,6 +155,7 @@ export function AudioPlayer(props: Props) {
154
155
  artworkAspectRatio,
155
156
  channelIcon,
156
157
  audioPlayerBackgroundImageDefaultColor,
158
+ artworkBorderRadius,
157
159
  };
158
160
  }, [getProp]);
159
161
 
@@ -14,6 +14,7 @@ type Props = {
14
14
  backgroundColor: string;
15
15
  backgroundImage: string;
16
16
  isRTL: boolean;
17
+ artworkBorderRadius: Option<number>;
17
18
  };
18
19
  children: React.ReactNode;
19
20
  style: ViewStyle;
@@ -97,8 +98,8 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
97
98
 
98
99
  const backgroundImgStyles = platformSelect({
99
100
  tvos: {
100
- width: 1920,
101
- height: 1080,
101
+ width: "100%",
102
+ height: "100%",
102
103
  alignItems: "center",
103
104
  justifyContent: "center",
104
105
  },
@@ -17,10 +17,15 @@ exports[`<Artwork /> renders correctly 1`] = `
17
17
  }
18
18
  }
19
19
  style={
20
- {
21
- "height": 400,
22
- "width": 400,
23
- }
20
+ [
21
+ {
22
+ "height": 400,
23
+ "width": 400,
24
+ },
25
+ {
26
+ "borderRadius": 0,
27
+ },
28
+ ]
24
29
  }
25
30
  />
26
31
  </View>
@@ -6,12 +6,15 @@ import * as R from "ramda";
6
6
  import uuid from "uuid/v4";
7
7
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
8
8
  import {
9
- isApplePlatform,
10
9
  isTV,
11
10
  platformSelect,
12
11
  isAndroidTVPlatform,
12
+ isTvOSPlatform,
13
13
  } from "@applicaster/zapp-react-native-utils/reactUtils";
14
- import { isAudioItem } from "@applicaster/zapp-react-native-utils/playerUtils";
14
+ import {
15
+ isAudioItem,
16
+ isInlineTV as isInlineTVUtil,
17
+ } from "@applicaster/zapp-react-native-utils/playerUtils";
15
18
 
16
19
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
17
20
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
@@ -22,7 +25,7 @@ import {
22
25
  } from "@applicaster/zapp-react-native-utils/reactHooks";
23
26
 
24
27
  import { PlayerStateContext } from "../../Contexts/PlayerStateContext";
25
- import { isAppleTV } from "../../Helpers/Platform";
28
+
26
29
  import {
27
30
  QUICK_BRICK_EVENTS,
28
31
  QuickBrickEvent,
@@ -97,6 +100,11 @@ const focusableBottomContainerId = "player-container-bottom";
97
100
 
98
101
  const isAndroidTV = isAndroidTVPlatform();
99
102
 
103
+ const isTvOS = isTvOSPlatform();
104
+
105
+ // height for container with additional content below player
106
+ const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
107
+
100
108
  const withBorderHack = () => {
101
109
  if (isAndroidTV) {
102
110
  /* @HACK: see GH#7269 */
@@ -126,7 +134,7 @@ const webStyles = {
126
134
  flex: "initial",
127
135
  },
128
136
  inlineRiver: {
129
- height: 400,
137
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
130
138
  },
131
139
  };
132
140
 
@@ -144,7 +152,7 @@ const nativeStyles = {
144
152
  flex: 1,
145
153
  },
146
154
  inlineRiver: {
147
- height: 400,
155
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
148
156
  },
149
157
  };
150
158
 
@@ -164,12 +172,11 @@ const renderApplePlayer = ({
164
172
  videoStyle,
165
173
  playNextData,
166
174
  }) => {
167
- const { title, summary } = item || {};
168
-
169
- if (!isAppleTV() || !player) {
175
+ if (!isTvOS || !player) {
170
176
  return null;
171
177
  }
172
178
 
179
+ // render audio_player for tvos
173
180
  if (isAudioContent) {
174
181
  return (
175
182
  <AudioPlayer
@@ -183,6 +190,8 @@ const renderApplePlayer = ({
183
190
  return null;
184
191
  }
185
192
 
193
+ const { title, summary } = item || {};
194
+
186
195
  return (
187
196
  <ProgramInfo
188
197
  title={title}
@@ -193,21 +202,6 @@ const renderApplePlayer = ({
193
202
  );
194
203
  };
195
204
 
196
- const renderRestPlayers = ({ item, showAudioPlayer, pluginConfiguration }) => {
197
- if (isApplePlatform()) {
198
- return null;
199
- }
200
-
201
- return (
202
- showAudioPlayer && (
203
- <AudioPlayer
204
- audio_item={item}
205
- plugin_configuration={pluginConfiguration}
206
- />
207
- )
208
- );
209
- };
210
-
211
205
  const PlayerContainerComponent = (props: Props) => {
212
206
  const {
213
207
  Player,
@@ -337,7 +331,7 @@ const PlayerContainerComponent = (props: Props) => {
337
331
 
338
332
  setState({ error: errorObj });
339
333
 
340
- if (!isAppleTV()) {
334
+ if (!isTvOS) {
341
335
  setTimeout(() => {
342
336
  close();
343
337
  }, 800);
@@ -568,10 +562,7 @@ const PlayerContainerComponent = (props: Props) => {
568
562
 
569
563
  const uri = item?.content ? item.content?.src : null;
570
564
 
571
- const isInlineTV =
572
- screenData?.ui_components &&
573
- screenData?.ui_components?.length > 0 &&
574
- isTV();
565
+ const isInlineTV = isInlineTVUtil(screenData);
575
566
 
576
567
  const inline =
577
568
  [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
@@ -626,12 +617,6 @@ const PlayerContainerComponent = (props: Props) => {
626
617
  playNextData,
627
618
  };
628
619
 
629
- const restPlayerProps = {
630
- item,
631
- showAudioPlayer: isAudioContent,
632
- pluginConfiguration,
633
- };
634
-
635
620
  return (
636
621
  <PlayerStateContext.Provider value={value}>
637
622
  <PlayerContainerContextProvider
@@ -707,8 +692,6 @@ const PlayerContainerComponent = (props: Props) => {
707
692
  </Player>
708
693
  </PlayerFocusableWrapperView>
709
694
 
710
- {renderRestPlayers(restPlayerProps)}
711
-
712
695
  {state.error ? <ErrorDisplay error={state.error} /> : null}
713
696
  </View>
714
697
  {/* Components container */}
@@ -732,7 +715,7 @@ const PlayerContainerComponent = (props: Props) => {
732
715
  screenId={screenData.id}
733
716
  key={item.id}
734
717
  groupId={FocusableGroupMainContainerId}
735
- cellTapAction={(event) => onCellTap(event)}
718
+ cellTapAction={onCellTap}
736
719
  extraAnchorPointYOffset={-600}
737
720
  isScreenWrappedInContainer={true}
738
721
  containerHeight={styles.inlineRiver.height}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "14.0.0-rc.2",
3
+ "version": "14.0.0-rc.3",
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-rc.2",
35
- "@applicaster/zapp-react-native-bridge": "14.0.0-rc.2",
36
- "@applicaster/zapp-react-native-redux": "14.0.0-rc.2",
37
- "@applicaster/zapp-react-native-utils": "14.0.0-rc.2",
34
+ "@applicaster/applicaster-types": "14.0.0-rc.3",
35
+ "@applicaster/zapp-react-native-bridge": "14.0.0-rc.3",
36
+ "@applicaster/zapp-react-native-redux": "14.0.0-rc.3",
37
+ "@applicaster/zapp-react-native-utils": "14.0.0-rc.3",
38
38
  "promise": "^8.3.0",
39
39
  "url": "^0.11.0",
40
40
  "uuid": "^3.3.2"