@applicaster/zapp-react-native-ui-components 12.0.0-alpha.3804385444 → 12.0.0-alpha.4201443043

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/Components/BaseFocusable/index.tsx +1 -1
  2. package/Components/Cell/Cell.tsx +5 -5
  3. package/Components/Cell/CellWithFocusable.tsx +17 -5
  4. package/Components/FocusableGroup/index.tsx +1 -0
  5. package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
  6. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
  7. package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
  8. package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
  9. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
  10. package/Components/Layout/TV/__tests__/index.test.tsx +18 -74
  11. package/Components/Layout/TV/index.tsx +9 -105
  12. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
  13. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +111 -52
  14. package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
  15. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
  16. package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
  17. package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
  18. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  19. package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
  20. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
  21. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +4 -1
  22. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -3
  23. package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
  24. package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
  25. package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
  26. package/Components/Navigator/StackNavigator.tsx +48 -0
  27. package/Components/Navigator/index.ts +1 -0
  28. package/Components/PlayerContainer/PlayerContainer.tsx +12 -6
  29. package/Components/River/ComponentsMap/ComponentsMap.tsx +92 -22
  30. package/Components/River/RefreshControl.tsx +55 -1
  31. package/Components/River/TV/River.tsx +0 -23
  32. package/Components/RouteManager/index.tsx +2 -2
  33. package/Components/Screen/TV/hooks/index.ts +3 -0
  34. package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
  35. package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
  36. package/Components/Screen/TV/index.web.tsx +179 -0
  37. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -0
  38. package/Components/Screen/index.tsx +35 -24
  39. package/Components/ScreenResolver/index.tsx +3 -1
  40. package/Components/Transitioner/Scene.tsx +24 -19
  41. package/Components/Transitioner/Transitioner.tsx +9 -2
  42. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
  43. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  44. package/Components/VideoLive/LiveImageManager.ts +18 -1
  45. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
  46. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +11 -4
  47. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +9 -2
  48. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +13 -2
  49. package/Components/VideoModal/PlayerWrapper.tsx +67 -60
  50. package/Components/VideoModal/VideoModal.tsx +19 -19
  51. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -0
  52. package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
  53. package/Components/Viewport/ViewportTracker/index.tsx +1 -0
  54. package/Components/Viewport/utils.js +1 -1
  55. package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
  56. package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
  57. package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
  58. package/Contexts/ScreenContext/index.tsx +94 -25
  59. package/Contexts/ScreenDataContext/index.ts +3 -0
  60. package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
  61. package/events/index.ts +1 -0
  62. package/package.json +5 -5
  63. package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
  64. /package/Contexts/{index.js → index.ts} +0 -0
@@ -6,7 +6,10 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
6
6
 
7
7
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
8
8
  import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
9
- import { getNavigationPropsV2 } from "@applicaster/zapp-react-native-utils/navigationUtils";
9
+ import {
10
+ getNavigationPropsV2,
11
+ resolveNavigationPlugin,
12
+ } from "@applicaster/zapp-react-native-utils/navigationUtils";
10
13
  import { useSafeAreaInsets } from "react-native-safe-area-context";
