@applicaster/zapp-react-native-ui-components 14.0.0-alpha.7900711229 → 14.0.0-alpha.8220111512

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 (97) hide show
  1. package/Components/AnimatedInOut/index.tsx +5 -3
  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/Cell/index.js +7 -3
  17. package/Components/ComponentResolver/index.ts +1 -1
  18. package/Components/FeedLoader/index.js +1 -1
  19. package/Components/Focusable/Focusable.tsx +5 -3
  20. package/Components/Focusable/FocusableTvOS.tsx +3 -3
  21. package/Components/Focusable/FocusableiOS.tsx +2 -2
  22. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  23. package/Components/Focusable/index.android.tsx +12 -8
  24. package/Components/Focusable/index.tsx +1 -1
  25. package/Components/FocusableList/index.tsx +4 -0
  26. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
  27. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +12 -8
  28. package/Components/HandlePlayable/HandlePlayable.tsx +25 -9
  29. package/Components/Layout/TV/LayoutBackground.tsx +1 -1
  30. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
  31. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
  32. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
  33. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
  34. package/Components/MasterCell/elementMapper.tsx +1 -2
  35. package/Components/MasterCell/index.tsx +1 -1
  36. package/Components/MasterCell/utils/behaviorProvider.ts +14 -82
  37. package/Components/MasterCell/utils/index.ts +3 -23
  38. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
  39. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
  40. package/Components/OfflineHandler/__tests__/index.test.tsx +20 -22
  41. package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
  42. package/Components/PlayerContainer/PlayerContainer.tsx +41 -28
  43. package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
  44. package/Components/PlayerContainer/index.ts +1 -1
  45. package/Components/River/ComponentsMap/ComponentsMap.tsx +0 -1
  46. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +379 -0
  47. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
  48. package/Components/River/RefreshControl.tsx +6 -4
  49. package/Components/River/TV/River.tsx +2 -17
  50. package/Components/River/TV/index.tsx +3 -1
  51. package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
  52. package/Components/River/TV/withRiverDataLoader.tsx +17 -0
  53. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  54. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  55. package/Components/River/index.tsx +1 -1
  56. package/Components/Screen/__tests__/Screen.test.tsx +23 -12
  57. package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
  58. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
  59. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
  60. package/Components/ScreenRevealManager/index.ts +1 -0
  61. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +79 -0
  62. package/Components/Tabs/TV/Tabs.android.tsx +0 -2
  63. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
  64. package/Components/Transitioner/Scene.tsx +0 -1
  65. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
  66. package/Components/VideoLive/animationUtils.ts +3 -3
  67. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -8
  68. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  69. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  70. package/Components/VideoModal/VideoModal.tsx +3 -17
  71. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  72. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  73. package/Components/VideoModal/hooks/index.ts +0 -2
  74. package/Components/VideoModal/hooks/useModalSize.ts +18 -2
  75. package/Components/VideoModal/utils.ts +6 -0
  76. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
  77. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
  78. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  79. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  80. package/Contexts/ScreenDataContext/index.tsx +0 -2
  81. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  82. package/Decorators/RiverFeedLoader/index.tsx +2 -8
  83. package/Decorators/RiverFeedLoader/utils/index.ts +2 -7
  84. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
  85. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
  86. package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
  87. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
  88. package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
  89. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
  90. package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
  91. package/Decorators/ZappPipesDataConnector/index.tsx +27 -312
  92. package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
  93. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
  94. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +241 -0
  95. package/Decorators/ZappPipesDataConnector/types.ts +29 -0
  96. package/package.json +5 -10
  97. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
@@ -1,6 +1,6 @@
1
1
  import * as R from "ramda";
2
2
 
3
- import { connectToStore } from "@applicaster/zapp-react-native-redux";
3
+ import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
4
4
 
5
5
  import { ComponentResolverComponent } from "./ComponentResolver";
6
6
 
@@ -1,6 +1,6 @@
1
1
  import * as R from "ramda";
2
2
 
3
- import { connectToStore } from "@applicaster/zapp-react-native-redux";
3
+ import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
4
4
  import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
5
5
 
6
6
  import { FeedLoaderComponent } from "./FeedLoader";
@@ -5,6 +5,7 @@ import { BaseFocusable } from "../BaseFocusable";
5
5
  import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
6
6
  import { LONG_KEY_PRESS_TIMEOUT } from "@applicaster/quick-brick-core/const";
