@applicaster/zapp-react-native-ui-components 14.0.0-alpha.1661204539 → 14.0.0-alpha.2247415563

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 (64) hide show
  1. package/Components/AnimatedInOut/index.tsx +5 -3
  2. package/Components/AudioPlayer/index.tsx +15 -0
  3. package/Components/AudioPlayer/mobile/Layout.tsx +66 -0
  4. package/Components/AudioPlayer/{__tests__/__snapshots__/audioPlayer.test.js.snap → mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap} +2 -2
  5. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +18 -0
  6. package/Components/AudioPlayer/mobile/index.tsx +18 -0
  7. package/Components/AudioPlayer/tv/Artwork.tsx +40 -0
  8. package/Components/AudioPlayer/{AudioPlayerLayout.tsx → tv/Layout.tsx} +34 -75
  9. package/Components/AudioPlayer/{Runtime.tsx → tv/Runtime.tsx} +2 -1
  10. package/Components/AudioPlayer/{Summary.tsx → tv/Summary.tsx} +12 -9
  11. package/Components/AudioPlayer/{Title.tsx → tv/Title.tsx} +12 -9
  12. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/artWork.test.js.snap +9 -4
  13. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +170 -0
  14. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/summary.test.js.snap +1 -1
  15. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/title.test.js.snap +1 -1
  16. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/audioPlayer.test.js +7 -3
  17. package/Components/AudioPlayer/{helpers.tsx → tv/helpers.tsx} +3 -4
  18. package/Components/AudioPlayer/{AudioPlayer.tsx → tv/index.tsx} +14 -59
  19. package/Components/AudioPlayer/types.ts +40 -0
  20. package/Components/Focusable/FocusableTvOS.tsx +3 -3
  21. package/Components/FocusableList/index.tsx +4 -0
  22. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +0 -2
  23. package/Components/HandlePlayable/HandlePlayable.tsx +14 -8
  24. package/Components/MasterCell/DefaultComponents/Text/index.tsx +1 -0
  25. package/Components/MasterCell/elementMapper.tsx +1 -2
  26. package/Components/MasterCell/utils/behaviorProvider.ts +12 -67
  27. package/Components/MasterCell/utils/index.ts +3 -13
  28. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
  29. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
  30. package/Components/PlayerContainer/PlayerContainer.tsx +48 -61
  31. package/Components/PlayerImageBackground/index.tsx +1 -1
  32. package/Components/River/ComponentsMap/ComponentsMap.tsx +1 -6
  33. package/Components/River/RiverItem.tsx +8 -8
  34. package/Components/River/TV/River.tsx +0 -3
  35. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  36. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -6
  37. package/Components/Tabs/TV/Tabs.android.tsx +0 -2
  38. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +16 -15
  39. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
  40. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
  41. package/Components/VideoLive/animationUtils.ts +3 -3
  42. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +60 -0
  43. package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +17 -55
  44. package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +15 -26
  45. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
  46. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
  47. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  48. package/Decorators/RiverFeedLoader/index.tsx +2 -8
  49. package/Decorators/RiverFeedLoader/utils/index.ts +2 -7
  50. package/Decorators/ZappPipesDataConnector/index.tsx +2 -16
  51. package/index.d.ts +0 -1
  52. package/package.json +5 -6
  53. package/Components/AudioPlayer/Artwork.tsx +0 -35
  54. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +0 -66
  55. package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +0 -26
  56. package/Components/AudioPlayer/index.ts +0 -1
  57. package/Components/AudioPlayer/{Channel.tsx → tv/Channel.tsx} +0 -0
  58. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/Runtime.test.js +0 -0
  59. package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/Runtime.test.js.snap +2 -2
  60. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/__snapshots__/channel.test.js.snap +0 -0
  61. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/artWork.test.js +0 -0
  62. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/channel.test.js +0 -0
  63. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/summary.test.js +0 -0
  64. /package/Components/AudioPlayer/{__tests__ → tv/__tests__}/title.test.js +0 -0
