@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1711912250 → 13.0.0-alpha.1731130113

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.
@@ -32,7 +32,7 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
32
32
 
33
33
  const { isRTL, backgroundColor, backgroundImage } = config;
34
34
 
35
- const backgroundImg = { uri: backgroundImage };
35
+ const backgroundImageSource = { uri: backgroundImage };
36
36
 
37
37
  const backgroundColorStyle = backgroundImage
38
38
  ? "transparent"
@@ -97,15 +97,14 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
97
97
 
98
98
  const backgroundImgStyles = platformSelect({
99
99
  tvos: {
100
- width: 1920,
101
- height: 1080,
100
+ width: "100%",
101
+ height: "100%",
102
102
  alignItems: "center",
103
103
  justifyContent: "center",
104
104
  },
105
105
  android_tv: {
106
- position: "absolute",
107
- width: 1920,
108
- height: 1080,
106
+ width: "100%",
107
+ height: "100%",
109
108
  alignItems: "center",
110
109
  justifyContent: "center",
111
110
  },
@@ -146,9 +145,9 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
146
145
  },
147
146
  });
148
147
 
149
- const audioPlayerLayoutTV = backgroundImg?.uri ? (
148
+ const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
150
149
  <ImageBackground
151
- source={backgroundImg}
150
+ source={backgroundImageSource}
152
151
  style={backgroundImgStyles}
153
152
  resizeMode="cover"
154
153
  >
@@ -178,7 +177,7 @@ export function AudioPlayerLayout({ artwork, config, children, style }: Props) {
178
177
  ]}
179
178
  >
180
179
  <ImageBackground
181
- source={backgroundImg}
180
+ source={backgroundImageSource}
182
181
  style={backgroundImgStyles}
183
182
  resizeMode="cover"
184
183
  >
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useMemo, useRef } from "react";
2
- import { View, ScrollView, Platform } from "react-native";
2
+ import { View, ScrollView } from "react-native";
3
3
  import { Button } from "./Button";
4
4
  import { ItemIconProps } from "./Button/ItemIcon";
5
5
  import { ItemProps } from "./Button/Item";
@@ -9,7 +9,7 @@ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
9
9
 
10
10
  import type { PluginConfiguration } from "./";
11
11
 
12
- import { ModalHeader } from "./Header";
12
+ import { ModalHeader as DefaultModalHeader } from "./Header";
13
13
  import { useSafeAreaInsets } from "react-native-safe-area-context";
14
14
 
15
15
  type ModalComponentProps = {
@@ -22,6 +22,7 @@ type ModalComponentProps = {
22
22
  title?: string;
23
23
  maxHeight?: number;
24
24
  dismiss: () => void;
25
+ headerComponent?: React.ComponentType;
25
26
  buttonComponent?: React.ComponentType;
26
27
  iconProps?: ItemIconProps | ((theme: PluginConfiguration) => ItemIconProps);
27
28
  itemProps?:
@@ -48,9 +49,11 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
48
49
  dismiss,
49
50
  summary,
50
51
  title,
52
+ headerComponent: ModalHeader = DefaultModalHeader,
51
53
  buttonComponent: ButtonComponent = Button,
52
- getSelectedItemIcon = (theme) =>
53
- theme.modal_bottom_sheet_item_selected_icon,
54
+ getSelectedItemIcon = ({
55
+ modal_bottom_sheet_item_selected_icon,
56
+ }: BaseThemePropertiesMobile) => modal_bottom_sheet_item_selected_icon,
54
57
  getDefaultItemIcon = () => null,
55
58
  iconPlacement,
56
59
  } = props;
@@ -103,26 +106,27 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
103
106
  />
104
107
  <ScrollView
105
108
  contentContainerStyle={{
106
- paddingBottom:
107
- paddingBottom + (Platform.OS === "ios" ? bottomInset : 0),
109
+ paddingBottom: paddingBottom + bottomInset,
108
110
  }}
109
111
  >
110
- {items.map((item, index) => (
111
- <ButtonComponent
112
- key={index}
113
- configuration={theme}
114
- selectedItem={current_selection}
115
- item={item}
116
- onPress={handlePress}
117
- label={theme[item?.label] ?? item?.label}
118
- iconBaseProps={iconBaseProps}
119
- itemBaseProps={itemBaseProps}
120
- labelBaseProps={labelBaseProps}
121
- selectedItemIcon={getSelectedItemIcon(theme)}
122
- defaultItemIcon={getDefaultItemIcon(theme)}
123
- iconPlacement={iconPlacement}
124
- />
125
- ))}
112
+ {items.map((item, index) =>
113
+ item ? (
114
+ <ButtonComponent
115
+ key={index}
116
+ configuration={theme}
117
+ selectedItem={current_selection}
118
+ item={item}
119
+ onPress={handlePress}
120
+ label={theme[item?.label] ?? item?.label}
121
+ iconBaseProps={iconBaseProps}
122
+ itemBaseProps={itemBaseProps}
123
+ labelBaseProps={labelBaseProps}
124
+ selectedItemIcon={getSelectedItemIcon(theme)}
125
+ defaultItemIcon={getDefaultItemIcon(theme)}
126
+ iconPlacement={iconPlacement}
127
+ />
128
+ ) : null
129
+ )}
126
130
  </ScrollView>
127
131
  </View>
128
132
  );