7
7
  import { withFocusableContext } from "../../Contexts/FocusableGroupContext/withFocusableContext";
8
+ import { StyleSheet, ViewStyle } from "react-native";
8
9
 
9
10
  type Props = {
10
11
  initialFocus?: boolean;
@@ -21,7 +22,7 @@ type Props = {
21
22
  handleFocus?: ({ mouse }: { mouse: boolean }) => void;
22
23
  children: (boolean, string) => React.ComponentType<any>;
23
24
  selected?: boolean;
24
- style?: React.CSSProperties;
25
+ style?: ViewStyle[] | ViewStyle;
25
26
  };
26
27
 
27
28
  class Focusable extends BaseFocusable<Props> {
@@ -122,7 +123,7 @@ class Focusable extends BaseFocusable<Props> {
122
123
  }
123
124
 
124
125
  render() {
125
- const { children, style } = this.props;
126
+ const { children, style, ...otherProps } = this.props;
126
127
  const { focused } = this.state;
127
128
 
128
129
  const id = this.getId();
@@ -139,7 +140,8 @@ class Focusable extends BaseFocusable<Props> {
139
140
  onMouseUp={this.pressOut}
140
141
  data-testid={focusableId}
141
142
  focused-teststate={focused ? "focused" : "default"}
142
- style={style}
143
+ style={StyleSheet.flatten(style) as any as React.CSSProperties}
144
+ {...otherProps}
143
145
  >
144
146
  {children(focused, { mouse: this.mouse })}
145
147
  </div>
@@ -16,9 +16,9 @@ function noop() {}
16
16
  type Props = {
17
17
  id: string;
18
18
  groupId: string;
19
- onPress?: (nativeEvent: React.SyntheticEvent) => void;
20
- onFocus?: (nativeEvent: React.SyntheticEvent) => void;
21
- onBlur?: (nativeEvent: React.SyntheticEvent) => void;
19
+ onPress?: (nativeEvent: any) => void;
20
+ onFocus?: (nativeEvent: any) => void;
21
+ onBlur?: (nativeEvent: any) => void;
22
22
  children: (focused?: boolean) => React.ReactNode;
23
23
  isParallaxDisabled: boolean;
24
24
  preferredFocus?: boolean;
@@ -2,7 +2,7 @@ import React from "react";
2
2
 
3
3
  type Props = {
4
4
  children: () => React.ReactNode;
5
- };
5
+ } & Record<string, any>;
6
6
 
7
7
  function FocusableiOSComponent({ children }: Props) {
8
8
  if (typeof children === "function") {
@@ -12,4 +12,4 @@ function FocusableiOSComponent({ children }: Props) {
12
12
  return children;
13
13
  }
14
14
 
15
- export const FocusableiOS = React.forwardRef(FocusableiOSComponent);
15
+ export const FocusableiOS = FocusableiOSComponent;
@@ -38,6 +38,9 @@ describe("Focusable", () => {
38
38
  });
39
39
 
40
40
  it("updates disableFocus state when disableFocus prop changes", () => {
41
+ const unregister = jest.fn();
42
+ mockFocusManager.registerFocusable.mockReturnValue(unregister);
43
+
41
44
  const { rerender } = render(
42
45
  <Focusable id="test-id" disableFocus={false}>
43
46
  <Touchable testID="touchable" />
@@ -43,11 +43,13 @@ export const FocusableContext = React.createContext<
43
43
  // eslint-disable-next-line
44
44
  setIsFocusable: (enableFocus: boolean) => void;
45
45
  ref: FocusManager.FocusableRef;
46
+ parentFocusableId: Option<string>;
46
47
  } & ParentFocus
47
48
  >({
48
49
  focused: false,
49
50
  setIsFocusable: () => {},
50
51
  ref: { current: null },
52
+ parentFocusableId: undefined,
51
53
  });
52
54
 
53
55
  export const useFocusable = () => React.useContext(FocusableContext);
@@ -74,7 +76,7 @@ function FocusableComponent(props: Props, forwardedRef) {
74
76
 
75
77
  const isRTL = useIsRTL();
76
78
  const focusManager = useFocusManager();
77
- const { ref: parentFocusable } = useFocusable();
79
+ const { ref: parentFocusableRef, parentFocusableId } = useFocusable();
78
80
  const touchableRef = React.useRef(null);
79
81
 
80
82
  const [focused, setFocused] = React.useState(() =>
@@ -98,13 +100,14 @@ function FocusableComponent(props: Props, forwardedRef) {
98
100
  }
99
101
  }, [disableFocus]);
100
102
 
101
- React.useEffect(() => {
103
+ React.useLayoutEffect(() => {
102
104
  if (id) {
103
- const unregister = focusManager.registerFocusable(
105
+ const unregister = focusManager.registerFocusable({
104
106
  touchableRef,
105
- parentFocusable,
106
- isFocusableCell
107
- );
107
+ parentFocusableRef,
108
+ isFocusableCell,
109
+ parentFocusableId,
110
+ });
108
111
 
109
112
  onRegister();
110
113
 
@@ -112,7 +115,7 @@ function FocusableComponent(props: Props, forwardedRef) {
112
115
  unregister();
113
116
  };
114
117
  }
115
- }, [id, onRegister, isFocusableCell]);
118
+ }, [id, onRegister, isFocusableCell, parentFocusableId]);
116
119
 
117
120
  if (R.isNil(id)) {
118
121
  // eslint-disable-next-line no-console
@@ -164,8 +167,9 @@ function FocusableComponent(props: Props, forwardedRef) {
164
167
  ...parentFocus,
165
168
  ref: touchableRef,
166
169
  setIsFocusable,
170
+ parentFocusableId: id,
167
171
  };
168
- }, [parentFocus, focused]);
172
+ }, [parentFocus, focused, id]);
169
173
 
170
174
  return (
171
175
  <Touchable
@@ -4,7 +4,7 @@ import { FocusableiOS } from "./FocusableiOS";
4
4
 
5
5
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
6
6
 
7
- export const Focusable = platformSelect({
7
+ export const Focusable: React.ComponentType<any> = platformSelect({
8
8
  tvos: FocusableTvOS,
9
9
  ios: FocusableiOS,
10
10
  default: FocusableDefault,
@@ -91,6 +91,7 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
91
91
  // eslint-disable-next-line unused-imports/no-unused-vars
92
92
  omitPropsPropagation = [],
93
93
  useScrollView = false,
94
+ onScrollToIndexFailed = noop,
94
95
  } = props;
95
96
 
96
97
  useCheckItemIdsForUnique({ componentId: props.id, items: data });
@@ -277,6 +278,7 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
277
278
  "withStateMemory",
278
279
  "useSequentialLoading",
279
280
  "useScrollView",
281
+ "onScrollToIndexFailed",
280
282
  ...omitPropsPropagation,
281
283
  ],
282
284
  R.__
@@ -305,6 +307,7 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
305
307
  {...getFlatListProps(props)}
306
308
  onEndReached={onEndReached}
307
309
  initialNumToRender={initialNumToRender}
310
+ onScrollToIndexFailed={onScrollToIndexFailed}
308
311
  renderItem={renderItem}
309
312
  focused={focused}
310
313
  data={data}
@@ -319,6 +322,7 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
319
322
  renderItem={renderItem}
320
323
  onEndReached={onEndReached}
321
324
  initialNumToRender={initialNumToRender}
325
+ onScrollToIndexFailed={onScrollToIndexFailed}
322
326
  />
323
327
  )}
324
328
  </ChildrenFocusDeactivatorView>
@@ -8,13 +8,10 @@ import {
8
8
  useCurationAPI,
9
9
  } from "../useCurationAPI";
10
10
  import * as redux from "react-redux";
11
- import * as layoutPresets from "@applicaster/zapp-react-native-redux/hooks/useLayoutPresets";
12
- import * as pipesFeeds from "@applicaster/zapp-react-native-redux/hooks/useZappPipesFeeds";
13
11
  import { NavigationContext } from "@applicaster/zapp-react-native-ui-components/Contexts/NavigationContext";
14
12
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
15
13
 
16
- import { Provider } from "react-redux";
17
- import configureStore from "redux-mock-store";
14
+ import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
18
15
 
19
16
  jest.mock(
20
17
  "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute",
@@ -42,19 +39,20 @@ const mainStackNavigator = {
42
39
  },
43
40
  };
44
41
 
45
- const store = configureStore()({});
46
-
47
- const wrapper = ({ children }) => (
48
- <Provider store={store}>
49
- <NavigationContext.Provider
50
- value={{ ...mainStackNavigator, currentRoute: homeStack.route }}
51
- >
52
- <PathnameContext.Provider value={homeStack.route}>
53
- {children}
54
- </PathnameContext.Provider>
55
- </NavigationContext.Provider>
56
- </Provider>
57
- );
42
+ const getWrapper =
43
+ (store) =>
44
+ // eslint-disable-next-line react/display-name, react/prop-types
45
+ ({ children }) => (
46
+ <WrappedWithProviders store={store}>
47
+ <NavigationContext.Provider
48
+ value={{ ...mainStackNavigator, currentRoute: homeStack.route }}
49
+ >
50
+ <PathnameContext.Provider value={homeStack.route}>
51
+ {children}
52
+ </PathnameContext.Provider>
53
+ </NavigationContext.Provider>
54
+ </WrappedWithProviders>
55
+ );
58
56
 
59
57
  describe("getTransformedPreset should return the passed components if smartComponents is empty", () => {
60
58
  describe("getTransformedPreset function", () => {
@@ -312,19 +310,10 @@ describe("getTransformedPreset should return the passed components if smartCompo
312
310
  { id: "02", component_type: "not_smart_another" },
313
311
  ];
314
312
 
315
- // mock the hooks
316
- const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
317
- mockUseZappPipesFeeds.mockReturnValue({});
318
-
319
- const mockUseLayoutPresets = jest.spyOn(
320
- layoutPresets,
321
- "useLayoutPresets"
322
- );
323
-
324
- mockUseLayoutPresets.mockReturnValue({});
325
-
326
313
  const { result } = renderHook(() => useCurationAPI(mockComponents), {
327
- wrapper,
314
+ wrapper: getWrapper({
315
+ zappPipes: {},
316
+ }),
328
317
  });
329
318
 
330
319
  // if there are no smart components, it should return the original array
@@ -366,18 +355,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
366
355
  "http://curation": { loading: false, data: { entry: mockPresetEntry } },
367
356
  };
368
357
 
369
- const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
370
- mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
371
-
372
- const mockUseLayoutPresets = jest.spyOn(
373
- layoutPresets,
374
- "useLayoutPresets"
375
- );
376
-
377
- mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
378
-
379
358
  const { result } = renderHook(() => useCurationAPI(mockComponents), {
380
- wrapper,
359
+ wrapper: getWrapper({
360
+ zappPipes: mockFeeds,
361
+ presetsMapping: {
362
+ presets_mappings: {
363
+ ...mockLayoutPresets,
364
+ },
365
+ },
366
+ }),
381
367
  });
382
368
 
383
369
  expect(result.current).toEqual(mockTransformedComponents);
@@ -437,19 +423,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
437
423
  },
438
424
  };
439
425
 
440
- // mock the hooks
441
- const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
442
- mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
443
-
444
- const mockUseLayoutPresets = jest.spyOn(
445
- layoutPresets,
446
- "useLayoutPresets"
447
- );
448
-
449
- mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
450
-
451
426
  const { result } = renderHook(() => useCurationAPI(mockComponents), {
452
- wrapper,
427
+ wrapper: getWrapper({
428
+ zappPipes: mockFeeds,
429
+ presetsMapping: {
430
+ presets_mappings: {
431
+ ...mockLayoutPresets,
432
+ },
433
+ },
434
+ }),
453
435
  });
454
436
 
455
437
  expect(result.current).toEqual(mockTransformedComponents);
@@ -495,14 +477,15 @@ describe("getTransformedPreset should return the passed components if smartCompo
495
477
  "http://curation": { loading: false, data: { entry: mockPresetEntry } },
496
478
  };
497
479
 
498
- // mock the hooks
499
- const mockUseZappPipesFeeds = jest.spyOn(pipesFeeds, "useZappPipesFeeds");
500
- mockUseZappPipesFeeds.mockReturnValue(mockFeeds);
501
- const mockUseLayoutPresets = jest.spyOn(layoutPresets, "useLayoutPresets");
502
- mockUseLayoutPresets.mockReturnValue(mockLayoutPresets);
503
-
504
480
  const { result } = renderHook(() => useCurationAPI(mockComponents), {
505
- wrapper,
481
+ wrapper: getWrapper({
482
+ zappPipes: mockFeeds,
483
+ presetsMapping: {
484
+ presets_mappings: {
485
+ ...mockLayoutPresets,
486
+ },
487
+ },
488
+ }),
506
489
  });
507
490
 
508
491
  expect(result.current).toEqual(mockTransformedComponents);
@@ -1,17 +1,18 @@
1
1
  import { all, equals, path, prop, isEmpty, pluck, values } from "ramda";
2
2
 
3
3
  import { useEffect, useMemo } from "react";
4
- import { useDispatch } from "react-redux";
5
4
 
6
5
  import {
6
+ ZappPipes,
7
+ useAppDispatch,
7
8
  useLayoutPresets,
8
- useZappPipesFeeds,
9
- } from "@applicaster/zapp-react-native-redux/hooks";
10
- import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
9
+ useZappPipesFeed,
10
+ } from "@applicaster/zapp-react-native-redux";
11
11
  import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
12
12
  import { Categories } from "./logger";
13
13
  import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
14
14
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useRoute";
15
+
15
16
  import {
16
17
  ZappPipesEntryContext,
17
18
  ZappPipesScreenContext,
@@ -26,7 +27,10 @@ import {
26
27
  import { produce } from "immer";
27
28
  // types reference
28
29
 
29
- declare type CurationEntry = { preset_name: string; feed_url: string };
30
+ declare interface CurationEntry {
31
+ preset_name: string;
32
+ feed_url: string;
33
+ }
30
34
 
31
35
  type Feeds = Record<string, ZappPipesData>;
32
36
 
@@ -122,7 +126,7 @@ export const getFinalComponents = (
122
126
  export const useCurationAPI = (
123
127
  components: Array<ZappUIComponent>
124
128
  ): ZappUIComponent[] => {
125
- const dispatch = useDispatch();
129
+ const dispatch = useAppDispatch();
126
130
 
127
131
  const smartComponents = useMemo(
128
132
  () => components?.filter?.(isSmartComponent) ?? [],
@@ -162,7 +166,7 @@ export const useCurationAPI = (
162
166
  useEffect(() => {
163
167
  urls.forEach((url, index) => {
164
168
  if (url) {
165
- dispatch(loadPipesData(url, { clearCache: false }));
169
+ dispatch(ZappPipes.loadPipesData(url, { clearCache: false }));
166
170
  } else {
167
171
  logger.log_error("Curation url is empty", {
168
172
  componentId: smartComponents?.[index]?.id,
@@ -171,7 +175,7 @@ export const useCurationAPI = (
171
175
  });
172
176
  }, [urls]);
173
177
 
174
- const feeds = useZappPipesFeeds(urls);
178
+ const feeds = useZappPipesFeed(urls);
175
179
  const layoutPresets = useLayoutPresets();
176
180
 
177
181
  const enrichedComponents = useMemo(() => {
@@ -7,12 +7,15 @@ import {
7
7
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
8
8
  import {
9
9
  useDimensions,
10
+ useIsTablet as isTablet,
10
11
  useNavigation,
11
12
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
13
 
13
14
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
15
  import { PlayerContainer } from "../PlayerContainer";
15
16
  import { useModalSize } from "../VideoModal/hooks";
17
+ import { ViewStyle } from "react-native";
18
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
16
19
 
17
20
  type Props = {
18
21
  item: ZappEntry;
@@ -83,6 +86,13 @@ type PlayableComponent = {
83
86
  Component: React.ComponentType<any>;
84
87
  };
85
88
 
89
+ const dimensionsContext: "window" | "screen" = platformSelect({
90
+ android_tv: "window",
91
+ amazon: "window",
92
+ // eslint-disable-next-line react-hooks/rules-of-hooks
93
+ default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
94
+ });
95
+
86
96
  export function HandlePlayable({
87
97
  item,
88
98
  isModal,
@@ -135,19 +145,25 @@ export function HandlePlayable({
135
145
  });
136
146
  }, [casting]);
137
147
 
138
- const { width: screenWidth, height: screenHeight } = useDimensions("window");
148
+ const { width: screenWidth, height: screenHeight } =
149
+ useDimensions(dimensionsContext);
139
150
 
140
151
  const modalSize = useModalSize();
141
152
 
142
153
  const style = React.useMemo(
143
- () => ({
144
- width: isModal ? modalSize.width : mode === "PIP" ? "100%" : screenWidth,
145
- height: isModal
146
- ? modalSize.height
147
- : mode === "PIP"
148
- ? "100%"
149
- : screenHeight,
150
- }),
154
+ () =>
155
+ ({
156
+ width: isModal
157
+ ? modalSize.width
158
+ : mode === "PIP"
159
+ ? "100%"
160
+ : screenWidth,
161
+ height: isModal
162
+ ? modalSize.height
163
+ : mode === "PIP"
164
+ ? "100%"
165
+ : screenHeight,
166
+ }) as ViewStyle,
151
167
  [screenWidth, screenHeight, modalSize, isModal, mode]
152
168
  );
153
169
 
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks/usePickFromState";
2
+ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
3
  import { getBackgroundImageUrl } from "../utils";
4
4
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
5
5
 
@@ -4,7 +4,7 @@ import * as R from "ramda";
4
4
  import { TouchableOpacity } from "react-native";
5
5
  // import { SvgUri } from "react-native-svg";
6
6
 
7
- import { connectToStore } from "@applicaster/zapp-react-native-redux";
7
+ import { connectToStore } from "@applicaster/zapp-react-native-redux/utils/connectToStore";
8
8
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
9
9
 
10
10
  import Image from "./Image";
@@ -2,7 +2,6 @@ import React, { useMemo } from "react";
2
2
  import { ImageStyle } from "react-native";
3
3
  import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
4
4
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
5
- import * as R from "ramda";
6
5
  import { getXray } from "@applicaster/zapp-react-native-utils/logger";
7
6
  import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
8
7
  import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
@@ -67,32 +66,10 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
67
66
  const handleFocus = (focusable) => {
68
67
  const focusedButtonId = getFocusedButtonId(focusable);
69
68
 
70
- wrapperRef?.current?.measure((x, y, width, height, pageX, pageY) => {
71
- const top = pageY;
72
- const bottom = top + height;
73
- const left = pageX;
74
- const right = left + width;
75
-
76
- const boundingRect = {
77
- x,
78
- y,
79
- pageX,
80
- pageY,
81
- width,
82
- height,
83
- top,
84
- bottom,
85
- left,
86
- right,
87
- };
88
-
89
- otherProps?.onToggleFocus?.({
90
- focusable: {
91
- getRect: R.always(boundingRect),
92
- },
93
- focusedButtonId,
94
- mouse: focusable.mouse,
95
- });
69
+ otherProps?.onToggleFocus?.({
70
+ focusable: wrapperRef.current,
71
+ focusedButtonId,
72
+ mouse: focusable.mouse,
96
73
  });
97
74
 
98
75
  if (ttsLabel) {
@@ -20,7 +20,7 @@ const withAppliedDimensions = (style: Style) => (source: Source) => ({
20
20
  });
21
21
 
22
22
  export const withDimensionsHOC = (Component) => {
23
- return function WithDimensions(props: { style: any }) {
23
+ return function WithDimensions(props: Record<string, unknown>) {
24
24
  const theme = useTheme<BaseThemePropertiesMobile>();
25
25
 
26
26
  const useDownScalingImages = toBooleanWithDefaultFalse(
@@ -13,7 +13,7 @@ export const ImageContainer = (props: Props) => {
13
13
  const isActive = useIsScreenActive();
14
14
 
15
15
  const Component =
16
- isVideoPreviewEnabled(props) && isActive ? LiveImage : PureImage;
16
+ isVideoPreviewEnabled(props as Props) && isActive ? LiveImage : PureImage;
17
17
 
18
18
  return <Component {...props} />;
19
19
  };
@@ -73,7 +73,6 @@ export function elementMapper(
73
73
  : {};
74
74
 
75
75
  const componentProps = {
76
- key,
77
76
  style,
78
77
  skipButtons: otherProps?.skipButtons,
79
78
  emitAsyncElementRegistrate: otherProps?.emitAsyncElementRegistrate,
@@ -91,7 +90,7 @@ export function elementMapper(
91
90
  const fn = mapElementWithKey(elementMapper(components, otherProps));
92
91
 
93
92
  return (
94
- <Component {...componentProps}>
93
+ <Component key={key} {...componentProps}>
95
94
  {focusableTypes.has(type) && elements.length > 0
96
95
  ? elements.map(fn)
97
96
  : null}
@@ -86,7 +86,7 @@ export function masterCellBuilder({
86
86
  entry: item,
87
87
  state: getEntryState(state, entryIsSelected),
88
88
  }),
89
- [state, item?.id, entryIsSelected] // Assuming that item won't mutate
89
+ [state, item, entryIsSelected] // Assuming that item won't mutate
90
90
  );
91
91
 
92
92
  const wrapperRef = React.useRef(null);