@applicaster/zapp-react-native-ui-components 15.0.0-alpha.7591121530 → 15.0.0-alpha.7607942912

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 (54) hide show
  1. package/Components/BaseFocusable/index.ios.ts +12 -2
  2. package/Components/Cell/Cell.tsx +8 -3
  3. package/Components/Cell/FocusableWrapper.tsx +3 -0
  4. package/Components/Cell/TvOSCellComponent.tsx +26 -5
  5. package/Components/Focusable/FocusableTvOS.tsx +12 -2
  6. package/Components/Focusable/__tests__/__snapshots__/FocusableTvOS.test.tsx.snap +1 -0
  7. package/Components/FocusableGroup/FocusableTvOS.tsx +11 -0
  8. package/Components/HandlePlayable/HandlePlayable.tsx +10 -7
  9. package/Components/Layout/TV/LayoutBackground.tsx +5 -2
  10. package/Components/Layout/TV/ScreenContainer.tsx +2 -6
  11. package/Components/Layout/TV/index.tsx +3 -4
  12. package/Components/Layout/TV/index.web.tsx +3 -4
  13. package/Components/LinkHandler/LinkHandler.tsx +2 -2
  14. package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
  15. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
  16. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +5 -1
  17. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +11 -3
  18. package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +9 -1
  19. package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +15 -14
  20. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +10 -6
  21. package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
  22. package/Components/MasterCell/index.tsx +2 -0
  23. package/Components/MasterCell/utils/__tests__/resolveColor.test.js +82 -3
  24. package/Components/MasterCell/utils/index.ts +61 -31
  25. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +102 -87
  26. package/Components/MeasurmentsPortal/__tests__/MeasurementsPortal.test.tsx +355 -0
  27. package/Components/OfflineHandler/NotificationView/NotificationView.tsx +2 -2
  28. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +17 -18
  29. package/Components/OfflineHandler/__tests__/index.test.tsx +27 -18
  30. package/Components/PlayerContainer/PlayerContainer.tsx +4 -3
  31. package/Components/Screen/TV/index.web.tsx +4 -2
  32. package/Components/Screen/__tests__/Screen.test.tsx +65 -42
  33. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +68 -44
  34. package/Components/Screen/hooks.ts +2 -3
  35. package/Components/Screen/index.tsx +2 -3
  36. package/Components/Screen/navigationHandler.ts +49 -24
  37. package/Components/Screen/orientationHandler.ts +3 -3
  38. package/Components/ScreenResolver/index.tsx +13 -7
  39. package/Components/ScreenRevealManager/ScreenRevealManager.ts +40 -8
  40. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +86 -69
  41. package/Components/Tabs/TV/Tabs.tsx +20 -3
  42. package/Components/Transitioner/Scene.tsx +15 -2
  43. package/Components/Transitioner/index.js +3 -3
  44. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +124 -27
  45. package/Components/VideoModal/VideoModal.tsx +1 -5
  46. package/Components/VideoModal/utils.ts +19 -9
  47. package/Decorators/Analytics/index.tsx +6 -5
  48. package/Decorators/ZappPipesDataConnector/index.tsx +2 -2
  49. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +1 -1
  50. package/Helpers/DataSourceHelper/__tests__/itemLimitForData.test.ts +80 -0
  51. package/Helpers/DataSourceHelper/index.ts +19 -0
  52. package/index.d.ts +7 -0
  53. package/package.json +6 -5
  54. package/Helpers/DataSourceHelper/index.js +0 -19
@@ -2,106 +2,123 @@ import {
2
2
  ScreenRevealManager,
3
3
  COMPONENT_LOADING_STATE,
4
4
  } from "../ScreenRevealManager";