11
14
  import {
12
15
  useDimensions,
@@ -52,11 +55,11 @@ function isValidColor(string) {
52
55
  }
53
56
 
54
57
  type Props = {
55
- setToggleMenu: () => void;
56
- setCloseMenu: () => void;
58
+ pathname: unknown;
59
+ screenData: unknown;
57
60
  };
58
61
 
59
- export function Screen({ setToggleMenu, setCloseMenu }: Props) {
62
+ export function Screen(_props: Props) {
60
63
  const theme = useTheme<BaseThemePropertiesMobile>();
61
64
  const navigation = useNavigation();
62
65
  const { plugins } = usePickFromState(["plugins"]);
@@ -70,26 +73,38 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
70
73
  fullDimensions: true,
71
74
  });
72
75
 
73
- const routeData = useRoute();
76
+ const { screenData, pathname } = useRoute();
74
77
 
75
78
  const currentRiver = useScreenData(
76
- getScreenId(routeData.screenData, navigation.activeRiver)
79
+ getScreenId(screenData, navigation.activeRiver)
77
80
  );
78
81
 
79
82
  const { title } = useNavbarState();
80
83
 
81
- const navBarProps = React.useMemo(
82
- () => ({
83
- ...getNavigationPropsV2({
84
- currentRiver,
85
- title,
86
- category: "nav_bar",
87
- }),
88
- setToggleMenu,
89
- setCloseMenu,
90
- }),
91
- [currentRiver, setCloseMenu, setToggleMenu]
92
- );
84
+ const hasMenu =
85
+ resolveNavigationPlugin({
86
+ category: "menu",
87
+ navigations: currentRiver.navigations,
88
+ plugins,
89
+ })?.identifier === "quick_brick_side_menu";
90
+
91
+ const navBarProps = React.useMemo<MobileNavBarPluginProps | null>(() => {
92
+ const props = getNavigationPropsV2({
93
+ currentRiver,
94
+ title,
95
+ category: "nav_bar",
96
+ });
97
+
98
+ if (props) {
99
+ return {
100
+ ...props,
101
+ id: pathname,
102
+ pathname: pathname,
103
+ };
104
+ }
105
+
106
+ return null;
107
+ }, [currentRiver, pathname]);
93
108
 
94
109
  const NavBar = React.useMemo(
95
110
  () =>
@@ -97,12 +112,10 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
97
112
  "nav_bar",
98
113
  currentRiver,
99
114
  plugins
100
- ) as React.ComponentType<MobileNavBarPluginProps>,
115
+ ) as React.ComponentType<MobileNavBarPluginProps & { hasMenu: boolean }>,
101
116
  []
102
117
  );
103
118
 
