@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5335086935 → 13.0.0-alpha.5375459737

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 (81) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  2. package/Components/AudioPlayer/helpers.tsx +1 -0
  3. package/Components/Cell/Cell.tsx +3 -13
  4. package/Components/Cell/CellWithFocusable.tsx +21 -15
  5. package/Components/Cell/CellWrapper.tsx +18 -0
  6. package/Components/Cell/styles.ts +17 -0
  7. package/Components/CellRendererResolver/index.ts +2 -1
  8. package/Components/ErrorScreen/index.tsx +8 -0
  9. package/Components/FocusableCell/index.tsx +1 -1
  10. package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
  11. package/Components/FocusableGroup/index.tsx +0 -3
  12. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +22 -0
  13. package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
  14. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  15. package/Components/Layout/TV/ScreenContainer.tsx +8 -2
  16. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
  17. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
  18. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  19. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  20. package/Components/Layout/TV/index.tsx +6 -20
  21. package/Components/Layout/TV/index.web.tsx +4 -1
  22. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
  23. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
  24. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
  25. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
  26. package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
  27. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
  28. package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
  29. package/Components/MasterCell/utils/index.ts +8 -134
  30. package/Components/ModalComponent/BottomSheetModalContent.tsx +45 -19
  31. package/Components/ModalComponent/Button/Item.tsx +6 -5
  32. package/Components/ModalComponent/Button/assets.ts +1 -1
  33. package/Components/ModalComponent/Button/index.tsx +29 -42
  34. package/Components/ModalComponent/utils.ts +55 -7
  35. package/Components/OfflineHandler/utils/index.ts +1 -1
  36. package/Components/PlayerContainer/PlayerContainer.tsx +32 -6
  37. package/Components/PlayerImageBackground/index.tsx +1 -1
  38. package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
  39. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  40. package/Components/River/RiverItem.tsx +2 -1
  41. package/Components/Screen/TV/index.web.tsx +5 -6
  42. package/Components/Screen/hooks.ts +3 -6
  43. package/Components/TrackedView/index.tsx +1 -0
  44. package/Components/Transitioner/AnimationManager.js +15 -15
  45. package/Components/VideoLive/PlayerLiveImageComponent.tsx +4 -0
  46. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
  47. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  48. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +35 -19
  49. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  50. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +38 -13
  51. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +10 -3
  52. package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
  53. package/Components/VideoModal/ModalAnimation/const.ts +5 -0
  54. package/Components/VideoModal/ModalAnimation/index.ts +2 -0
  55. package/Components/VideoModal/ModalAnimation/utils.ts +36 -0
  56. package/Components/VideoModal/PlayerDetails.tsx +8 -5
  57. package/Components/VideoModal/PlayerWrapper.tsx +26 -3
  58. package/Components/VideoModal/VideoModal.tsx +19 -4
  59. package/Components/VideoModal/utils.ts +3 -4
  60. package/Components/ZappUIComponent/index.tsx +4 -4
  61. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
  62. package/Contexts/HeaderOffsetContext/index.tsx +4 -6
  63. package/Contexts/ScreenContext/index.tsx +3 -10
  64. package/Contexts/ScreenLayoutContext/index.tsx +5 -3
  65. package/Decorators/RiverResolver/index.tsx +5 -7
  66. package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
  67. package/package.json +5 -9
  68. package/tsconfig.json +2 -3
  69. package/.babelrc +0 -8
  70. package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
  71. package/Components/Cell/CellStyles/Hero/index.js +0 -111
  72. package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
  73. package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
  74. package/Components/Cell/CellStyles/colors.js +0 -40
  75. package/Components/Cell/CellStyles/index.js +0 -15
  76. package/Components/Cell/CellWithFocusable.ios.tsx +0 -126
  77. package/Components/ScreenRevealManager/ScreenRevealManager.ts +0 -76
  78. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +0 -107
  79. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +0 -96
  80. package/Components/ScreenRevealManager/index.ts +0 -1
  81. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +0 -79
@@ -10,13 +10,11 @@ import { Button } from "./Button";
10
10
  import { ItemIconProps } from "./Button/ItemIcon";
11
11
  import { ItemProps } from "./Button/Item";
12
12
  import { ItemLabelProps } from "./Button/ItemLabel";