@@ -6,11 +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 {
15
+ isAudioItem,
16
+ isInlineTV as isInlineTVUtil,
17
+ } from "@applicaster/zapp-react-native-utils/playerUtils";
14
18
 
15
19
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
16
20
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
@@ -21,7 +25,7 @@ import {
21
25
  } from "@applicaster/zapp-react-native-utils/reactHooks";
22
26
 
23
27
  import { PlayerStateContext } from "../../Contexts/PlayerStateContext";
24
- import { isAppleTV } from "../../Helpers/Platform";
28
+
25
29
  import {
26
30
  QUICK_BRICK_EVENTS,
27
31
  QuickBrickEvent,
@@ -96,6 +100,11 @@ const focusableBottomContainerId = "player-container-bottom";
96
100
 
97
101
  const isAndroidTV = isAndroidTVPlatform();
98
102
 
103
+ const isTvOS = isTvOSPlatform();
104
+
105
+ // height for container with additional content below player
106
+ const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
107
+
99
108
  const withBorderHack = () => {
100
109
  if (isAndroidTV) {
101
110
  /* @HACK: see GH#7269 */
@@ -125,7 +134,7 @@ const webStyles = {
125
134
  flex: "initial",
126
135
  },
127
136
  inlineRiver: {
128
- height: 400,
137
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
129
138
  },
130
139
  };
131
140
 
@@ -143,7 +152,7 @@ const nativeStyles = {
143
152
  flex: 1,
144
153
  },
145
154
  inlineRiver: {
146
- height: 400,
155
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
147
156
  },
148
157
  };
149
158
 
@@ -163,12 +172,11 @@ const renderApplePlayer = ({
163
172
  videoStyle,
164
173
  playNextData,
165
174
  }) => {
166
- const { title, summary } = item || {};
167
-
168
- if (!isAppleTV() || !player) {
175
+ if (!isTvOS || !player) {
169
176
  return null;
170
177
  }
171
178
 
179
+ // render audio_player for tvos
172
180
  if (isAudioContent) {
173
181
  return (
174
182
  <AudioPlayer
@@ -182,6 +190,8 @@ const renderApplePlayer = ({
182
190
  return null;
183
191
  }
184
192
 
193
+ const { title, summary } = item || {};
194
+
185
195
  return (
186
196
  <ProgramInfo
187
197
  title={title}
@@ -192,21 +202,6 @@ const renderApplePlayer = ({
192
202
  );
193
203
  };
194
204
 
195
- const renderRestPlayers = ({ item, showAudioPlayer, pluginConfiguration }) => {
196
- if (isApplePlatform()) {
197
- return null;
198
- }
199
-
200
- return (
201
- showAudioPlayer && (
202
- <AudioPlayer
203
- audio_item={item}
204
- plugin_configuration={pluginConfiguration}
205
- />
206
- )
207
- );
208
- };
209
-
210
205
  const PlayerContainerComponent = (props: Props) => {
211
206
  const {
212
207
  Player,
@@ -336,7 +331,7 @@ const PlayerContainerComponent = (props: Props) => {
336
331
 
337
332
  setState({ error: errorObj });
338
333
 
339
- if (!isAppleTV()) {
334
+ if (!isTvOS) {
340
335
  setTimeout(() => {
341
336
  close();
342
337
  }, 800);
@@ -493,9 +488,7 @@ const PlayerContainerComponent = (props: Props) => {
493
488
  // TODO: Skip hook call on TV platform
494
489
  useBackHandler(backHandler);
495
490
 
496
- const isAudioContent =
497
- typeof item?.content?.type === "string" &&
498
- item?.content?.type.includes("audio");
491
+ const isAudioContent = isAudioItem(item);
499
492
 
500
493
  useEffect(() => {
501
494
  if (!isAudioContent) {
@@ -569,10 +562,7 @@ const PlayerContainerComponent = (props: Props) => {
569
562
 
570
563
  const uri = item?.content ? item.content?.src : null;
571
564
 
572
- const isInlineTV =
573
- screenData?.ui_components &&
574
- screenData?.ui_components?.length > 0 &&
575
- isTV();
565
+ const isInlineTV = isInlineTVUtil(screenData);
576
566
 
577
567
  const inline =
578
568
  [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
@@ -627,12 +617,6 @@ const PlayerContainerComponent = (props: Props) => {
627
617
  playNextData,
628
618
  };
629
619
 
630
- const restPlayerProps = {
631
- item,
632
- showAudioPlayer: isAudioContent,
633
- pluginConfiguration,
634
- };
635
-
636
620
  return (
637
621
  <PlayerStateContext.Provider value={value}>
638
622
  <PlayerContainerContextProvider
@@ -708,8 +692,6 @@ const PlayerContainerComponent = (props: Props) => {
708
692
  </Player>
709
693
  </PlayerFocusableWrapperView>
710
694
 
711
- {renderRestPlayers(restPlayerProps)}
712
-
713
695
  {state.error ? <ErrorDisplay error={state.error} /> : null}
714
696
  </View>
715
697
  {/* Components container */}
@@ -733,7 +715,7 @@ const PlayerContainerComponent = (props: Props) => {
733
715
  screenId={screenData.id}
734
716
  key={item.id}
735
717
  groupId={FocusableGroupMainContainerId}
736
- cellTapAction={(event) => onCellTap(event)}
718
+ cellTapAction={onCellTap}
737
719
  extraAnchorPointYOffset={-600}
738
720
  isScreenWrappedInContainer={true}
739
721
  containerHeight={styles.inlineRiver.height}
@@ -12,11 +12,7 @@ const styles = StyleSheet.create({
12
12
 
13
13
  export function TestId({ screenId, children }: Props) {
14
14
  return (
15
- <View
16
- testID={screenId}
17
- accessibilityLabel={screenId}
18
- style={styles.container}
19
- >
15
+ <View testID={screenId} style={styles.container}>
20
16
  {children}
21
17
  </View>
22
18
  );
@@ -2,7 +2,6 @@
2
2
 
3
3
  exports[`<RouteManager /> renders correctly 1`] = `
4
4
  <View
5
- accessibilityLabel="A1234"
6
5
  style={
7
6
  {
8
7
  "flex": 1,
@@ -24,9 +24,5 @@ describe("TestId", () => {
24
24
  );
25
25
 
26
26
  expect(wrapper.getByTestId(screenId)).toBeTruthy();
27
-
28
- expect(wrapper.getByTestId(screenId).props.accessibilityLabel).toEqual(
29
- screenId
30
- );
31
27
  });
32
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.1711912250",
3
+ "version": "13.0.0-alpha.1731130113",
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": "13.0.0-alpha.1711912250",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1711912250",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1711912250",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1711912250",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.1731130113",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1731130113",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1731130113",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1731130113",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",