104
- const { screenData, pathname } = routeData;
105
-
106
119
  const offlinePlugin = getComponentModule({
107
120
  plugins,
108
121
  components: {},
@@ -133,9 +146,7 @@ export function Screen({ setToggleMenu, setCloseMenu }: Props) {
133
146
  return (
134
147
  <ScreenContextProvider pathname={pathname}>
135
148
  <View style={style}>
136
- <NavBar
137
- {...{ ...(navBarProps as MobileNavBarPluginProps), id: pathname }}
138
- />
149
+ {navBarProps && <NavBar {...navBarProps} hasMenu={hasMenu} />}
139
150
 
140
151
  <OfflineFallbackScreen screenData={targetScreenData}>
141
152
  {/* @TODO RouteManager doesn't use props, can they be removed ? */}
@@ -32,12 +32,13 @@ type Props = {
32
32
  nextFocusLeft?: React.Ref<any>;
33
33
  nextFocusUp?: React.Ref<any>;
34
34
  };
35
+ groupId?: string;
35
36
  };
36
37
 
37
38
  export function ScreenResolverComponent(props: Props) {
38
39
  useScreenAnalytics(props);
39
40
 
40
- const { screenType, screenId, screenData } = props;
41
+ const { screenType, screenId, screenData, groupId } = props;
41
42
 
42
43
  const { hookPlugin } = screenData || {};
43
44
 
@@ -81,6 +82,7 @@ export function ScreenResolverComponent(props: Props) {
81
82
  item={screenData}
82
83
  mode={mode === "PIP" ? "PIP" : "FULLSCREEN"}
83
84
  isModal={false}
85
+ groupId={groupId}
84
86
  />
85
87
  );
86
88
  }
@@ -7,6 +7,7 @@ import {
7
7
  } from "react-native";
8
8
  import { useSafeAreaFrame } from "react-native-safe-area-context";
9
9
  import { PathnameContext } from "../../Contexts/PathnameContext";
10
+ import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
10
11
 
11
12
  type Props = {
12
13
  children: any;
@@ -16,6 +17,8 @@ type Props = {
16
17
  animating: boolean;
17
18
  contentStyle: ViewStyle;
18
19
  pathname: string;
20
+ isActive: boolean;
21
+ screenData: NavigationScreenData;
19
22
  };
20
23
 
21
24
  /**
@@ -38,34 +41,36 @@ export function Scene({
38
41
  animating,
39
42
  contentStyle,
40
43
  pathname,
44
+ isActive = false,
45
+ screenData,
41
46
  }: Props) {
47
+ const [initialScreenData, setInitialScreenData] = React.useState(screenData);
48
+
49
+ React.useLayoutEffect(() => {
50
+ if (isActive) {
51
+ setInitialScreenData(screenData);
52
+ }
53
+ }, [screenData, isActive]);
54
+
42
55
  const frame = useSafeAreaFrame();
43
56
  const { height, width } = useWindowDimensions();
44
57
 
45
- if (overlayStyle && animating) {
46
- // Safe frame takes too long to update,
47
- // so we can not rely on it there, and use height and width instead.
48
- return (
49
- <Animated.View
50
- pointerEvents={pointerEvents}
51
- style={[style, contentStyle, { height, width }]}
52
- >
53
- <PathnameContext.Provider value={pathname}>
54
- {children}
55
- </PathnameContext.Provider>
56
- <Animated.View style={overlayStyle} />
57
- </Animated.View>
58
- );
59
- }
58
+ // Safe frame takes too long to update,
59
+ // so we can not rely on it there, and use height and width instead.
60
+ const isAnimating = animating && overlayStyle;
61
+ const dimensions = isAnimating ? { height, width } : frame;
60
62
 
61
63
  return (
62
64
  <Animated.View
63
65
  pointerEvents={pointerEvents}
64
- style={[style, contentStyle, frame]}
66
+ style={[style, contentStyle, dimensions]}
65
67
  >
66
- <PathnameContext.Provider value={pathname}>
67
- {children}
68
- </PathnameContext.Provider>
68
+ <ScreenDataContext.Provider value={initialScreenData}>
69
+ <PathnameContext.Provider value={pathname}>
70
+ {children}
71
+ </PathnameContext.Provider>
72
+ </ScreenDataContext.Provider>
73
+ {isAnimating && <Animated.View style={overlayStyle} />}
69
74
  </Animated.View>
70
75
  );
71
76
  }
@@ -278,7 +278,8 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
278
278
  // instead of dangerous nulls or duplicates.
279
279
  renderSingleScene({ scenes, to }) {
280
280
  const { contentStyle, layoutData } = this.props;
281
- const screenData = scenes[to.index]?.children?.props?.screenData;
281
+ const screenData = this.props.children.props.screenData;
282
+ const pathname = scenes[to.index].key;
282
283
 
283
284
  const orientation = getScreenOrientation({
284
285
  screenData,
@@ -296,10 +297,12 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
296
297
  }) && (
297
298
  <Scene
298
299
  {...{ style: to.style }}
299
- pathname={scenes[to.index].key}
300
+ pathname={pathname}
301
+ isActive={pathname === this.props.navigator.currentRoute}
300
302
  contentStyle={contentStyle}
301
303
  key={scenes[to.index].key}
302
304
  screenUniqueId={scenes[to.index].screenUniqueId}
305
+ screenData={screenData}
303
306
  >
304
307
  {scenes[to.index].children}
305
308
  </Scene>
@@ -319,12 +322,14 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
319
322
  <Scene
320
323
  key={scenes[from.index].key}
321
324
  pathname={scenes[from.index].key}
325
+ isActive={scenes[from.index].key === this.props.navigator.currentRoute}
322
326
  style={from.style}
323
327
  pointerEvents="none"
324
328
  overlayStyle={from.overlayStyle}
325
329
  animating={this.state.animating}
326
330
  contentStyle={contentStyle}
327
331
  screenUniqueId={scenes[from.index].screenUniqueId}
332
+ screenData={scenes[from.index].children.props.screenData}
328
333
  >
329
334
  {scenes[from.index].children}
330
335
  </Scene>
@@ -333,12 +338,14 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
333
338
  const toScene = scenes[to.index] && (
334
339
  <Scene
335
340
  pathname={scenes[to.index].key}
341
+ isActive={scenes[to.index].key === this.props.navigator.currentRoute}
336
342
  key={scenes[to.index].key}
337
343
  style={to.style}
338
344
  overlayStyle={to.overlayStyle}
339
345
  animating={this.state.animating}
340
346
  contentStyle={contentStyle}
341
347
  screenUniqueId={scenes[to.index].screenUniqueId}
348
+ screenData={this.props.children.props.screenData}
342
349
  >
343
350
  {scenes[to.index].children}
344
351
  </Scene>
@@ -21,7 +21,9 @@ exports[`<Scene /> renders correctly 1`] = `
21
21
  ]
22
22
  }
23
23
  >
24
- <ContextProvider />
24
+ <ContextProvider>
25
+ <ContextProvider />
26
+ </ContextProvider>
25
27
  </ForwardRef(AnimatedComponentWrapper)>
26
28
  `;
27
29
 
@@ -43,7 +45,9 @@ exports[`<Scene /> renders the overlay while animating 1`] = `
43
45
  ]
44
46
  }
45
47
  >
46
- <ContextProvider />
48
+ <ContextProvider>
49
+ <ContextProvider />
50
+ </ContextProvider>
47
51
  <ForwardRef(AnimatedComponentWrapper)
48
52
  style={
49
53
  Object {
@@ -10,6 +10,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
10
10
  }
11
11
  >
12
12
  <Scene
13
+ isActive={true}
13
14
  screenUniqueId="mocked-uuid"
14
15
  >
15
16
  <View
@@ -10,7 +10,11 @@ import { Component } from "react";
10
10
 
11
11
  const { log_debug, log_info, log_error } = loggerLiveImageManager;
12
12
 
13
- export type LiveImageManagerEvent = "onEnd" | "onStart" | "onError";
13
+ export type LiveImageManagerEvent =
14
+ | "onEnd"
15
+ | "onStart"
16
+ | "onError"
17
+ | "onDestroy";
14
18
 
15
19
  export type LiveImageManagerListenerData = {
16
20
  id: string;
@@ -102,6 +106,16 @@ export class LiveImageManager implements PlayerLifecycleListener {
102
106
  }
103
107
 
104
108
  this.items = this.items.filter((i) => i !== item);
109
+
110
+ this.invokeListenersUpdate({
111
+ callbackName: "onDestroy",
112
+ event: {
113
+ item,
114
+ playerId: this.currentlyPlaying?.playerId,
115
+ primaryPlayerId: this.primaryPlayer?.playerId,
116
+ entry: item.getPlayer().getEntry(),
117
+ },
118
+ });
105
119
  };
106
120
 
107
121
  public onViewportEnter = (item: LiveImage) => {
@@ -351,6 +365,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
351
365
  item,
352
366
  playerId: this.currentlyPlaying?.playerId,
353
367
  primaryPlayerId: this.primaryPlayer?.playerId,
368
+ entry: item.getPlayer().getEntry(),
354
369
  },
355
370
  });
356
371
  };
@@ -385,6 +400,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
385
400
  item,
386
401
  playerId: this.currentlyPlaying?.playerId,
387
402
  primaryPlayerId: this.primaryPlayer?.playerId,
403
+ entry: item.getPlayer().getEntry(),
388
404
  },
389
405
  });
390
406
  };
@@ -419,6 +435,7 @@ export class LiveImageManager implements PlayerLifecycleListener {
419
435
  error,
420
436
  playerId: currentItem?.playerId,
421
437
  primaryPlayerId: currentItem?.playerId,
438
+ entry: item.getPlayer().getEntry(),
422
439
  },
423
440
  });
424
441
  };
@@ -30,11 +30,6 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
30
30
  playerId="player1"
31
31
  resizeMode="cover"
32
32
  screenConfig={Object {}}
33
- source={
34
- Object {
35
- "uri": "",
36
- }
37
- }
38
33
  style={Object {}}
39
34
  />
40
35
  </View>
@@ -9,6 +9,8 @@ import {
9
9
  TapGestureHandler,
10
10
  GestureHandlerRootView,
11
11
  } from "react-native-gesture-handler";
12
+
13
+ import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
12
14
  import {
13
15
  useModalAnimationContext,
14
16
  PlayerAnimationStateEnum,
@@ -58,6 +60,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
58
60
  setLastSnap,
59
61
  } = useModalAnimationContext();
60
62
 
63
+ const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
64
+
61
65
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
62
66
  useNavigation();
63
67
 
@@ -69,6 +73,11 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
69
73
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
70
74
  playerAnimationState !== PlayerAnimationStateEnum.maximaze;
71
75
 
76
+ const isEnablePanGesture =
77
+ !isLanguageOverlayVisible &&
78
+ isNotMinimizeMaximazeAnimation &&
79
+ (isMaximazedModal || isMinimizedModal);
80
+
72
81
  const isAudioItem = React.useMemo(
73
82
  () =>
74
83
  videoModalState.item?.content?.type?.includes?.("audio") ||
@@ -290,15 +299,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
290
299
  >
291
300
  <View pointerEvents="box-none">
292
301
  <PanGestureHandler
293
- enabled={
294
- (isMaximazedModal || isMinimizedModal) &&
295
- isNotMinimizeMaximazeAnimation
296
- }
302
+ enabled={isEnablePanGesture}
297
303
  ref={panHandlerRef}
298
304
  simultaneousHandlers={[scrollRef, tapHandlerRef]}
299
305
  shouldCancelWhenOutside={isMaximazedModal}
300
306
  onGestureEvent={onGestureEvent}
301
307
  onHandlerStateChange={onHandlerStateChange}
308
+ activeOffsetY={[-5, 5]}
302
309
  >
303
310
  <Animated.View>
304
311
  <NativeViewGestureHandler
@@ -3,6 +3,8 @@ import { Animated, StyleSheet } from "react-native";
3
3
 
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
5
  import { PanGestureHandler, State } from "react-native-gesture-handler";
6
+
7
+ import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
6
8
  import {
7
9
  useModalAnimationContext,
8
10
  PlayerAnimationStateEnum,
@@ -35,9 +37,14 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
35
37
  } = useModalAnimationContext();
36
38
 
37
39
  const { videoModalState } = useNavigation();
40
+ const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
41
+
38
42
  const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
39
43
  const isMinimizedModal = videoModalState.mode === "MINIMIZED";
40
44
 
45
+ const isEnablePanGesture =
46
+ !isLanguageOverlayVisible && (isMaximazedModal || isMinimizedModal);
47
+
41
48
  const onGestureEvent = Animated.event(
42
49
  [{ nativeEvent: { translationY: dragVideoPlayerY } }],
43
50
  { useNativeDriver: true }
@@ -53,7 +60,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
53
60
  if (videoModalState.mode === "MAXIMIZED") {
54
61
  if (translationY > 0) {
55
62
  const endOffsetY =
56
- lastSnap + preparedTranslationY + dragToss * velocityY + 150;
63
+ lastSnap + preparedTranslationY + dragToss * velocityY + 200;
57
64
 
58
65
  let destSnapPoint = modalSnapPoints[0];
59
66
 
@@ -127,7 +134,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
127
134
 
128
135
  return (
129
136
  <PanGestureHandler
130
- enabled={isMaximazedModal || isMinimizedModal}
137
+ enabled={isEnablePanGesture}
131
138
  shouldCancelWhenOutside={isMaximazedModal}
132
139
  onGestureEvent={onGestureEvent}
133
140
  onHandlerStateChange={onHandlerStateChange}
@@ -1,7 +1,10 @@
1
1
  import React, { useContext } from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
- import { useSafeAreaFrame } from "react-native-safe-area-context";
4
+ import {
5
+ useSafeAreaFrame,
6
+ useSafeAreaInsets,
7
+ } from "react-native-safe-area-context";
5
8
  import { useGetBottomTabBarHeight } from "@applicaster/zapp-react-native-utils/reactHooks";
6
9
 
7
10
  import { useConfiguration } from "../utils";
@@ -91,8 +94,16 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
91
94
  const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
92
95
 
93
96
  const { height } = useSafeAreaFrame();
97
+ const { bottom: bottomSafeArea } = useSafeAreaInsets();
94
98
  const bottomTabBarHeight = useGetBottomTabBarHeight();
95
- const minValue = height - minimisedHeight - bottomTabBarHeight;
99
+
100
+ /*
101
+ If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
102
+ Because of this we need to minus bottom SafeArea offset.
103
+ */
104
+ const minValue =
105
+ height - minimisedHeight - (bottomTabBarHeight || bottomSafeArea);
106
+
96
107
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
97
108
  // Last snap state which will helps us to make smooth responder to scrollview animation
98
109
  const [lastSnap, setLastSnap] = React.useState<number>(modalSnapPoints[0]);
@@ -14,12 +14,13 @@ import { PlayerDetails } from "./PlayerDetails";
14
14
  import { playerDimesionsHack } from "./utils";
15
15
  import { PathnameContext } from "../../Contexts/PathnameContext";
16
16
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
17
+ import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
17
18
 
18
19
  import {
19
- AnimationComponent,
20
- ComponentAnimationType,
21
20
  AnimatedScrollModal,
22
21
  AnimatedVideoPlayerComponent,
22
+ AnimationComponent,
23
+ ComponentAnimationType,
23
24
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
24
25
 
25
26
  type DimensionsT = {
@@ -180,65 +181,71 @@ export const PlayerWrapper = (props: Props) => {
180
181
  [containerDimensions, playerDimesionsHack]
181
182
  );
182
183
 
184
+ const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
185
+
183
186
  return (
184
- <WrapperView
185
- edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
186
- style={[
187
- safeAreaStyles(configuration, isTablet),
188
- style,
189
- playerDimesionsHack,
190
- ]}
191
- >
192
- <AnimationComponent
193
- animationType={ComponentAnimationType.moveUpComponent}
194
- additionalData={{ saveArea: true }}
195
- style={directionStyles(isTabletLandscape)}
196
- >
197
- <ScreenContextProvider pathname={"videoModal"}>
198
- <PathnameContext.Provider value={"videoModal"}>
199
- <View
200
- testID={`${entry?.id}-player-container`}
201
- style={[
202
- defaultStyles.playerContainer,
203
- containerDimensions,
204
- containerStyle,
205
- playerDimesionsHack,
206
- ]}
207
- >
208
- <AnimationComponent
209
- animationType={ComponentAnimationType.moveUpComponent}
210
- style={isTabletLandscape ? defaultStyles.flex : undefined}
211
- additionalData={{
212
- useLayoutMeasure: isTabletLandscape,
213
- disableAnimatedComponent: !isTabletLandscape,
214
- resetAnimationValue: isTabletLandscape && docked,
215
- }}
216
- >
217
- <AnimatedVideoPlayerComponent>
218
- {children(childrenStyles)}
219
- </AnimatedVideoPlayerComponent>
220
- </AnimationComponent>
221
- </View>
222
- <AnimatedScrollModal>
223
- {isInlineModal ? (
224
- <AnimationComponent
225
- animationType={ComponentAnimationType.componentFade}
226
- style={defaultStyles.flex}
187
+ <ScreenContextProvider pathname={pathname}>
188
+ <PathnameContext.Provider value={pathname}>
189
+ <WrapperView
190
+ edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
191
+ style={[
192
+ safeAreaStyles(configuration, isTablet),
193
+ style,
194
+ playerDimesionsHack,
195
+ ]}
196
+ >
197
+ <AnimationComponent
198
+ animationType={ComponentAnimationType.moveUpComponent}
199
+ additionalData={{ saveArea: true }}
200
+ style={directionStyles(isTabletLandscape)}
201
+ >
202
+ <ScreenContextProvider pathname={pathname}>
203
+ <PathnameContext.Provider value={pathname}>
204
+ <View
205
+ testID={`${entry?.id}-player-container`}
206
+ style={[
207
+ defaultStyles.playerContainer,
208
+ containerDimensions,
209
+ containerStyle,
210
+ playerDimesionsHack,
211
+ ]}
227
212
  >
228
- <PlayerDetails
229
- configuration={configuration}
230
- style={defaultStyles.playerDetails}
231
- entry={entry}
232
- isTabletLandscape={isTabletLandscape}
233
- />
234
- </AnimationComponent>
235
- ) : (
236
- <View style={defaultStyles.playerDetails} />
237
- )}
238
- </AnimatedScrollModal>
239
- </PathnameContext.Provider>
240
- </ScreenContextProvider>
241
- </AnimationComponent>
242
- </WrapperView>
213
+ <AnimationComponent
214
+ animationType={ComponentAnimationType.moveUpComponent}
215
+ style={isTabletLandscape ? defaultStyles.flex : undefined}
216
+ additionalData={{
217
+ useLayoutMeasure: isTabletLandscape,
218
+ disableAnimatedComponent: !isTabletLandscape,
219
+ resetAnimationValue: isTabletLandscape && docked,
220
+ }}
221
+ >
222
+ <AnimatedVideoPlayerComponent>
223
+ {children(childrenStyles)}
224
+ </AnimatedVideoPlayerComponent>
225
+ </AnimationComponent>
226
+ </View>
227
+ <AnimatedScrollModal>
228
+ {isInlineModal ? (
229
+ <AnimationComponent
230
+ animationType={ComponentAnimationType.componentFade}
231
+ style={defaultStyles.flex}
232
+ >
233
+ <PlayerDetails
234
+ configuration={configuration}
235
+ style={defaultStyles.playerDetails}
236
+ entry={entry}
237
+ isTabletLandscape={isTabletLandscape}
238
+ />
239
+ </AnimationComponent>
240
+ ) : (
241
+ <View style={defaultStyles.playerDetails} />
242
+ )}
243
+ </AnimatedScrollModal>
244
+ </PathnameContext.Provider>
245
+ </ScreenContextProvider>
246
+ </AnimationComponent>
247
+ </WrapperView>
248
+ </PathnameContext.Provider>
249
+ </ScreenContextProvider>
243
250
  );
244
251
  };
@@ -129,17 +129,17 @@ const VideoModalComponent = () => {
129
129
  const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
130
130
 
131
131
  return (
132
- <AnimatedPlayerModalWrapper
133
- style={[
134
- styles.container,
135
- {
136
- backgroundColor,
137
- },
138
- ]}
139
- >
140
- <ScreenContextProvider pathname={pathname}>
141
- <PathnameContext.Provider value={pathname}>
142
- {itemIdHooksFinished === item?.id ? (
132
+ <ScreenContextProvider pathname={pathname}>
133
+ <PathnameContext.Provider value={pathname}>
134
+ {itemIdHooksFinished === item?.id ? (
135
+ <AnimatedPlayerModalWrapper
136
+ style={[
137
+ styles.container,
138
+ {
139
+ backgroundColor,
140
+ },
141
+ ]}
142
+ >
143
143
  <HandlePlayable
144
144
  item={item}
145
145
  isModal={mode !== "PIP"}
@@ -147,14 +147,14 @@ const VideoModalComponent = () => {
147
147
  modalWidth={modalSize.width}
148
148
  mode={mode}
149
149
  />
150
- ) : (
151
- <View style={styles.loaderContainer}>
152
- <Spinner />
153
- </View>
154
- )}
155
- </PathnameContext.Provider>
156
- </ScreenContextProvider>
157
- </AnimatedPlayerModalWrapper>
150
+ </AnimatedPlayerModalWrapper>
151
+ ) : (
152
+ <View style={styles.loaderContainer}>
153
+ <Spinner />
154
+ </View>
155
+ )}
156
+ </PathnameContext.Provider>
157
+ </ScreenContextProvider>
158
158
  );
159
159
  };
160
160