13
- import {
14
- defaultItemIconProps,
15
- defaultItemLabelProps,
16
- defaultItemProps,
17
- } from "./utils";
13
+ import { getItemIconProps, getItemLabelProps, getItemProps } from "./utils";
18
14
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
19
15
 
16
+ import type { PluginConfiguration } from "./";
17
+
20
18
  import { ModalHeader } from "./Header";
21
19
 
22
20
  type ModalComponentProps = {
@@ -30,6 +28,20 @@ type ModalComponentProps = {
30
28
  maxHeight?: number;
31
29
  dismiss: () => void;
32
30
  buttonComponent?: React.ComponentType;
31
+ iconProps?: ItemIconProps | ((theme: PluginConfiguration) => ItemIconProps);
32
+ itemProps?:
33
+ | ItemProps
34
+ | ((theme: PluginConfiguration, width: number) => ItemProps);
35
+ labelProps?:
36
+ | ItemLabelProps
37
+ | ((theme: PluginConfiguration, width: number) => ItemLabelProps);
38
+ getSelectedItemIcon: (
39
+ theme: PluginConfiguration
40
+ ) => ItemIconProps["asset"] | null;
41
+ getDefaultItemIcon: (
42
+ theme: PluginConfiguration
43
+ ) => ItemIconProps["asset"] | null;
44
+ iconPlacement?: "left" | "right";
33
45
  };
34
46
 
35
47
  export function BottomSheetModalContent(props: ModalComponentProps) {
@@ -43,14 +55,20 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
43
55
  summary,
44
56
  title,
45
57
  buttonComponent: ButtonComponent = Button,
58
+ getSelectedItemIcon = (theme) =>
59
+ theme.modal_bottom_sheet_item_selected_icon,
60
+ getDefaultItemIcon = () => null,
61
+ iconPlacement,
46
62
  } = props;
47
63
 
48
64
  const [headerHeight, setHeaderHeight] = useState(0);
49
65
  const route = useRef(currentRoute);
50
66
  const theme = useTheme<BaseThemePropertiesMobile>();
67
+ const paddingTop = Number(theme.modal_bottom_sheet_padding_top);
68
+ const paddingBottom = Number(theme.modal_bottom_sheet_padding_bottom);
51
69
 
52
70
  const maxContentHeight = maxHeight
53
- ? maxHeight - headerHeight - Number(theme.modal_bottom_sheet_padding_top)
71
+ ? maxHeight - headerHeight - paddingTop
54
72
  : undefined;
55
73
 
56
74
  const onHeaderLayout = useCallback((event: LayoutChangeEvent) => {
@@ -64,26 +82,30 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
64
82
  }, [currentRoute]);
65
83
 
66
84
  const iconBaseProps = useMemo<ItemIconProps>(() => {
67
- return defaultItemIconProps(theme);
68
- }, [theme]);
85
+ return getItemIconProps(theme, props.iconProps);
86
+ }, [theme, props.iconProps]);
69
87
 
70
88
  const itemBaseProps = useMemo<ItemProps>(() => {
71
- return defaultItemProps(theme, props.width);
72
- }, [theme, props.width]);
89
+ return getItemProps(theme, props.width, props.itemProps);
90
+ }, [theme, props.width, props.itemProps]);
73
91
 
74
92
  const labelBaseProps = useMemo<ItemLabelProps>(() => {
75
- return defaultItemLabelProps(theme, props.width);
76
- }, [theme, props.width]);
93
+ return getItemLabelProps(theme, props.width, props.labelProps);
94
+ }, [theme, props.width, props.labelProps]);
77
95
 
78
- const handlePress = (item: any) => {
79
- onPress(item);
80
- dismiss();
81
- };
96
+ const handlePress = useCallback(
97
+ (item: any) => {
98
+ onPress(item);
99
+ dismiss();
100
+ },
101
+ [onPress, dismiss]
102
+ );
82
103
 
