@applicaster/zapp-react-native-ui-components 14.0.0-alpha.8387612031 → 14.0.0-alpha.8557119261

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 (124) hide show
  1. package/Components/AnimatedInOut/index.tsx +5 -3
  2. package/Components/AudioPlayer/mobile/Layout.tsx +7 -4
  3. package/Components/AudioPlayer/mobile/__tests__/__snapshots__/audioPlayerMobileLayout.test.js.snap +1 -1
  4. package/Components/AudioPlayer/mobile/__tests__/audioPlayerMobileLayout.test.js +1 -1
  5. package/Components/AudioPlayer/mobile/index.tsx +7 -12
  6. package/Components/AudioPlayer/tv/Artwork.tsx +3 -2
  7. package/Components/AudioPlayer/tv/Channel.tsx +7 -7
  8. package/Components/AudioPlayer/tv/Layout.tsx +100 -93
  9. package/Components/AudioPlayer/tv/Runtime.tsx +7 -1
  10. package/Components/AudioPlayer/tv/Summary.tsx +6 -2
  11. package/Components/AudioPlayer/tv/Title.tsx +6 -2
  12. package/Components/AudioPlayer/tv/__tests__/__snapshots__/Runtime.test.js.snap +2 -2
  13. package/Components/AudioPlayer/tv/__tests__/__snapshots__/audioPlayer.test.js.snap +21 -27
  14. package/Components/AudioPlayer/tv/__tests__/__snapshots__/channel.test.js.snap +8 -17
  15. package/Components/AudioPlayer/tv/__tests__/__snapshots__/summary.test.js.snap +1 -2
  16. package/Components/AudioPlayer/tv/__tests__/__snapshots__/title.test.js.snap +1 -2
  17. package/Components/AudioPlayer/tv/__tests__/audioPlayer.test.js +4 -0
  18. package/Components/AudioPlayer/tv/helpers.tsx +10 -3
  19. package/Components/AudioPlayer/tv/index.tsx +9 -11
  20. package/Components/BaseFocusable/index.tsx +23 -12
  21. package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
  22. package/Components/Cell/index.js +7 -3
  23. package/Components/ComponentResolver/index.ts +1 -1
  24. package/Components/FeedLoader/FeedLoader.tsx +6 -15
  25. package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
  26. package/Components/FeedLoader/index.js +2 -8
  27. package/Components/Focusable/Focusable.tsx +5 -3
  28. package/Components/Focusable/FocusableTvOS.tsx +3 -3
  29. package/Components/Focusable/FocusableiOS.tsx +2 -2
  30. package/Components/Focusable/__tests__/index.android.test.tsx +3 -0
  31. package/Components/Focusable/index.android.tsx +12 -8
  32. package/Components/Focusable/index.tsx +1 -1
  33. package/Components/FocusableList/index.tsx +4 -0
  34. package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
  35. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +42 -59
  36. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +13 -10
  37. package/Components/HandlePlayable/HandlePlayable.tsx +25 -9
  38. package/Components/Layout/TV/LayoutBackground.tsx +1 -1
  39. package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
  40. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
  41. package/Components/MasterCell/DefaultComponents/Button.tsx +1 -1
  42. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -27
  43. package/Components/MasterCell/DefaultComponents/Image/hoc/withDimensions.tsx +1 -1
  44. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +1 -1
  45. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
  46. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
  47. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
  48. package/Components/MasterCell/elementMapper.tsx +1 -2
  49. package/Components/MasterCell/index.tsx +1 -1
  50. package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
  51. package/Components/MasterCell/utils/index.ts +11 -5
  52. package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +13 -18
  53. package/Components/OfflineHandler/__tests__/__snapshots__/index.test.tsx.snap +9 -0
  54. package/Components/OfflineHandler/__tests__/index.test.tsx +26 -35
  55. package/Components/PlayerContainer/ErrorDisplay/index.ts +1 -1
  56. package/Components/PlayerContainer/PlayerContainer.tsx +41 -28
  57. package/Components/PlayerContainer/ProgramInfo/index.tsx +1 -1
  58. package/Components/PlayerContainer/index.ts +1 -1
  59. package/Components/River/ComponentsMap/ComponentsMap.tsx +0 -1
  60. package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +378 -0
  61. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +2 -2
  62. package/Components/River/RefreshControl.tsx +11 -17
  63. package/Components/River/TV/River.tsx +2 -17
  64. package/Components/River/TV/index.tsx +3 -1
  65. package/Components/River/TV/withPipesV1DataLoader.tsx +43 -0
  66. package/Components/River/TV/withRiverDataLoader.tsx +17 -0
  67. package/Components/River/TV/withTVEventHandler.tsx +1 -1
  68. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +2 -0
  69. package/Components/River/__tests__/river.test.js +12 -26
  70. package/Components/River/index.tsx +1 -1
  71. package/Components/Screen/__tests__/Screen.test.tsx +28 -29
  72. package/Components/ScreenRevealManager/ScreenRevealManager.ts +76 -0
  73. package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +107 -0
  74. package/Components/ScreenRevealManager/__tests__/withScreenRevealManager.test.tsx +96 -0
  75. package/Components/ScreenRevealManager/index.ts +1 -0
  76. package/Components/ScreenRevealManager/withScreenRevealManager.tsx +79 -0
  77. package/Components/Tabs/TV/Tabs.android.tsx +0 -2
  78. package/Components/Tabs/Tabs.tsx +2 -3
  79. package/Components/Touchable/__tests__/__snapshots__/touchable.test.tsx.snap +34 -0
  80. package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
  81. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +15 -9
  82. package/Components/VideoLive/animationUtils.ts +3 -3
  83. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +3 -9
  84. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -8
  85. package/Components/VideoModal/PlayerDetails.tsx +24 -2
  86. package/Components/VideoModal/PlayerWrapper.tsx +26 -142
  87. package/Components/VideoModal/VideoModal.tsx +3 -17
  88. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
  89. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
  90. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
  91. package/Components/VideoModal/hooks/index.ts +0 -2
  92. package/Components/VideoModal/hooks/useModalSize.ts +18 -2
  93. package/Components/VideoModal/utils.ts +6 -0
  94. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -16
  95. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +84 -24
  96. package/Components/Viewport/VisibilitySensor/VisibilitySensor.tsx +3 -3
  97. package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/index.ts +3 -3
  98. package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
  99. package/Contexts/ScreenContext/index.tsx +46 -6
  100. package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
  101. package/Decorators/ConfigurationWrapper/withConfigurationProvider.tsx +2 -2
  102. package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
  103. package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
  104. package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
  105. package/Decorators/RiverFeedLoader/index.tsx +22 -4
  106. package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
  107. package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +3 -6
  108. package/Decorators/ZappPipesDataConnector/ResolverSelector.tsx +25 -0
  109. package/Decorators/ZappPipesDataConnector/__tests__/NullFeedResolver.test.tsx +78 -0
  110. package/Decorators/ZappPipesDataConnector/__tests__/ResolverSelector.test.tsx +205 -0
  111. package/Decorators/ZappPipesDataConnector/__tests__/StaticFeedResolver.test.tsx +251 -0
  112. package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
  113. package/Decorators/ZappPipesDataConnector/__tests__/utils.test.ts +39 -0
  114. package/Decorators/ZappPipesDataConnector/index.tsx +26 -293
  115. package/Decorators/ZappPipesDataConnector/resolvers/NullFeedResolver.tsx +25 -0
  116. package/Decorators/ZappPipesDataConnector/resolvers/StaticFeedResolver.tsx +87 -0
  117. package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +266 -0
  118. package/Decorators/ZappPipesDataConnector/types.ts +29 -0
  119. package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
  120. package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +157 -0
  121. package/events/index.ts +1 -0
  122. package/package.json +5 -10
  123. package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
  124. package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