5
+ import { Subject } from "rxjs";
6
+
7
+ jest.mock("@applicaster/zapp-react-native-utils/arrayUtils", () => ({
8
+ makeListOf: jest.fn((value: any, length: number) =>
9
+ Array(length).fill(value)
10
+ ),
11
+ }));
12
+
13
+ jest.mock("@applicaster/zapp-react-native-utils/componentsUtils", () => ({
14
+ isFirstComponentGallery: jest.fn(),
15
+ }));
16
+
17
+ jest.mock("@applicaster/zapp-react-native-utils/idleUtils", () => ({
18
+ withTimeout$: jest.fn(),
19
+ }));
20
+
21
+ import { makeListOf } from "@applicaster/zapp-react-native-utils/arrayUtils";
22
+ import { isFirstComponentGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
23
+ import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
5
24
 
6
25
  describe("ScreenRevealManager", () => {
7
- const mockCallback = jest.fn();
26
+ let mockCallback: jest.Mock;
27
+ let timeout$: Subject<void>;
8
28
 
9
29
  beforeEach(() => {
10
- jest.clearAllMocks();
11
- });
12
-
13
- it("should initialize with the correct number of components to wait for", () => {
14
- const componentsToRender: ZappUIComponent[] = [
15
- { component_type: "component1" },
16
- { component_type: "component2" },
17
- { component_type: "component3" },
18
- ];
30
+ jest.useFakeTimers();
31
+ mockCallback = jest.fn();
32
+ timeout$ = new Subject();
19
33
 
20
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
34
+ (withTimeout$ as jest.Mock).mockReturnValue(timeout$);
35
+ (isFirstComponentGallery as jest.Mock).mockReturnValue(false);
21
36
 
22
- expect(manager.numberOfComponentsWaitToLoadBeforePresent).toBe(3);
37
+ (makeListOf as jest.Mock).mockImplementation((value, length) =>
38
+ Array(length).fill(value)
39
+ );
40
+ });
23
41
 
24
- expect(manager.renderingState).toEqual([
25
- COMPONENT_LOADING_STATE.UNKNOWN,
26
- COMPONENT_LOADING_STATE.UNKNOWN,
27
- COMPONENT_LOADING_STATE.UNKNOWN,
28
- ]);
42
+ afterEach(() => {
43
+ jest.clearAllTimers();
44
+ jest.useRealTimers();
45
+ jest.resetAllMocks();
29
46
  });
30
47
 
31
- it("should call the callback when the required number of components are loaded successfully", () => {
32
- const componentsToRender: ZappUIComponent[] = [
33
- { component_type: "component1" },
34
- { component_type: "component2" },
35
- { component_type: "component3" },
36
- ];
48
+ // ────────────────────────────────────────────────
49
+ it("should initialize with correct number of components and UNKNOWN state", () => {
50
+ const components = new Array(5).fill({});
51
+ const mgr = new ScreenRevealManager(components, mockCallback);
37
52
 
38
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
53
+ expect(mgr.numberOfComponentsWaitToLoadBeforePresent).toBe(3);
54
+ expect(makeListOf).toHaveBeenCalledWith(COMPONENT_LOADING_STATE.UNKNOWN, 3);
55
+ });
39
56
 
40
- manager.onLoadFinished(0);
41
- manager.onLoadFinished(1);
42
- manager.onLoadFinished(2);
57
+ // ────────────────────────────────────────────────
58
+ it("should set numberOfComponentsWaitToLoadBeforePresent to 1 if first component is gallery", () => {
59
+ (isFirstComponentGallery as jest.Mock).mockReturnValue(true);
43
60
 
44
- expect(mockCallback).toHaveBeenCalledTimes(1);
61
+ const components = new Array(5).fill({});
62
+ const mgr = new ScreenRevealManager(components, mockCallback);
63
+
64
+ expect(mgr.numberOfComponentsWaitToLoadBeforePresent).toBe(1);
45
65
  });
46
66
 
47
- it("should call the callback when the required number of components fail to load", () => {
48
- const componentsToRender: ZappUIComponent[] = [
49
- { component_type: "component1" },
50
- { component_type: "component2" },
51
- { component_type: "component3" },
52
- ];
67
+ // ────────────────────────────────────────────────
68
+ it("should trigger callback after all components load successfully", () => {
69
+ const components = new Array(3).fill({});
70
+ const mgr = new ScreenRevealManager(components, mockCallback);
53
71
 
54
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
72
+ mgr.onLoadFinished(0);
73
+ expect(mockCallback).not.toHaveBeenCalled();
55
74
 
56
- manager.onLoadFailed(0);
57
- manager.onLoadFailed(1);
58
- manager.onLoadFailed(2);
75
+ mgr.onLoadFinished(1);
76
+ expect(mockCallback).not.toHaveBeenCalled();
59
77
 
78
+ mgr.onLoadFinished(2);
60
79
  expect(mockCallback).toHaveBeenCalledTimes(1);
61
80
  });
62
81
 
63
- it("should call the callback when a mix of successful and failed loads meet the required number", () => {
64
- const componentsToRender: ZappUIComponent[] = [
65
- { component_type: "component1" },
66
- { component_type: "component2" },
67
- { component_type: "component3" },
68
- ];
69
-
70
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
82
+ // ────────────────────────────────────────────────
83
+ it("should trigger callback after some components fail to load but all finished", () => {
84
+ const components = new Array(3).fill({});
85
+ const mgr = new ScreenRevealManager(components, mockCallback);
71
86
 
72
- manager.onLoadFinished(0);
73
- manager.onLoadFailed(1);
74
- manager.onLoadFinished(2);
87
+ mgr.onLoadFinished(0);
88
+ mgr.onLoadFailed(1);
89
+ mgr.onLoadFailed(2);
75
90
 
76
91
  expect(mockCallback).toHaveBeenCalledTimes(1);
77
92
  });
78
93
 
79
- it("should not call the callback if the required number of components are not loaded", () => {
80
- const componentsToRender: ZappUIComponent[] = [
81
- { component_type: "component1" },
82
- { component_type: "component2" },
83
- { component_type: "component3" },
84
- ];
85
-
86
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
94
+ // ────────────────────────────────────────────────
95
+ it("should not trigger callback twice when same component finishes twice", () => {
96
+ const components = new Array(3).fill({});
97
+ const mgr = new ScreenRevealManager(components, mockCallback);
87
98
 
88
- manager.onLoadFinished(0);
89
- manager.onLoadFailed(1);
99
+ mgr.onLoadFinished(0);
100
+ mgr.onLoadFinished(0); // duplicate
101
+ mgr.onLoadFinished(1);
102
+ mgr.onLoadFinished(2);
90
103
 
91
- expect(mockCallback).not.toHaveBeenCalled();
104
+ expect(mockCallback).toHaveBeenCalledTimes(1);
92
105
  });
93
106
 
94
- it("should call the callback when the when first component is gallery and it was loaded successfully", () => {
95
- const componentsToRender: ZappUIComponent[] = [
96
- { component_type: "gallery-qb" },
97
- { component_type: "component2" },
98
- { component_type: "component3" },
99
- ];
107
+ // ────────────────────────────────────────────────
108
+ it("should trigger callback when timeout$ emits before all loaded", () => {
109
+ const components = new Array(3).fill({});
110
+ new ScreenRevealManager(components, mockCallback);
100
111
 
101
- const manager = new ScreenRevealManager(componentsToRender, mockCallback);
102
-
103
- manager.onLoadFinished(0);
112
+ timeout$.next(); // simulate timeout event from withTimeout$
104
113
 
105
114
  expect(mockCallback).toHaveBeenCalledTimes(1);
106
115
  });
116
+
117
+ // ────────────────────────────────────────────────
118
+ it("should not call callback if nothing loads and no timeout emitted", () => {
119
+ const components = new Array(3).fill({});
120
+ new ScreenRevealManager(components, mockCallback);
121
+
122
+ expect(mockCallback).not.toHaveBeenCalled();
123
+ });
107
124
  });
@@ -8,6 +8,7 @@ import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
8
8
  import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
9
9
  import { FocusableGroup } from "@applicaster/zapp-react-native-ui-components/Components/FocusableGroup";
10
10
  import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
11
+ import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
11
12
  import { Gutter } from "../Gutter";
12
13
  import Tab from "./Tab";
13
14
  import { getStyles } from "./styles";
@@ -28,11 +29,14 @@ const TabsComponent = ({
28
29
  style,
29
30
  selectedEntryIndex,
30
31
  setSelectedEntry,
32
+ accessibility,
31
33
  }: TabsProps & Partial<TabsSelectionContextType>) => {
32
34
  const configuration = useConfiguration();
33
35
  const config = applyFontConfig(configuration);
34
36
  const styles = useMemo(() => getStyles(config), [config]);
35
37
 
38
+ const accessibilityManager = useAccessibilityManager({});
39
+
36
40
  const {
37
41
  tab_bar_gutter: horizontalGutter,
38
42
  tab_bar_background_image: bgImage,
@@ -60,10 +64,20 @@ const TabsComponent = ({
60
64
  );
61
65
 
62
66
  const onListElementFocus = useCallback(
63
- (index) => {
67
+ (index, isSelected: boolean, item: ZappEntry) => {
68
+ if (isSelected) {
69
+ accessibilityManager.readText({
70
+ text: `${accessibility?.selectedHint} ${item.title}`,
71
+ });
72
+ } else {
73
+ accessibilityManager.readText({
74
+ text: `${accessibility?.hint} ${item.title}`,
75
+ });
76
+ }
77
+
64
78
  scrollToSelectedIndex(index, VIEW_POSITION);
65
79
  },
66
- [scrollToSelectedIndex]
80
+ [scrollToSelectedIndex, accessibility]
67
81
  );
68
82
 
69
83
  const renderItem = useCallback(
@@ -94,7 +108,7 @@ const TabsComponent = ({
94
108
  id={itemId}
95
109
  testID={itemId}
96
110
  preferredFocus={isSelected}
97
- onFocus={() => onListElementFocus(index)}
111
+ onFocus={() => onListElementFocus(index, isSelected, item)}
98
112
  onPress={() => setSelectedEntry && setSelectedEntry(item)}
99
113
  style={style}
100
114
  >
@@ -149,6 +163,9 @@ const TabsComponent = ({
149
163
  shouldUsePreferredFocus
150
164
  isWithMemory={false}
151
165
  nextFocusDown={parentFocus?.nextFocusDown}
166
+ onFocus={() => {
167
+ accessibilityManager.addHeading(accessibility?.announcement);
168
+ }}
152
169
  >
153
170
  <View style={tabs}>
154
171
  <ImageBackground
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import { equals } from "ramda";
3
3
  import { Animated, ViewProps, ViewStyle } from "react-native";
4
4
  import { useSafeAreaFrame } from "react-native-safe-area-context";
@@ -95,9 +95,22 @@ function SceneComponent({
95
95
  });
96
96
 
97
97
  const frame = useSafeAreaFrame();
98
+
99
+ const [memoFrame, setMemoFrame] = React.useState(frame);
100
+
101
+ useEffect(() => {
102
+ if (isActive) {
103
+ setMemoFrame((oldFrame) =>
104
+ oldFrame.width === frame.width && oldFrame.height === frame.height
105
+ ? oldFrame
106
+ : frame
107
+ );
108
+ }
109
+ }, [isActive, frame.width, frame.height]);
110
+
98
111
  const isAnimating = animating && overlayStyle;
99
112
 
100
- const dimensions = isAnimating ? fullWidthDimensions : frame;
113
+ const dimensions = isAnimating ? fullWidthDimensions : memoFrame;
101
114
 
102
115
  return (
103
116
  <Animated.View
@@ -1,7 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
3
3
  import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
+ import { useAppData } from "@applicaster/zapp-react-native-redux";
5
+
5
6
  import { TransitionerComponent } from "./Transitioner";
6
7
 
7
8
  export const Transitioner = (props) => {
@@ -16,8 +17,7 @@ export const Transitioner = (props) => {
16
17
  deviceInfo: true,
17
18
  });
18
19
 
19
- const { appData } = usePickFromState(["appData"]);
20
- const isTabletPortrait = appData?.isTabletPortrait;
20
+ const { isTabletPortrait } = useAppData();
21
21
 
22
22
  return (
23
23
  <TransitionerComponent
@@ -1,62 +1,159 @@
1
- import React, { useEffect, useMemo } from "react";
1
+ import React, { useMemo } from "react";
2
2
  import { Animated, Dimensions } from "react-native";
3
3
 
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
5
5
 
6
6
  import { useConfiguration } from "../utils";
7
- import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
7
+ import {
8
+ useAppData,
9
+ usePlugins,
10
+ } from "@applicaster/zapp-react-native-redux/hooks";
11
+ import { isBottomTabVisible } from "../../Screen/navigationHandler";
12
+
13
+ import {
14
+ useSafeAreaFrame,
15
+ useSafeAreaInsets,
16
+ } from "react-native-safe-area-context";
17
+ import {
18
+ isAndroidPlatform,
19
+ isAndroidVersionAtLeast,
20
+ } from "@applicaster/zapp-react-native-utils/reactUtils";
21
+ import { getTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/getTabBarHeight";
22
+ import { PROGRESS_BAR_HEIGHT } from "./utils";
23
+ import { useIsTablet as getIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
8
24
 
9
25
  export type ModalAnimationContextT = {
10
- yTranslate: React.MutableRefObject<Animated.Value | null>;
26
+ yTranslate: React.MutableRefObject<Animated.AnimatedInterpolation<number>>;
27
+ offsetAnimatedValueRef: React.MutableRefObject<Animated.Value>;
28
+ offset: React.MutableRefObject<number>;
29
+ heightAboveMinimised: number;
30
+ gestureTranslationRef: React.MutableRefObject<Animated.Value>;
11
31
  minimisedHeight: number;
12
32
  };
13
33
 
14
34
  export const ReactContext = React.createContext<ModalAnimationContextT>({
15
35
  yTranslate: React.createRef<Animated.Value | null>(),
36
+ offsetAnimatedValueRef: React.createRef<Animated.Value>(),
37
+ offset: React.createRef<number>(),
38
+ heightAboveMinimised: 0,
39
+ gestureTranslationRef: React.createRef<Animated.Value>(),
16
40
  minimisedHeight: 60,
17
41
  });
18
42
 
43
+ const SAFE_AREA_BREAKING_API_VERSION = 35;
44
+
45
+ export const isOldAndroidDevice =
46
+ isAndroidPlatform() &&
47
+ !isAndroidVersionAtLeast(SAFE_AREA_BREAKING_API_VERSION);
48
+
49
+ const bottomTabBarHeight = getTabBarHeight();
50
+
19
51
  const Provider = ({ children }: { children: React.ReactNode }) => {
52
+ const { height } = Dimensions.get("window");
53
+
20
54
  const yTranslate = React.useRef(
21
- new Animated.Value(Dimensions.get("window").height)
55
+ new Animated.Value(height).interpolate<number>({
56
+ inputRange: [0, height],
57
+ outputRange: [0, height],
58
+ })
22
59
  );
23
60
 
61
+ const { minimised_height: minimisedHeight } = useConfiguration();
62
+
24
63
  const {
25
- videoModalState: { visible },
64
+ videoModalState: { visible, mode },
65
+ currentRoute,
66
+ screenData,
26
67
  } = useNavigation();
27
68
 
28
- const { minimised_height: minimisedHeight } = useConfiguration();
69
+ const { isTabletPortrait } = useAppData();
70
+
71
+ const plugins = usePlugins();
72
+
73
+ const bottomTabsVisible = isBottomTabVisible(
74
+ currentRoute,
75
+ screenData,
76
+ plugins
77
+ );
78
+
79
+ const frame = useSafeAreaFrame();
80
+ const insets = useSafeAreaInsets();
81
+
82
+ const [heightAboveMinimised, setHeightAboveMinimised] = React.useState(0);
83
+
84
+ // memoizing heightAboveMinimised value
85
+ const offset = React.useRef(heightAboveMinimised);
86
+
87
+ // Used for memoizing modal y position after start/end of transition
88
+ const offsetAnimatedValueRef = React.useRef(
89
+ new Animated.Value(-offset.current)
90
+ );
91
+
92
+ // Used for gesture handling
93
+ const gestureTranslationRef = React.useRef(new Animated.Value(0));
94
+
95
+ const videoModalStateRef = React.useRef({ visible, mode });
96
+
97
+ React.useEffect(() => {
98
+ videoModalStateRef.current = { visible, mode };
99
+ }, [visible, mode]);
100
+
101
+ const translateY = useMemo(() => {
102
+ const maxRange = heightAboveMinimised;
103
+
104
+ const combined: Animated.AnimatedAddition<number> = Animated.add(
105
+ offsetAnimatedValueRef.current,
106
+ gestureTranslationRef.current
107
+ );
108
+
109
+ return combined.interpolate({
110
+ inputRange: [0, maxRange],
111
+ outputRange: [0, maxRange],
112
+ extrapolate: "clamp",
113
+ });
114
+ }, [visible, heightAboveMinimised]);
115
+
116
+ offset.current = heightAboveMinimised;
117
+ yTranslate.current = translateY;
118
+
119
+ React.useEffect(() => {
120
+ const collapsedHeight =
121
+ minimisedHeight +
122
+ (bottomTabsVisible ? bottomTabBarHeight : 0) +
123
+ (isOldAndroidDevice ? 0 : insets.bottom) + // insets.bottom is added to properly display docked modal
124
+ PROGRESS_BAR_HEIGHT;
125
+
126
+ const heightAboveMinimised = frame.height - collapsedHeight;
127
+
128
+ const isLandscape = frame.width > frame.height;
129
+
130
+ const isTablet = getIsTablet();
131
+
132
+ const shouldIgnoreLandscape = isTablet ? isTabletPortrait : true;
29
133
 
30
- const isTabletLandscape = useIsTabletLandscape();
31
- const windowDimensions = Dimensions.get("window");
32
-
33
- useEffect(() => {
34
- // Reset player animation state when video modal is closed
35
- if (!visible) {
36
- if (!isTabletLandscape) {
37
- // restore to portrait ( in portrait mode height is bigger)
38
- if (windowDimensions.height > windowDimensions.width) {
39
- yTranslate.current?.setValue(windowDimensions.height);
40
- }
41
- } else {
42
- yTranslate.current?.setValue(windowDimensions.height);
43
- }
134
+ if (
135
+ heightAboveMinimised !== offset.current &&
136
+ videoModalStateRef.current.mode !== "PIP" &&
137
+ videoModalStateRef.current.mode !== "FULLSCREEN"
138
+ ) {
139
+ if (isLandscape && shouldIgnoreLandscape) return;
140
+ setHeightAboveMinimised(heightAboveMinimised);
141
+ offset.current = heightAboveMinimised;
44
142
  }
45
- }, [
46
- visible,
47
- windowDimensions.height,
48
- isTabletLandscape,
49
- windowDimensions.width,
50
- ]);
143
+ }, [frame.height, insets.bottom, bottomTabsVisible, minimisedHeight]);
51
144
 
52
145
  return (
53
146
  <ReactContext.Provider
54
147
  value={useMemo(
55
148
  () => ({
56
149
  yTranslate,
150
+ offsetAnimatedValueRef,
151
+ offset,
152
+ heightAboveMinimised,
57
153
  minimisedHeight,
154
+ gestureTranslationRef,
58
155
  }),
59
- [minimisedHeight]
156
+ [minimisedHeight, heightAboveMinimised]
60
157
  )}
61
158
  >
62
159
  {children}
@@ -139,11 +139,7 @@ const VideoModalComponent = () => {
139
139
 
140
140
  {itemIdHooksFinished === item?.id ? (
141
141
  <View pointerEvents="box-none" style={styles.container}>
142
- <HandlePlayable
143
- item={item}
144
- isModal={mode !== "PIP"}
145
- mode={mode}
146
- />
142
+ <HandlePlayable item={item} isModal mode={mode} />
147
143
  </View>
148
144
  ) : (
149
145
  <View style={styles.loaderContainer}>
@@ -1,31 +1,35 @@
1
1
  import { mergeRight } from "ramda";
2
2
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
3
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
3
+ import {
4
+ useAppSelector,
5
+ useContentTypes,
6
+ } from "@applicaster/zapp-react-native-redux/hooks";
4
7
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
5
8
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
6
9
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
10
+ import { create } from "zustand";
11
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
12
+ import { selectPluginConfigurationsByPluginId } from "@applicaster/zapp-react-native-redux";
7
13
 
8
14
  export const useConfiguration = () => {
9
15
  const {
10
16
  videoModalState: { item },
11
17
  } = useNavigation();
12
18
 
13
- const { rivers, contentTypes, pluginConfigurations } = usePickFromState([
14
- "rivers",
15
- "contentTypes",
16
- "pluginConfigurations",
17
- ]);
19
+ const rivers = useRivers();
20
+ const contentTypes = useContentTypes();
18
21
 
19
22
  const targetScreenId = contentTypes?.[item?.type?.value]?.screen_id;
20
23
  const targetScreenConfiguration = rivers?.[targetScreenId];
21
24
 
22
- const pluginConfiguration =
23
- pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
25
+ const { configuration_json } = useAppSelector((state) =>
26
+ selectPluginConfigurationsByPluginId(state, targetScreenConfiguration?.type)
27
+ );
24
28
 
25
29
  const playerPluginConfig = playerManager.getPluginConfiguration();
26
30
 
27
31
  const config = mergeRight(playerPluginConfig, {
28
- ...pluginConfiguration,
32
+ ...configuration_json,
29
33
  ...targetScreenConfiguration?.general,
30
34
  ...targetScreenConfiguration?.styles,
31
35
  });
@@ -52,6 +56,12 @@ export const useConfiguration = () => {
52
56
  };
53
57
  };
54
58
 
59
+ export const useAnimationStateStore = create<{
60
+ isAnimationInProgress: boolean;
61
+ }>(() => ({
62
+ isAnimationInProgress: false,
63
+ }));
64
+
55
65
  const fullSize = {
56
66
  width: "100%",
57
67
  height: "100%",
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
 
3
3
  import { getAnalyticsFunctions } from "@applicaster/zapp-react-native-utils/analyticsUtils";
4
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
4
 
6
5
  type ComponentProps = {
7
6
  component: {
@@ -21,11 +20,13 @@ type ComponentProps = {
21
20
 
22
21
  function withAnalytics(Component) {
23
22
  return function WithAnalytics(props: ComponentProps) {
24
- const { appData } = usePickFromState(["appData"]);
25
-
26
23
  const analyticsFunctions = React.useMemo(
27
- () => getAnalyticsFunctions({ props, appData }),
28
- [props, appData]
24
+ () =>
25
+ getAnalyticsFunctions({
26
+ component: props.component,
27
+ zappPipesData: props.zappPipesData,
28
+ } as any),
29
+ [props.component, props.zappPipesData]
29
30
  );
30
31
 
31
32
  return (
@@ -2,7 +2,7 @@
2
2
  /// <reference types="@applicaster/zapp-react-native-ui-components" />
3
3
  import React from "react";
4
4
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
5
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
+ import { usePlugins } from "@applicaster/zapp-react-native-redux/hooks";
6
6
  import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
7
7
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
8
8
  import { ResolverSelector } from "./ResolverSelector";
@@ -23,7 +23,7 @@ export function zappPipesDataConnector(
23
23
  ) {
24
24
  return function WrappedWithZappPipesData(props: Props) {
25
25
  const { screenData } = useRoute();
26
- const { plugins } = usePickFromState(["plugins"]);
26
+ const plugins = usePlugins();
27
27
  const screenContextData = useScreenContext();
28
28
 
29
29
  const {
@@ -76,7 +76,7 @@ export function StaticFeedResolver({
76
76
 
77
77
  const zappPipesDataProps = useMemo(
78
78
  () => ({
79
- zappPipesData: { url, loading, data, error },
79
+ zappPipesData: { url, loading, data, error }, // todo: add applyItemLimit
80
80
  reloadData,
81
81
  loadNextData: undefined, // Static resolver doesn't support pagination
82
82
  }),