83
104
  return (
84
105
  <View
85
106
  style={{
86
- paddingTop: Number(theme.modal_bottom_sheet_padding_top),
107
+ maxWidth: props.width,
108
+ paddingTop,
87
109
  }}
88
110
  >
89
111
  <ModalHeader
@@ -98,8 +120,8 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
98
120
  bounces={false}
99
121
  style={{ maxHeight: maxContentHeight }}
100
122
  contentContainerStyle={{
101
- paddingBottom: Number(theme.modal_bottom_sheet_padding_bottom),
102
- paddingTop: Number(theme.modal_bottom_sheet_padding_top),
123
+ paddingBottom,
124
+ paddingTop,
103
125
  }}
104
126
  >
105
127
  {items.map((item, index) => (
@@ -110,9 +132,13 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
110
132
  selectedItem={current_selection}
111
133
  item={item}
112
134
  onPress={handlePress}
135
+ label={theme[item?.label] ?? item?.label}
113
136
  iconBaseProps={iconBaseProps}
114
137
  itemBaseProps={itemBaseProps}
115
138
  labelBaseProps={labelBaseProps}
139
+ selectedItemIcon={getSelectedItemIcon(theme)}
140
+ defaultItemIcon={getDefaultItemIcon(theme)}
141
+ iconPlacement={iconPlacement}
116
142
  />
117
143
  ))}
118
144
  </ScrollView>
@@ -5,7 +5,7 @@ export type ItemProps = {
5
5
  backgroundColor: string;
6
6
  focusedBackgroundColor: string;
7
7
  selectedBackgroundColor?: string;
8
- focusectedBackgroundColor?: string;
8
+ focusedSelectedBackgroundColor?: string;
9
9
  borderRadius: number;
10
10
  marginBottom: number;
11
11
  marginLeft: number;
@@ -15,6 +15,7 @@ export type ItemProps = {
15
15
  paddingBottom: number;
16
16
  paddingRight: number;
17
17
  paddingLeft: number;
18
+ maxWidth: number;
18
19
  focused?: boolean;
19
20
  selected?: boolean;
20
21
  children?: ReactChild[];
@@ -33,11 +34,11 @@ function getBackgroundColor({
33
34
  backgroundColor,
34
35
  focusedBackgroundColor,
35
36
  selectedBackgroundColor,
36
- focusectedBackgroundColor,
37
+ focusedSelectedBackgroundColor,
37
38
  }) {
38
39
  switch (true) {
39
40
  case selected && focused:
40
- return focusectedBackgroundColor;
41
+ return focusedSelectedBackgroundColor;
41
42
  case selected && !focused:
42
43
  return selectedBackgroundColor;
43
44
  case !selected && focused:
@@ -51,7 +52,7 @@ export function Item(props: ItemProps) {
51
52
  const {
52
53
  backgroundColor,
53
54
  focusedBackgroundColor,
54
- focusectedBackgroundColor,
55
+ focusedSelectedBackgroundColor,
55
56
  selectedBackgroundColor,
56
57
  children,
57
58
  focused,
@@ -68,7 +69,7 @@ export function Item(props: ItemProps) {
68
69
  backgroundColor: getBackgroundColor({
69
70
  selected,
70
71
  focused,
71
- focusectedBackgroundColor,
72
+ focusedSelectedBackgroundColor,
72
73
  focusedBackgroundColor,
73
74
  selectedBackgroundColor,
74
75
  backgroundColor,
@@ -1,4 +1,4 @@
1
1
  /* eslint-disable max-len */
2
2
 
3
3
  export const defaultSelectedAsset: string =
4
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAGsSURBVHgB7drdaYRAFIbhk2yuBTuwlXSQDrKdrOnErSSlpATBe0nOBxEMEXV+nDnjfg8MwiK4vKjMDIoQERERERERERHRY+j7vtHxJvTfb5wvHd/DMLyLpyc5IcTRw6eOZvrtcrlcq6q6i6PTBVqKM/GJdKpAa3EmrpGe5ST2xIFxHF/FwSnuoL1x1L2u66s4KD7QkXGg6EBHx4FiA6WIA0UGShUHiguUMg4UFSh1HCgmUI44UESgXHEgaCatf/wWslLeeY1GMsWBF/GEOHpodeouGkl8Vso7rtFIxjjg9YhNcea/+W4nrFyjkcxxwDnQUpxJrEhW4oBToLU4k9BIluKA60t6M6i+kzrfF7e1OODziLV6uG2d53onWYwDvi/pViJGshoHvCeKsSJZjgNBM+nQSNbjQPBSwzdSCXEgylrMNVIpcSDaYnVvJPWhA9OAZuO87HEg6mreIdIWE3Eg+nZHhEhm4sAh+0EBkUzFgcM2zDwimYsDh+4oOkQyGQcO33LdEclsHEiyJ70SyXScpBAJX3vNRif01yxSJ7SMH1USEREREREREREV7Ad//SBSU+GIIAAAAABJRU5ErkJggg==";
4
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAACXBIWXMAACE4AAAhOAFFljFgAAAA+0lEQVR4nO3a3QnCQBBF4ZRiSXZgKVqKnVnCQBpQwb0QJA752ZjszPlg3/JwOU8b2K4DAAAAAAAAkIOZnczsvPeOQypxHmb27Pv+sveeQxnG0SFSMRaHSIUXJ32kKXHKue+99e+I4yCOgzgO4jiI4yCOgzgO4jiajfMedd366t50nK3/b0LE2SpSqDi1I4WMUytSs3G6z/jbhOGLIzUdR7aKFCKO1I4UKo7UihQyjqyNFDqOLI2UIo7MjZQqjkyNVL7LFUdmRMoXRypEihtHVkSKH0cWRMoTR2ZEyhdHJkTKG0ecSMSRkUjE+TaIRJxfeFQJAAAAAAAANOwFT0Mt2UgcaMoAAAAASUVORK5CYII=";
@@ -3,7 +3,6 @@ import { StyleSheet, TouchableOpacity, View } from "react-native";
3
3
  import { Item, ItemProps } from "./Item";
4
4
  import { ItemIcon, ItemIconProps } from "./ItemIcon";
5
5
  import { ItemLabel, ItemLabelProps } from "./ItemLabel";
6
- import * as assets from "./assets";
7
6
  import { defaultSelectedAsset } from "./assets";
8
7
 
9
8
  type ButtonProps = {
@@ -17,6 +16,9 @@ type ButtonProps = {
17
16
  labelBaseProps?: ItemLabelProps;
18
17
  disabled?: boolean;
19
18
  label?: string | Record<string, string>;
19
+ iconPlacement?: "left" | "right";
20
+ selectedItemIcon?: ItemIconProps["asset"];
21
+ defaultItemIcon?: ItemIconProps["asset"];
20
22
  };
21
23
 
22
24
  const styles = StyleSheet.create({
@@ -33,52 +35,32 @@ export function Button({
33
35
  configuration,
34
36
  width,
35
37
  iconBaseProps,
36
- itemBaseProps,
38
+ itemBaseProps: itemProps,
37
39
  labelBaseProps,
38
40
  label,
41
+ iconPlacement = "left",
42
+ defaultItemIcon,
43
+ selectedItemIcon,
39
44
  disabled = false,
40
45
  }: ButtonProps) {
41
46
  const [focused, setFocused] = useState(false);
42
47
 
43
- const selected = useMemo(
44
- () => selectedItem && item.value === selectedItem?.value,
45
- [selectedItem, selectedItem]
46
- );
47
-
48
- const itemProps = useMemo<ItemProps>(
49
- () => ({
50
- ...itemBaseProps,
51
- width,
52
- }),
53
- [configuration, width]
54
- );
48
+ const selected = selectedItem && item.value === selectedItem?.value;
55
49
 
56
- const itemIconProps = useMemo<ItemIconProps>(
57
- () => ({
58
- ...iconBaseProps,
59
- asset: configuration[item.asset] ?? assets[item.asset] ?? item.asset,
60
- }),
61
- [configuration, item.asset]
50
+ const itemIconPropsAssets = useMemo<ItemIconProps["asset"]>(
51
+ () => configuration[item.asset] ?? item.asset ?? defaultItemIcon,
52
+ [item.asset, defaultItemIcon]
62
53
  );
63
54
 
64
- const selectedItemIconProps = useMemo<ItemIconProps>(
65
- () => ({
66
- ...iconBaseProps,
67
- asset:
68
- configuration["modal_bottom_sheet_item_selected_icon"] ||
69
- defaultSelectedAsset,
70
- marginRight: 10,
71
- }),
72
- [configuration]
55
+ const selectedItemIconPropsAssets = useMemo<ItemIconProps["asset"]>(
56
+ () => selectedItemIcon || defaultSelectedAsset,
57
+ [selectedItemIcon]
73
58
  );
74
59
 
75
- const itemLabelProps = useMemo<ItemLabelProps>(
76
- () => ({
77
- ...labelBaseProps,
78
- label: label ?? configuration[item?.label] ?? item?.label ?? null,
79
- }),
80
- [configuration, item?.label]
81
- );
60
+ const renderItemIcon =
61
+ itemIconPropsAssets && itemIconPropsAssets.length > 0 ? (
62
+ <ItemIcon {...iconBaseProps} asset={itemIconPropsAssets} />
63
+ ) : null;
82
64
 
83
65
  if (disabled) return null;
84
66
 
@@ -92,18 +74,23 @@ export function Button({
92
74
  >
93
75
  <Item {...itemProps} focused={focused} selected={selected}>
94
76
  <View style={styles.label_icon_container}>
95
- {itemIconProps.asset && itemIconProps.asset.length > 0 ? (
96
- <ItemIcon {...itemIconProps} />
97
- ) : null}
98
- {itemLabelProps.label ? (
77
+ {iconPlacement === "left" && renderItemIcon}
78
+
79
+ {label ? (
99
80
  <ItemLabel
100
- {...itemLabelProps}
81
+ {...labelBaseProps}
82
+ label={label ?? null}
101
83
  focused={focused}
102
84
  selected={selected}
103
85
  />
104
86
  ) : null}
105
87
  </View>
106
- {selected ? <ItemIcon {...selectedItemIconProps} /> : null}
88
+
89
+ {selected ? (
90
+ <ItemIcon {...iconBaseProps} asset={selectedItemIconPropsAssets} />
91
+ ) : (
92
+ iconPlacement === "right" && renderItemIcon
93
+ )}
107
94
  </Item>
108
95
  </TouchableOpacity>
109
96
  </View>
@@ -1,15 +1,18 @@
1
1
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
2
- import { PluginConfiguration } from "./index";
2
+ import { PluginConfiguration } from "./";
3
+ import { ItemIconProps } from "./Button/ItemIcon";
4
+ import { ItemLabelProps } from "./Button/ItemLabel";
5
+ import { ItemProps } from "./Button/Item";
3
6
 
4
7
  export function defaultItemProps(
5
8
  config: PluginConfiguration,
6
9
  maxWidth: number
7
- ) {
10
+ ): ItemProps {
8
11
  const {
9
12
  modal_bottom_sheet_item_background_color,
10
13
  modal_bottom_sheet_item_focus_background_color,
11
14
  modal_bottom_sheet_item_selected_background_color,
12
- modal_bottom_sheet_item_focusected_background_color,
15
+ modal_bottom_sheet_item_focused_selected_background_color,
13
16
  modal_bottom_sheet_item_corner_radius,
14
17
  modal_bottom_sheet_item_margin_bottom,
15
18
  modal_bottom_sheet_item_margin_left,
@@ -25,8 +28,8 @@ export function defaultItemProps(
25
28
  backgroundColor: modal_bottom_sheet_item_background_color,
26
29
  focusedBackgroundColor: modal_bottom_sheet_item_focus_background_color,
27
30
  selectedBackgroundColor: modal_bottom_sheet_item_selected_background_color,
28
- focusectedBackgroundColor:
29
- modal_bottom_sheet_item_focusected_background_color,
31
+ focusedSelectedBackgroundColor:
32
+ modal_bottom_sheet_item_focused_selected_background_color,
30
33
  borderRadius: modal_bottom_sheet_item_corner_radius,
31
34
  marginBottom: modal_bottom_sheet_item_margin_bottom,
32
35
  marginTop: modal_bottom_sheet_item_margin_top,
@@ -43,7 +46,7 @@ export function defaultItemProps(
43
46
  export function defaultItemLabelProps(
44
47
  config: PluginConfiguration,
45
48
  sheetWidth: number
46
- ) {
49
+ ): ItemLabelProps {
47
50
  const {
48
51
  modal_bottom_sheet_item_label_android_letter_spacing,
49
52
  modal_bottom_sheet_item_label_ios_letter_spacing,
@@ -103,7 +106,9 @@ export function defaultItemLabelProps(
103
106
  };
104
107
  }
105
108
 
106
- export function defaultItemIconProps(config: PluginConfiguration) {
109
+ export function defaultItemIconProps(
110
+ config: PluginConfiguration
111
+ ): ItemIconProps {
107
112
  const {
108
113
  modal_bottom_sheet_item_icon_height,
109
114
  modal_bottom_sheet_item_icon_width,
@@ -124,3 +129,46 @@ export function defaultItemIconProps(config: PluginConfiguration) {
124
129
  marginRight: modal_bottom_sheet_item_icon_margin_right,
125
130
  };
126
131
  }
132
+
133
+ export function getItemIconProps(
134
+ theme: PluginConfiguration,
135
+ iconProps?: ((theme: PluginConfiguration) => ItemIconProps) | ItemIconProps
136
+ ) {
137
+ if (iconProps) {
138
+ return typeof iconProps === "function" ? iconProps(theme) : iconProps;
139
+ }
140
+
141
+ return defaultItemIconProps(theme);
142
+ }
143
+
144
+ export function getItemLabelProps(
145
+ theme: PluginConfiguration,
146
+ width: number,
147
+ labelProps?:
148
+ | ((theme: PluginConfiguration, width: number) => ItemLabelProps)
149
+ | ItemLabelProps
150
+ ) {
151
+ if (labelProps) {
152
+ return typeof labelProps === "function"
153
+ ? labelProps(theme, width)
154
+ : labelProps;
155
+ }
156
+
157
+ return defaultItemLabelProps(theme, width);
158
+ }
159
+
160
+ export function getItemProps(
161
+ theme: PluginConfiguration,
162
+ width: number,
163
+ itemProps?:
164
+ | ((theme: PluginConfiguration, width: number) => ItemProps)
165
+ | ItemProps
166
+ ) {
167
+ if (itemProps) {
168
+ return typeof itemProps === "function"
169
+ ? itemProps(theme, width)
170
+ : itemProps;
171
+ }
172
+
173
+ return defaultItemProps(theme, width);
174
+ }
@@ -57,7 +57,7 @@ export const useNotificationHeight = () => {
57
57
 
58
58
  const navBarHeight = platformSelect({ ios: 44, android: 56 });
59
59
 
60
- const statusHeight = Platform.OS === "android" ? 0 : insets.top;
60
+ const statusHeight = insets.top;
61
61
  const notificationHeight = statusHeight + navBarHeight;
62
62
 
63
63
  return { statusHeight, notificationHeight };
@@ -9,6 +9,7 @@ import {
9
9
  isApplePlatform,
10
10
  isTV,
11
11
  platformSelect,
12
+ isAndroidTVPlatform,
12
13
  } from "@applicaster/zapp-react-native-utils/reactUtils";
13
14
 
14
15
  import { TVEventHandlerComponent } from "@applicaster/zapp-react-native-tvos-ui-components/Components/TVEventHandlerComponent";
@@ -93,6 +94,20 @@ export type PlayNextData = {
93
94
 
94
95
  const focusableBottomContainerId = "player-container-bottom";
95
96
 
97
+ const isAndroidTV = isAndroidTVPlatform();
98
+
99
+ const withBorderHack = () => {
100
+ if (isAndroidTV) {
101
+ /* @HACK: see GH#7269 */
102
+ return {
103
+ borderWidth: 1,
104
+ borderColor: "transparent",
105
+ };
106
+ }
107
+
108
+ return {};
109
+ };
110
+
96
111
  // Styles
97
112
  const webStyles = {
98
113
  focusableGroup: {
@@ -335,9 +350,9 @@ const PlayerContainerComponent = (props: Props) => {
335
350
 
336
351
  const resumeTime = Number(item?.extensions?.resumeTime);
337
352
 
338
- // TODO: This is temp hack, will be removed on next pr with player refactoring
353
+ // Сhecking that the player itself knows where to start playing, and there is no need to call seekTo after returning from the Сhromecast
339
354
  if (
340
- !!playerManager.getActivePlayer()?.getContinueWatchingOffset === false &&
355
+ !playerManager.getActivePlayer()?.hasResumePosition() &&
341
356
  !isNaN(resumeTime)
342
357
  ) {
343
358
  player?.seekTo(resumeTime);
@@ -514,6 +529,12 @@ const PlayerContainerComponent = (props: Props) => {
514
529
  useEffect(() => {
515
530
  playerEvent("source_changed", { item });
516
531
 
532
+ return () => {
533
+ playerEvent("player_did_close", { item });
534
+ };
535
+ }, [item?.id, Player]);
536
+
537
+ useEffect(() => {
517
538
  if (!isModal) {
518
539
  showNavBar(false);
519
540
  }
@@ -523,13 +544,11 @@ const PlayerContainerComponent = (props: Props) => {
523
544
  }
524
545
 
525
546
  return () => {
526
- playerEvent("player_did_close", { item });
527
-
528
547
  if (!isModal) {
529
548
  showNavBar(true);
530
549
  }
531
550
  };
532
- }, [showNavBar, /* added as suggested: */ item?.id, isModal, Player]);
551
+ }, [showNavBar, isModal, Player]);
533
552
 
534
553
  useEffect(() => {
535
554
  if (prevItemId && !R.equals(prevItemId, item?.id)) {
@@ -640,7 +659,14 @@ const PlayerContainerComponent = (props: Props) => {
640
659
  testID={"player-screen-container"}
641
660
  >
642
661
  {/* Player container */}
643
- <View style={styles.playerWrapper} testID={"player-wrapper"}>
662
+ <View
663
+ style={[
664
+ styles.playerWrapper,
665
+ // eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
666
+ withBorderHack(),
667
+ ]}
668
+ testID={"player-wrapper"}
669
+ >
644
670
  <PlayerFocusableWrapperView
645
671
  nextFocusDown={context.bottomFocusableId}
646
672
  >
@@ -39,7 +39,7 @@ const PlayerImageBackgroundComponent = ({
39
39
  return (
40
40
  <View
41
41
  style={
42
- playerAnimationState === PlayerAnimationStateEnum.maximaze
42
+ playerAnimationState === PlayerAnimationStateEnum.maximize
43
43
  ? defaultImageDimensions
44
44
  : style
45
45
  }
@@ -34,6 +34,7 @@ type Props = {
34
34
  getStaticComponentFeed: any;
35
35
  pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
36
36
  refreshingPipesV1?: boolean;
37
+ stickyHeaderIndices?: number[];
37
38
  };
38
39
 
39
40
  const styles = StyleSheet.create({
@@ -61,6 +62,7 @@ function ComponentsMapComponent(props: Props) {
61
62
  // TODO: Remove when pipes v1 is deprecated.
62
63
  pullToRefreshPipesV1RefreshingStateUpdater,
63
64
  refreshingPipesV1,
65
+ stickyHeaderIndices,
64
66
  } = props;
65
67
 
66
68
  const flatListRef = React.useRef<FlatList | null>(null);
@@ -274,6 +276,7 @@ function ComponentsMapComponent(props: Props) {
274
276
  overScrollMode={Platform.OS === "android" ? "never" : "auto"}
275
277
  scrollIndicatorInsets={scrollIndicatorInsets}
276
278
  extraData={feed}
279
+ stickyHeaderIndices={stickyHeaderIndices}
277
280
  onLayout={handleOnLayout}
278
281
  removeClippedSubviews
279
282
  initialNumToRender={3}
@@ -28,10 +28,10 @@ type Return = {
28
28
  // TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
29
29
  const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
30
30
 
31
- const createLoadingStateObservable = () =>
31
+ const createLoadingStateObservable = (count: number) =>
32
32
  new BehaviorSubject<LoadingState>({
33
33
  index: -1,
34
- done: false,
34
+ done: count === 0,
35
35
  waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
36
36
  });
37
37
 
@@ -43,7 +43,7 @@ export const useLoadingState = (
43
43
  const [loadingError, setLoadingError] = React.useState(null);
44
44
 
45
45
  const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
46
- createLoadingStateObservable
46
+ () => createLoadingStateObservable(count)
47
47
  );
48
48
 
49
49
  const arePreviousComponentsLoaded = React.useCallback((index) => {
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect } from "react";
2
2
  import * as R from "ramda";
3
+ import { isGroup } from "@applicaster/zapp-react-native-utils/componentsUtils";
3
4
 
4
5
  import { applyDecorators } from "../../Decorators";
5
6
 
@@ -112,7 +113,7 @@ function RiverItemComponent(props: RiverItemType) {
112
113
  jsOnly: true,
113
114
  });
114
115
 
115
- if (!CellRenderer && item.component_type !== "group-qb") {
116
+ if (!CellRenderer && !isGroup(item)) {
116
117
  riverLogger.warning({
117
118
  message: "Cell Renderer is null - will fallback to default cell",
118
119
  data: { item, CellRenderer },
@@ -92,6 +92,10 @@ const getNavigations = ({
92
92
  return fallbackNavigations;
93
93
  };
94
94
 
95
+ const onRelease = () => {
96
+ focusManager.setInitialFocus();
97
+ };
98
+
95
99
  export const Screen = ({ route, Components }: Props) => {
96
100
  if (isNilOrEmpty(route)) {
97
101
  throw Error("Required props: route is missing");
@@ -152,12 +156,7 @@ export const Screen = ({ route, Components }: Props) => {
152
156
  const isScreenActive = useIsScreenActive();
153
157
 
154
158
  return (
155
- <FreezeWithCallback
156
- freeze={!isScreenActive}
157
- onRelease={() => {
158
- focusManager.setInitialFocus();
159
- }}
160
- >
159
+ <FreezeWithCallback freeze={!isScreenActive} onRelease={onRelease}>
161
160
  <View style={[styles.container, { backgroundColor }]}>
162
161
  <NavBarContainer isVisible={isNavBarVisible} onReady={noop}>
163
162
  <NavBar
@@ -7,15 +7,12 @@ import {
7
7
  useCurrentScreenData,
8
8
  useDimensions,
9
9
  useRoute,
10
+ useIsTablet,
10
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
11
12
  import { useMemo, useEffect, useState } from "react";
12
13
 
13
14
  export const useWaitForValidOrientation = () => {
14
- const {
15
- width: screenWidth,
16
- height,
17
- deviceInfo,
18
- } = useDimensions("screen", {
15
+ const { width: screenWidth, height } = useDimensions("screen", {
19
16
  fullDimensions: true,
20
17
  updateForInactiveScreens: false,
21
18
  });
@@ -26,7 +23,7 @@ export const useWaitForValidOrientation = () => {
26
23
 
27
24
  const [readyState, setReadyState] = useState(false);
28
25
 
29
- const isTablet = deviceInfo?.isTablet;
26
+ const isTablet = useIsTablet();
30
27
 
31
28
  const { appData } = usePickFromState(["appData"]);
32
29
  const isTabletPortrait = appData?.isTabletPortrait;
@@ -12,6 +12,7 @@ type TrackedViewProps = {
12
12
  onPositionUpdated: (props: { rect?: Record<string, number> }) => void;
13
13
  testId?: string | undefined;
14
14
  groupId?: string;
15
+ clipThreshold?: number;
15
16
  };
16
17
 
17
18
  export const TrackedView = memo(function TrackedView(props: TrackedViewProps) {
@@ -2,21 +2,21 @@ import { Animated } from "react-native";
2
2
 
3
3
  import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
4
4
 
5
- type TransitionConfig = {
6
- duration: number;
7
- easing: any;
8
- from: {
9
- style: any;
10
- };
11
- to: {
12
- style: any;
13
- };
14
- };
5
+ // type TransitionConfig = {
6
+ // duration: number;
7
+ // easing: any;
8
+ // from: {
9
+ // style: any;
10
+ // };
11
+ // to: {
12
+ // style: any;
13
+ // };
14
+ // };
15
15
 
16
- type Props = {
17
- transitionConfig: TransitionConfig;
18
- contentStyle: { [string]: any };
19
- };
16
+ // type Props = {
17
+ // transitionConfig: TransitionConfig;
18
+ // contentStyle: { [string]: any };
19
+ // };
20
20
 
21
21
  /**
22
22
  * Manages animation for the Transitioner,
@@ -25,7 +25,7 @@ type Props = {
25
25
  * which must have a proper structure, see types above ^.
26
26
  */
27
27
  export class AnimationManager {
28
- constructor(props: Props) {
28
+ constructor(props) {
29
29
  this.animatedValue = new Animated.Value(0.0);
30
30
 
31
31
  this.config = props.transitionConfig(