@@ -0,0 +1,79 @@
1
+ import * as React from "react";
2
+ import { Animated } from "react-native";
3
+ import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
4
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
+ import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
6
+
7
+ import { ScreenRevealManager } from "./ScreenRevealManager";
8
+
9
+ const flex = platformSelect({
10
+ tvos: 1,
11
+ android_tv: 1,
12
+ web: undefined,
13
+ samsung_tv: undefined,
14
+ lg_tv: undefined,
15
+ default: undefined,
16
+ });
17
+
18
+ export const TIMEOUT = 500; // 500 ms
19
+
20
+ const HIDDEN = 0; // opacity = 0
21
+
22
+ export const SHOWN = 1; // opacity = 1
23
+
24
+ type Props = {
25
+ componentsToRender: ZappUIComponent[];
26
+ };
27
+
28
+ export const withScreenRevealManager = (Component) => {
29
+ return function WithScreenRevealManager(props: Props) {
30
+ const { componentsToRender } = props;
31
+
32
+ const [isReadyToShow, setIsReadyToShow] = React.useState(false);
33
+
34
+ const handleSetIsReadyToShow = React.useCallback(() => {
35
+ setIsReadyToShow(true);
36
+ }, []);
37
+
38
+ const managerRef = useRefWithInitialValue<ScreenRevealManager>(
39
+ () => new ScreenRevealManager(componentsToRender, handleSetIsReadyToShow)
40
+ );
41
+
42
+ const opacityRef = useRefWithInitialValue<Animated.Value>(
43
+ () => new Animated.Value(HIDDEN)
44
+ );
45
+
46
+ React.useEffect(() => {
47
+ if (isReadyToShow) {
48
+ Animated.timing(opacityRef.current, {
49
+ toValue: SHOWN,
50
+ duration: TIMEOUT,
51
+ useNativeDriver: true,
52
+ }).start();
53
+ }
54
+ }, [isReadyToShow]);
55
+
56
+ if (isFirstComponentScreenPicker(componentsToRender)) {
57
+ // for screen-picker with have additional internal ComponentsMap, no need to add this wrapper
58
+ return <Component {...props} />;
59
+ }
60
+
61
+ return (
62
+ <Animated.View
63
+ style={{ opacity: opacityRef.current, flex }}
64
+ testID="animated-component"
65
+ >
66
+ <Component
67
+ {...props}
68
+ initialNumberToLoad={
69
+ managerRef.current.numberOfComponentsWaitToLoadBeforePresent
70
+ }
71
+ onLoadFinishedFromScreenRevealManager={
72
+ managerRef.current.onLoadFinished
73
+ }
74
+ onLoadFailedFromScreenRevealManager={managerRef.current.onLoadFailed}
75
+ />
76
+ </Animated.View>
77
+ );
78
+ };
79
+ };
@@ -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}
@@ -158,12 +158,11 @@ const TabsComponent = ({
158
158
 
159
159
  const renderItem = React.useCallback(
160
160
  ({ item, index, item: { id } }: RenderItemProps) => (
161
- <>
161
+ <React.Fragment key={id}>
162
162
  <Tab
163
163
  ref={(ref) => {
164
164
  tabRefs.current[index] = ref;
165
165
  }}
166
- key={id}
167
166
  {...{
168
167
  title: getTitle(item),
169
168
  id,
@@ -177,7 +176,7 @@ const TabsComponent = ({
177
176
  {display_mode === "fractional" &&
178
177
  index !== tabs?.length - 1 &&
179
178
  renderGutter()}
180
- </>
179
+ </React.Fragment>
181
180
  ),
182
181
  [tabs, display_mode, configuration, onTabPress, getTitle, getSelectedItem]
183
182
  );
@@ -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}
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { View, TouchableOpacity } from "react-native";
3
- import { create, act } from "react-test-renderer";
3
+ import { render } from "@testing-library/react-native";
4
4
 
5
5
  import { Touchable } from "..";
6
6
 
@@ -23,38 +23,31 @@ describe("<Touchable />", () => {
23
23
  });
24
24
 
25
25
  it("has accessible flag set to false", () => {
26
- let wrapper;
26
+ const { toJSON, UNSAFE_getByType } = render(<Touchable {...props} />);
27
27
 
28
- act(() => {
29
- wrapper = create(<Touchable {...props} />);
30
- });
31
-
32
- const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
33
- expect(wrapper.toJSON()).toMatchSnapshot();
28
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
29
+ expect(toJSON()).toMatchSnapshot();
34
30
  expect(touchableWrapper.props).toHaveProperty("accessible", false);
35
31
  });
36
32
  });
37
33
 
38
34
  describe("when not running in automated tests environment", () => {
39
- let wrapper;
40
-
41
- act(() => {
42
- wrapper = create(<Touchable {...props} />);
43
- });
44
-
45
- const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
46
-
47
35
  beforeEach(props.onPress.mockClear);
48
36
 
49
37
  it("renders correctly", () => {
50
- expect(wrapper.toJSON()).toMatchSnapshot();
38
+ const { toJSON } = render(<Touchable {...props} />);
39
+ expect(toJSON()).toMatchSnapshot();
51
40
  });
52
41
 
53
42
  it("has accessible flag set to true", () => {
43
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
44
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
54
45
  expect(touchableWrapper.props).toHaveProperty("accessible", true);
55
46
  });
56
47
 
57
48
  it("assigns testID and accessibilityLabel props correctly", () => {
49
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
50
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
58
51
  expect(touchableWrapper.props).toHaveProperty("testID", props.testID);
59
52
 
60
53
  expect(touchableWrapper.props).toHaveProperty(
@@ -64,6 +57,8 @@ describe("<Touchable />", () => {
64
57
  });
65
58
 
66
59
  it("calls the onPress event when it is pressed", () => {
60
+ const { UNSAFE_getByType } = render(<Touchable {...props} />);
61
+ const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
67
62
  touchableWrapper.props.onPress();
68
63
  expect(props.onPress).toHaveBeenCalledTimes(1);
69
64
  });
@@ -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],
@@ -1,9 +1,8 @@
1
1
  import React from "react";
2
- import { Animated, Platform, StyleSheet, View } from "react-native";
2
+ import { Animated, StyleSheet, View } from "react-native";
3
3
 
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import {
6
- GestureHandlerRootView,
7
6
  NativeViewGestureHandler,
8
7
  PanGestureHandler,
9
8
  State,
@@ -357,15 +356,10 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
357
356
  };
358
357
  }, [playerAnimationState, isAudioItem, isMinimizedModal]);
359
358
 
360
- const Wrapper = React.useMemo(
361
- () => (Platform.OS === "android" ? GestureHandlerRootView : View),
362
- []
363
- );
364
-
365
359
  const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
366
360
 
367
361
  return (
368
- <Wrapper style={generalStyles.container}>
362
+ <View style={generalStyles.container}>
369
363
  <TapGestureHandler
370
364
  maxDurationMs={100000}
371
365
  ref={tapHandlerRef}
@@ -405,7 +399,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
405
399
  </PanGestureHandler>
406
400
  </View>
407
401
  </TapGestureHandler>
408
- </Wrapper>
402
+ </View>
409
403
  );
410
404
  };
411
405
 
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from "react";
2
- import { Animated } from "react-native";
2
+ import { Animated, Dimensions } from "react-native";
3
3
 
4
4
  import {
5
5
  useSafeAreaInsets,
@@ -11,6 +11,7 @@ import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
11
11
 
12
12
  import { PROGRESS_BAR_HEIGHT } from "./utils";
13
13
  import { useConfiguration } from "../utils";
14
+ import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
14
15
 
15
16
  export enum PlayerAnimationStateEnum {
16
17
  minimize = "minimize",
@@ -23,6 +24,7 @@ export enum PlayerAnimationStateEnum {
23
24
  export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
24
25
 
25
26
  export type ModalAnimationContextT = {
27
+ yTranslate: React.MutableRefObject<Animated.Value | null>;
26
28
  isActiveGesture: boolean;
27
29
  playerAnimationState: PlayerAnimationStateT;
28
30
  setPlayerAnimationState: (value: PlayerAnimationStateT) => void;
@@ -48,6 +50,7 @@ export type ModalAnimationContextT = {
48
50
  };
49
51
 
50
52
  export const ReactContext = React.createContext<ModalAnimationContextT>({
53
+ yTranslate: React.createRef<Animated.Value | null>(),
51
54
  isActiveGesture: false,
52
55
  playerAnimationState: null,
53
56
  setPlayerAnimationState: () => null,
@@ -73,6 +76,10 @@ export const ReactContext = React.createContext<ModalAnimationContextT>({
73
76
  });
74
77
 
75
78
  const Provider = ({ children }: { children: React.ReactNode }) => {
79
+ const yTranslate = React.useRef(
80
+ new Animated.Value(Dimensions.get("window").height)
81
+ );
82
+
76
83
  const [playerAnimationState, setPlayerAnimationState] =
77
84
  React.useState<PlayerAnimationStateT>(null);
78
85
 
@@ -96,13 +103,6 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
96
103
  setStartComponentsAnimation(false);
97
104
  }, []);
98
105
 
99
- useEffect(() => {
100
- // Reset player animation state when video modal is closed
101
- if (!visible) {
102
- resetPlayerAnimationState();
103
- }
104
- }, [visible, resetPlayerAnimationState]);
105
-
106
106
  // Animated values
107
107
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
108
108
  const dragScrollY = React.useRef(new Animated.Value(0)).current;
@@ -115,6 +115,29 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
115
115
  const { bottom: bottomSafeArea } = useSafeAreaInsets();
116
116
  const bottomTabBarHeight = useGetBottomTabBarHeight();
117
117
  const startComponentsAnimationDistance = Math.round((height * 60) / 100);
118
+ const isTabletLandscape = useIsTabletLandscape();
119
+ const windowDimensions = Dimensions.get("window");
120
+
121
+ useEffect(() => {
122
+ // Reset player animation state when video modal is closed
123
+ if (!visible) {
124
+ resetPlayerAnimationState();
125
+
126
+ if (!isTabletLandscape) {
127
+ // restore to portrait ( in portrait mode height is bigger)
128
+ if (windowDimensions.height > windowDimensions.width) {
129
+ yTranslate.current?.setValue(windowDimensions.height);
130
+ }
131
+ } else {
132
+ yTranslate.current?.setValue(windowDimensions.height);
133
+ }
134
+ }
135
+ }, [
136
+ visible,
137
+ resetPlayerAnimationState,
138
+ windowDimensions.height,
139
+ isTabletLandscape,
140
+ ]);
118
141
 
119
142
  React.useEffect(() => {
120
143
  if (visible && mode === "MAXIMIZED" && height !== safeAreaFrameHeight) {
@@ -141,6 +164,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
141
164
  return (
142
165
  <ReactContext.Provider
143
166
  value={{
167
+ yTranslate,
144
168
  startComponentsAnimation,
145
169
  setStartComponentsAnimation,
146
170
  isActiveGesture: playerAnimationState !== null,
@@ -11,6 +11,8 @@ import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactH
11
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
12
12
  import { useSafeAreaInsets } from "react-native-safe-area-context";
13
13
  import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
14
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
15
+ import { useDelayedPlayerDetails } from "./hooks";
14
16
 
15
17
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
16
18
 
@@ -26,6 +28,10 @@ type Props = {
26
28
  isTabletLandscape?: boolean;
27
29
  isAudioPlayer?: boolean;
28
30
  isTablet?: boolean;
31
+ inline?: any;
32
+ docked?: boolean;
33
+ isModal?: boolean;
34
+ pip?: boolean;
29
35
  };
30
36
 
31
37
  const containerStyle = ({
@@ -42,8 +48,24 @@ export const PlayerDetails = ({
42
48
  configuration,
43
49
  isTabletLandscape = false,
44
50
  isAudioPlayer,
45
- isTablet = false,
51
+ inline,
52
+ docked,
53
+ isModal,
54
+ pip,
46
55
  }: Props) => {
56
+ const isInlineModal = inline && isModal;
57
+
58
+ // Mounting the PlayerDetails component is a resource-intensive process.
59
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
60
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
61
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
62
+ const isShowPlayerDetails = useDelayedPlayerDetails({
63
+ isInline: isInlineModal,
64
+ isDocked: docked,
65
+ isPip: pip,
66
+ });
67
+
68
+ const isTablet = useIsTablet();
47
69
  const screenData = useTargetScreenData(entry);
48
70
  const insets = useSafeAreaInsets();
49
71
 
@@ -79,7 +101,7 @@ export const PlayerDetails = ({
79
101
  }
80
102
  }, [isAudioPlayer]);
81
103
 
82
- if (isNilOrEmpty(screenData?.ui_components)) {
104
+ if (isNilOrEmpty(screenData?.ui_components) || !isShowPlayerDetails) {
83
105
  return null;
84
106
  }
85
107