@@ -1,17 +1,19 @@
1
1
  import * as React from "react";
2
2
  import { useEffect, useReducer } from "react";
3
- // @ts-ignore
4
- import { TVMenuControl, View, ViewStyle } from "react-native";
3
+ import { View, ViewStyle } from "react-native";
5
4
  import * as R from "ramda";
6
5
  import uuid from "uuid/v4";
7
6
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils/playerManager";
8
7
  import {
9
- isApplePlatform,
10
8
  isTV,
11
9
  platformSelect,
12
10
  isAndroidTVPlatform,
11
+ isTvOSPlatform,
13
12
  } from "@applicaster/zapp-react-native-utils/reactUtils";
14
- import { isAudioItem } from "@applicaster/zapp-react-native-utils/playerUtils";
13
+ import {
14
+ isAudioItem,
15
+ isInlineTV as isInlineTVUtil,
16
+ } from "@applicaster/zapp-react-native-utils/playerUtils";
15
17
 
16
18
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
17
19
  import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
@@ -22,7 +24,7 @@ import {
22
24
  } from "@applicaster/zapp-react-native-utils/reactHooks";
23
25
 
24
26
  import { PlayerStateContext } from "../../Contexts/PlayerStateContext";
25
- import { isAppleTV } from "../../Helpers/Platform";
27
+
26
28
  import {
27
29
  QUICK_BRICK_EVENTS,
28
30
  QuickBrickEvent,
@@ -59,6 +61,11 @@ import {
59
61
  useModalAnimationContext,
60
62
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
61
63
 
64
+ import {
65
+ PlayerNativeCommandTypes,
66
+ PlayerNativeSendCommand,
67
+ } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/playerNativeCommand";
68
+
62
69
  type Props = {
63
70
  Player: React.ComponentType<any>;
64
71
  PlayerLoadingView?: React.ComponentType<any>; // 👀 we are not receiving this prop
@@ -97,6 +104,11 @@ const focusableBottomContainerId = "player-container-bottom";
97
104
 
98
105
  const isAndroidTV = isAndroidTVPlatform();
99
106
 
107
+ const isTvOS = isTvOSPlatform();
108
+
109
+ // height for container with additional content below player
110
+ const INLINE_CONTAINER_CONTENT_HEIGHT = 400;
111
+
100
112
  const withBorderHack = () => {
101
113
  if (isAndroidTV) {
102
114
  /* @HACK: see GH#7269 */
@@ -126,7 +138,7 @@ const webStyles = {
126
138
  flex: "initial",
127
139
  },
128
140
  inlineRiver: {
129
- height: 400,
141
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
130
142
  },
131
143
  };
132
144
 
@@ -144,7 +156,7 @@ const nativeStyles = {
144
156
  flex: 1,
145
157
  },
146
158
  inlineRiver: {
147
- height: 400,
159
+ height: INLINE_CONTAINER_CONTENT_HEIGHT,
148
160
  },
149
161
  };
150
162
 
@@ -164,12 +176,11 @@ const renderApplePlayer = ({
164
176
  videoStyle,
165
177
  playNextData,
166
178
  }) => {
167
- const { title, summary } = item || {};
168
-
169
- if (!isAppleTV() || !player) {
179
+ if (!isTvOS || !player) {
170
180
  return null;
171
181
  }
172
182
 
183
+ // render audio_player for tvos
173
184
  if (isAudioContent) {
174
185
  return (
175
186
  <AudioPlayer
@@ -183,6 +194,8 @@ const renderApplePlayer = ({
183
194
  return null;
184
195
  }
185
196
 
197
+ const { title, summary } = item || {};
198
+
186
199
  return (
187
200
  <ProgramInfo
188
201
  title={title}
@@ -193,21 +206,6 @@ const renderApplePlayer = ({
193
206
  );
194
207
  };
195
208
 
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
209
  const PlayerContainerComponent = (props: Props) => {
212
210
  const {
213
211
  Player,
@@ -266,9 +264,15 @@ const PlayerContainerComponent = (props: Props) => {
266
264
  return;
267
265
  }
268
266
 
267
+ // send command to clear and stop player
268
+ PlayerNativeSendCommand(
269
+ PlayerNativeCommandTypes.clearPlayerData,
270
+ state.playerId
271
+ );
272
+
269
273
  showNavBar(true);
270
274
  navigator.goBack();
271
- }, [isModal, navigator.goBack, showNavBar]);
275
+ }, [isModal, navigator.goBack, state.playerId, showNavBar]);
272
276
 
273
277
  const playEntry = (entry) => navigator.replaceTop(entry, { mode });
274
278
 
@@ -337,7 +341,7 @@ const PlayerContainerComponent = (props: Props) => {
337
341
 
338
342
  setState({ error: errorObj });
339
343
 
340
- if (!isAppleTV()) {
344
+ if (!isTvOS) {
341
345
  setTimeout(() => {
342
346
  close();
343
347
  }, 800);
@@ -396,13 +400,17 @@ const PlayerContainerComponent = (props: Props) => {
396
400
  }
397
401
  };
398
402
 
399
- const playerRemoteHandler = (event, isLanguageOverlayVisible) => {
400
- const { eventType } = event;
403
+ const playerRemoteHandler = React.useCallback(
404
+ (isLanguageOverlayVisible = false) =>
405
+ (event) => {
406
+ const { eventType } = event;
401
407
 
402
- if (!isLanguageOverlayVisible && eventType === "menu") {
403
- close();
404
- }
405
- };
408
+ if (!isLanguageOverlayVisible && eventType === "menu") {
409
+ close();
410
+ }
411
+ },
412
+ [close]
413
+ );
406
414
 
407
415
  // Effects
408
416
  useEffect(() => {
@@ -515,16 +523,6 @@ const PlayerContainerComponent = (props: Props) => {
515
523
  }
516
524
  }, [isAudioContent]);
517
525
 
518
- // Needs to handle back button on Apple TV
519
- // https://github.com/facebook/react-native/issues/18930
520
- useEffect(() => {
521
- TVMenuControl?.enableTVMenuKey();
522
-
523
- return () => {
524
- TVMenuControl?.disableTVMenuKey();
525
- };
526
- }, []);
527
-
528
526
  useEffect(() => {
529
527
  playerEvent("source_changed", { item });
530
528
 
@@ -568,10 +566,7 @@ const PlayerContainerComponent = (props: Props) => {
568
566
 
569
567
  const uri = item?.content ? item.content?.src : null;
570
568
 
571
- const isInlineTV =
572
- screenData?.ui_components &&
573
- screenData?.ui_components?.length > 0 &&
574
- isTV();
569
+ const isInlineTV = isInlineTVUtil(screenData);
575
570
 
576
571
  const inline =
577
572
  [VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(mode) ||
@@ -626,12 +621,6 @@ const PlayerContainerComponent = (props: Props) => {
626
621
  playNextData,
627
622
  };
628
623
 
629
- const restPlayerProps = {
630
- item,
631
- showAudioPlayer: isAudioContent,
632
- pluginConfiguration,
633
- };
634
-
635
624
  return (
636
625
  <PlayerStateContext.Provider value={value}>
637
626
  <PlayerContainerContextProvider
@@ -642,9 +631,9 @@ const PlayerContainerComponent = (props: Props) => {
642
631
  <PlayerContainerContext.Consumer>
643
632
  {(context) => (
644
633
  <TVEventHandlerComponent
645
- tvEventHandler={(_component, event) =>
646
- playerRemoteHandler(event, context.isLanguageOverlayVisible)
647
- }
634
+ tvEventHandler={playerRemoteHandler(
635
+ context.isLanguageOverlayVisible
636
+ )}
648
637
  >
649
638
  <FocusableGroup
650
639
  id={FocusableGroupMainContainerId}
@@ -707,8 +696,6 @@ const PlayerContainerComponent = (props: Props) => {
707
696
  </Player>
708
697
  </PlayerFocusableWrapperView>
709
698
 
710
- {renderRestPlayers(restPlayerProps)}
711
-
712
699
  {state.error ? <ErrorDisplay error={state.error} /> : null}
713
700
  </View>
714
701
  {/* Components container */}
@@ -732,12 +719,12 @@ const PlayerContainerComponent = (props: Props) => {
732
719
  screenId={screenData.id}
733
720
  key={item.id}
734
721
  groupId={FocusableGroupMainContainerId}
735
- cellTapAction={(event) => onCellTap(event)}
736
- extraAnchorPointYOffset={-600}
722
+ cellTapAction={onCellTap}
723
+ extraAnchorPointYOffset={0}
737
724
  isScreenWrappedInContainer={true}
738
725
  containerHeight={styles.inlineRiver.height}
739
726
  componentsMapExtraProps={{
740
- isNestedComponentsMap: R.T,
727
+ isNestedComponentsMap: true,
741
728
  }}
742
729
  />
743
730
  )}
@@ -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
 
@@ -281,12 +281,11 @@ function ComponentsMapComponent(props: Props) {
281
281
  scrollIndicatorInsets={scrollIndicatorInsets}
282
282
  extraData={feed}
283
283
  stickyHeaderIndices={stickyHeaderIndices}
284
- onLayout={handleOnLayout}
285
284
  removeClippedSubviews={isAndroid}
285
+ onLayout={handleOnLayout}
286
286
  initialNumToRender={3}
287
287
  maxToRenderPerBatch={10}
288
288
  windowSize={12}
289
- listKey={riverId}
290
289
  keyExtractor={keyExtractor}
291
290
  renderItem={renderRiverItem}
292
291
  data={riverComponents}
@@ -303,10 +302,6 @@ function ComponentsMapComponent(props: Props) {
303
302
  onMomentumScrollEnd={_onMomentumScrollEnd}
304
303
  onScrollEndDrag={_onScrollEndDrag}
305
304
  scrollEventThrottle={16}
306
- maintainVisibleContentPosition={{
307
- minIndexForVisible: 0,
308
- autoscrollToTopThreshold: 10,
309
- }}
310
305
  {...scrollViewExtraProps}
311
306
  />
312
307
  </ViewportTracker>
@@ -39,6 +39,10 @@ function getFeedUrl(feed: ZappFeed, index: number) {
39
39
  }
40
40
  }
41
41
 
42
+ const isNextIndex = (index, readyIndex) => {
43
+ return readyIndex + 1 >= index;
44
+ };
45
+
42
46
  /**
43
47
  * useLoadingState for RiverItemComponent
44
48
  * takes currentIndex and loadingState as arguments
@@ -48,24 +52,20 @@ const useLoadingState = (
48
52
  loadingState: RiverItemType["loadingState"]
49
53
  ) => {
50
54
  const [readyToBeDisplayed, setReadyToBeDisplayed] = React.useState(
51
- loadingState.getValue().index + 1 >= currentIndex
55
+ isNextIndex(currentIndex, loadingState.getValue().index)
52
56
  );
53
57
 
54
58
  useEffect(() => {
55
59
  const subscription = loadingState.subscribe(({ index }) => {
56
- if (index + 1 >= currentIndex) {
60
+ if (isNextIndex(currentIndex, index)) {
57
61
  setReadyToBeDisplayed(true);
58
62
  }
59
63
  });
60
64
 
61
- if (loadingState.getValue().index + 1 >= currentIndex) {
62
- setReadyToBeDisplayed(true);
63
- }
64
-
65
65
  return () => {
66
66
  subscription.unsubscribe();
67
67
  };
68
- }, [loadingState, currentIndex]);
68
+ }, [currentIndex]);
69
69
 
70
70
  return readyToBeDisplayed;
71
71
  };
@@ -151,7 +151,7 @@ function RiverItemComponent(props: RiverItemType) {
151
151
  component={item}
152
152
  componentIndex={index}
153
153
  onLoadFailed={onLoadFailed}
154
- onLoadFinished={() => onLoadFinished(index)} // Keeping it here to don't break the plugins.
154
+ onLoadFinished={() => onLoadFinished(index)}
155
155
  groupId={groupId}
156
156
  feedUrl={feedUrl}
157
157
  isLast={isLast}
@@ -26,7 +26,6 @@ type Props = {
26
26
  componentsMapExtraProps?: any;
27
27
  isInsideContainer?: boolean;
28
28
  extraAnchorPointYOffset: number;
29
- extraOffset: number;
30
29
  river?: ZappRiver | ZappEntry;
31
30
  };
32
31
 
@@ -39,7 +38,6 @@ export const River = (props: Props) => {
39
38
  componentsMapExtraProps,
40
39
  isInsideContainer,
41
40
  extraAnchorPointYOffset,
42
- extraOffset,
43
41
  } = props;
44
42
 
45
43
  const { title: screenTitle, summary: screenSummary } = useNavbarState();
@@ -120,7 +118,6 @@ export const River = (props: Props) => {
120
118
  <GeneralContentScreen
121
119
  feed={feedData}
122
120
  screenId={screenId}
123
- extraOffset={extraOffset}
124
121
  isScreenWrappedInContainer={isInsideContainer}
125
122
  extraAnchorPointYOffset={extraAnchorPointYOffset}
126
123
  componentsMapExtraProps={componentsMapExtraProps}
@@ -8,7 +8,7 @@ export const withTvEventHandler = (Component) => {
8
8
  return function WithTVEventHandler(props) {
9
9
  const navigator = useNavigation();
10
10
 
11
- const remoteHandler = (_, event) => {
11
+ const remoteHandler = (event) => {
12
12
  const { eventType } = event;
13
13
 
14
14
  const canGoBack = navigator.canGoBack();
@@ -135,12 +135,6 @@ exports[`componentsMap renders renders components map correctly 1`] = `
135
135
  getItemCount={[Function]}
136
136
  initialNumToRender={3}
137
137
  keyExtractor={[Function]}
138
- maintainVisibleContentPosition={
139
- {
140
- "autoscrollToTopThreshold": 10,
141
- "minIndexForVisible": 0,
142
- }
143
- }
144
138
  maxToRenderPerBatch={10}
145
139
  onContentSizeChange={[Function]}
146
140
  onLayout={[Function]}
@@ -165,6 +159,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
165
159
  >
166
160
  <View>
167
161
  <View
162
+ onFocusCapture={[Function]}
168
163
  onLayout={[Function]}
169
164
  style={null}
170
165
  >
@@ -180,6 +175,7 @@ exports[`componentsMap renders renders components map correctly 1`] = `
180
175
  </View>
181
176
  </View>
182
177
  <View
178
+ onFocusCapture={[Function]}
183
179
  onLayout={[Function]}
184
180
  style={null}
185
181
  >
@@ -7,7 +7,6 @@ import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
7
7
 
8
8
  import Tab from "./Tab";
9
9
  import { Gutter } from "../Gutter";
10
- import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
11
10
  import { ImageBackground, View } from "react-native";
12
11
  import { getStyles } from "./styles";
13
12
  import {
@@ -100,7 +99,6 @@ const TabsComponent = ({
100
99
  >
101
100
  <FocusableList
102
101
  horizontal
103
- onScrollToIndexFailed={noop}
104
102
  onLayout={onLayoutChange}
105
103
  contentContainerStyle={tabsListContentContainer}
106
104
  ref={flatListRef}
@@ -1,17 +1,17 @@
1
1
  import React from "react";
2
- import { View, ViewProps, ViewStyle } from "react-native";
2
+ import { View, ViewStyle } from "react-native";
3
3
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
4
4
  import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
6
+ import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
6
7
 
7
8
  interface IProps {
8
9
  targetScreenId?: string;
9
10
  children?: React.ReactNode;
10
11
  style?: ViewStyle;
11
- extraOffset?: number;
12
+ extraVerticalOffset: Option<number>;
12
13
  }
13
14
 
14
- type CombinedProps = IProps & ViewProps;
15
15
  /**
16
16
  * The MarginTop is essentially a feature used for managing the visibility of components on your screen.
17
17
  * A more accurate term for this might be something like a 'component visibility threshold' or 'cut-off point'.
@@ -47,7 +47,7 @@ export const useMarginTop = (targetScreenId: string): number => {
47
47
 
48
48
  // Empty string means that value is blank in the CMS. Fallback to theme
49
49
  if (String(screenData?.styles?.screen_margin_top) === "") {
50
- return Number(theme.screen_margin_top);
50
+ return toNumberWithDefault(0, theme.screen_margin_top);
51
51
  }
52
52
 
53
53
  /**
@@ -58,28 +58,29 @@ export const useMarginTop = (targetScreenId: string): number => {
58
58
  */
59
59
  if (screenData?.styles?.screen_margin_top === undefined) {
60
60
  if (isGeneralContentScreen || supportsUiComponents) {
61
- return Number(theme.screen_margin_top);
61
+ return toNumberWithDefault(0, theme.screen_margin_top);
62
62
  }
63
63
 
64
64
  return 0;
65
65
  }
66
66
 
67
- return Number(screenData?.styles?.screen_margin_top);
67
+ return toNumberWithDefault(0, screenData?.styles?.screen_margin_top);
68
68
  };
69
69
 
70
- export const TopMarginApplicator: React.FC<CombinedProps> = (
71
- props: CombinedProps
72
- ) => {
73
- const extraOffset = props?.extraOffset ?? 0;
70
+ export const TopMarginApplicator: React.FC<IProps> = ({
71
+ targetScreenId,
72
+ style,
73
+ children,
74
+ extraVerticalOffset,
75
+ }: IProps) => {
76
+ const extraOffset = toNumberWithDefault(0, extraVerticalOffset);
74
77
 
75
78
  // HACK: Remove extraOffset when focusIssue with absolute elements is fixed on tvos
76
- const marginTop = useMarginTop(props.targetScreenId) + extraOffset;
77
- const style = { ...((props.style as {}) || {}), marginTop };
79
+ const marginTop = useMarginTop(targetScreenId);
78
80
 
79
- // Then, spread the rest of the props on your returned JSX.
80
81
  return (
81
- <View {...props} style={style}>
82
- {props.children}
82
+ <View style={[style, { marginTop: marginTop + extraOffset }]}>
83
+ {children}
83
84
  </View>
84
85
  );
85
86
  };
@@ -3,6 +3,23 @@
3
3
  exports[`<Touchable /> when not running in automated tests environment renders correctly 1`] = `
4
4
  <View
5
5
  accessibilityLabel="some-test-id"
6
+ accessibilityState={
7
+ {
8
+ "busy": undefined,
9
+ "checked": undefined,
10
+ "disabled": undefined,
11
+ "expanded": undefined,
12
+ "selected": undefined,
13
+ }
14
+ }
15
+ accessibilityValue={
16
+ {
17
+ "max": undefined,
18
+ "min": undefined,
19
+ "now": undefined,
20
+ "text": undefined,
21
+ }
22
+ }
6
23
  accessible={true}
7
24
  collapsable={false}
8
25
  focusable={true}
@@ -29,6 +46,23 @@ exports[`<Touchable /> when not running in automated tests environment renders c
29
46
  exports[`<Touchable /> when running in automated tests environment has accessible flag set to false 1`] = `
30
47
  <View
31
48
  accessibilityLabel="some-test-id"
49
+ accessibilityState={
50
+ {
51
+ "busy": undefined,
52
+ "checked": undefined,
53
+ "disabled": undefined,
54
+ "expanded": undefined,
55
+ "selected": undefined,
56
+ }
57
+ }
58
+ accessibilityValue={
59
+ {
60
+ "max": undefined,
61
+ "min": undefined,
62
+ "now": undefined,
63
+ "text": undefined,
64
+ }
65
+ }
32
66
  accessible={false}
33
67
  collapsable={false}
34
68
  focusable={true}
@@ -6,15 +6,21 @@ exports[`<Scene /> renders correctly 1`] = `
6
6
  collapsable={false}
7
7
  pointerEvents="auto"
8
8
  style={
9
- {
10
- "flex": 1,
11
- "fontScale": 2,
12
- "height": 1334,
13
- "paddingBottom": 49,
14
- "scale": 2,
15
- "statusBarHeight": null,
16
- "width": 750,
17
- }
9
+ [
10
+ {
11
+ "flex": 1,
12
+ },
13
+ {
14
+ "paddingBottom": 49,
15
+ },
16
+ {
17
+ "fontScale": 2,
18
+ "height": 1334,
19
+ "scale": 2,
20
+ "statusBarHeight": null,
21
+ "width": 750,
22
+ },
23
+ ]
18
24
  }
19
25
  />
20
26
  </View>
@@ -1,8 +1,8 @@
1
1
  import { Animated, Easing, EasingFunction, StyleProp } from "react-native";
2
2
 
3
3
  type AnimatedInterpolatedStyle =
4
- | Animated.AnimatedInterpolation
5
- | [{ [Key: string]: Animated.AnimatedInterpolation }];
4
+ | Animated.AnimatedInterpolation<number>
5
+ | [{ [Key: string]: Animated.AnimatedInterpolation<number> }];
6
6
 
7
7
  type AnimationConfig = {
8
8
  duration: number;
@@ -31,7 +31,7 @@ const interpolate = (
31
31
  animatedValue: Animated.Value,
32
32
  from: number = 0,
33
33
  to: number = 1
34
- ): Animated.AnimatedInterpolation =>
34
+ ): Animated.AnimatedInterpolation<number> =>
35
35
  animatedValue.interpolate({
36
36
  inputRange: [0, 1],
37
37
  outputRange: [from, to],
@@ -71,6 +71,36 @@ exports[`PlayerWrapper renders inline 1`] = `
71
71
  }
72
72
  testID="test-player-container"
73
73
  />
74
+ <View
75
+ animationType="componentFade"
76
+ style={
77
+ {
78
+ "flex": 1,
79
+ }
80
+ }
81
+ >
82
+ <View
83
+ configuration={
84
+ {
85
+ "tablet_landscape_player_container_background_color": "red",
86
+ "tablet_landscape_sidebar_width": "35%",
87
+ }
88
+ }
89
+ entry={
90
+ {
91
+ "id": "test",
92
+ }
93
+ }
94
+ isTablet={false}
95
+ isTabletLandscape={false}
96
+ style={
97
+ {
98
+ "flex": 1,
99
+ "paddingTop": 20,
100
+ }
101
+ }
102
+ />
103
+ </View>
74
104
  </View>
75
105
  </RNCSafeAreaView>
76
106
  </RNCSafeAreaProvider>
@@ -239,6 +269,36 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
239
269
  }
240
270
  />
241
271
  </View>
272
+ <View
273
+ animationType="componentFade"
274
+ style={
275
+ {
276
+ "flex": 1,
277
+ }
278
+ }
279
+ >
280
+ <View
281
+ configuration={
282
+ {
283
+ "tablet_landscape_player_container_background_color": "red",
284
+ "tablet_landscape_sidebar_width": "35%",
285
+ }
286
+ }
287
+ entry={
288
+ {
289
+ "id": "test",
290
+ }
291
+ }
292
+ isTablet={true}
293
+ isTabletLandscape={true}
294
+ style={
295
+ {
296
+ "flex": 1,
297
+ "paddingTop": 20,
298
+ }
299
+ }
300
+ />
301
+ </View>
242
302
  </View>
243
303
  </RNCSafeAreaView>
244
304
  </RNCSafeAreaProvider>