@applicaster/zapp-react-native-ui-components 12.0.0-rc.95 → 12.0.0-rc.97

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.
@@ -5,7 +5,6 @@ import {
5
5
  useModalAnimationContext,
6
6
  PlayerAnimationStateEnum,
7
7
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
8
- import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks";
9
8
 
10
9
  type Props = {
11
10
  style: ViewStyle[];
@@ -18,13 +17,8 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
18
17
  animatedValues: { lastScrollY, dragScrollY, translateYOffset },
19
18
  modalSnapPoints,
20
19
  setStartComponentsAnimation,
21
- lastScrollYValue,
22
20
  } = useModalAnimationContext();
23
21
 
24
- const { height: screenHeight } = useDimensions("screen", {
25
- deviceInfo: true,
26
- });
27
-
28
22
  const interpolateConfig: Animated.InterpolationConfigType = React.useMemo(
29
23
  () => ({
30
24
  inputRange: modalSnapPoints,
@@ -51,16 +45,10 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
51
45
  }
52
46
 
53
47
  React.useEffect(() => {
54
- const translateYListener = translateY.addListener(({ value }) => {
55
- const preparedValue = Math.round(
56
- Math.abs(value) - lastScrollYValue.current
57
- );
58
-
48
+ const translateYListener = translateY.addListener(() => {
59
49
  (playerAnimationState === PlayerAnimationStateEnum.minimize ||
60
50
  playerAnimationState === PlayerAnimationStateEnum.maximaze) &&
61
- setStartComponentsAnimation(
62
- preparedValue >= Math.round((screenHeight * 10) / 100)
63
- );
51
+ setStartComponentsAnimation(true);
64
52
  });
65
53
 
66
54
  return () => {
@@ -205,7 +205,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
205
205
 
206
206
  if (
207
207
  (videoModalState.mode === "MAXIMIZED" &&
208
- videoModalState.previousMode === "MAXIMIZED") ||
208
+ videoModalState.previousMode === "MINIMIZED" &&
209
+ previousItemId === videoModalState.item?.id) ||
209
210
  previousItemId !== videoModalState.item?.id
210
211
  ) {
211
212
  setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
@@ -51,6 +51,7 @@ export const AnimationView = ({
51
51
  setTabletLandscapePlayerTopPosition,
52
52
  modalSnapPoints,
53
53
  startComponentsAnimationDistance,
54
+ progressBarHeight,
54
55
  } = useModalAnimationContext();
55
56
 
56
57
  const isRTL = useIsRTL();
@@ -62,9 +63,9 @@ export const AnimationView = ({
62
63
  } = useDimensions("window", { deviceInfo: true });
63
64
 
64
65
  const { videoModalState } = useNavigation();
65
- const bottomTabBarHeight = useGetBottomTabBarHeight();
66
- const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
67
66
  const insets = useSafeAreaInsets();
67
+ const bottomTabBarHeight = useGetBottomTabBarHeight() + (insets.bottom || 0);
68
+ const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
68
69
  const animationComponentRef = useRef(null);
69
70
 
70
71
  // retrieving top position of the player for tablet landscape mode
@@ -92,12 +93,12 @@ export const AnimationView = ({
92
93
  const inlineAudioPlayer = additionalData.inlineAudioPlayer;
93
94
 
94
95
  const moveUpValue = additionalData.saveArea
95
- ? -insets.top
96
+ ? -insets.top + (isAudioItem ? 0 : progressBarHeight)
96
97
  : isTablet
97
98
  ? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
98
- ? -tabletLandscapePlayerTopPosition
99
+ ? -tabletLandscapePlayerTopPosition + progressBarHeight
99
100
  : -130
100
- : -50;
101
+ : -50 + progressBarHeight;
101
102
 
102
103
  const moveComponentHorizontalValue = additionalData.moveValue
103
104
  ? isRTL
@@ -1,12 +1,17 @@
1
1
  import React, { useContext } from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
- import { useSafeAreaInsets } from "react-native-safe-area-context";
4
+ import {
5
+ useSafeAreaInsets,
6
+ useSafeAreaFrame,
7
+ } from "react-native-safe-area-context";
5
8
  import {
6
9
  useGetBottomTabBarHeight,
7
- useDimensions,
10
+ useNavigation,
8
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
+ import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
9
13
 
14
+ import { PROGRESS_BAR_HEIGHT } from "./utils";
10
15
  import { useConfiguration } from "../utils";
11
16
 
12
17
  export enum PlayerAnimationStateEnum {
@@ -40,6 +45,7 @@ export type ModalAnimationContextT = {
40
45
  tabletLandscapePlayerTopPosition: number;
41
46
  setTabletLandscapePlayerTopPosition: (value: number) => void;
42
47
  startComponentsAnimationDistance: number;
48
+ progressBarHeight: number;
43
49
  };
44
50
 
45
51
  const ReactContext = React.createContext<ModalAnimationContextT>({
@@ -64,6 +70,7 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
64
70
  tabletLandscapePlayerTopPosition: 0,
65
71
  setTabletLandscapePlayerTopPosition: () => null,
66
72
  startComponentsAnimationDistance: 0,
73
+ progressBarHeight: 0,
67
74
  });
68
75
 
69
76
  export function useModalAnimationContext() {
@@ -82,6 +89,11 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
82
89
  const [startComponentsAnimation, setStartComponentsAnimation] =
83
90
  React.useState<boolean>(false);
84
91
 
92
+ const {
93
+ videoModalState: { mode, visible, item },
94
+ } = useNavigation();
95
+
96
+ const isLiveItem = isLive(item);
85
97
  const { minimised_height: minimisedHeight } = useConfiguration();
86
98
 
87
99
  const resetPlayerAnimationState = React.useCallback(() => {
@@ -95,21 +107,28 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
95
107
  const translateYOffset = React.useRef(new Animated.Value(0)).current;
96
108
  const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
97
109
 
98
- const { height } = useDimensions("window", { fullDimensions: true });
110
+ const { height: safeAreaFrameHeight } = useSafeAreaFrame();
111
+ const [height, setHeight] = React.useState<number>(safeAreaFrameHeight);
112
+ const progressBarHeight = isLiveItem ? 0 : PROGRESS_BAR_HEIGHT;
99
113
  const { bottom: bottomSafeArea } = useSafeAreaInsets();
100
114
  const bottomTabBarHeight = useGetBottomTabBarHeight();
115
+ const startComponentsAnimationDistance = Math.round((height * 60) / 100);
101
116
 
102
- const startComponentsAnimationDistance = React.useMemo(
103
- () => Math.round((height * 60) / 100),
104
- [height]
105
- );
117
+ React.useEffect(() => {
118
+ if (visible && mode === "MAXIMIZED" && height !== safeAreaFrameHeight) {
119
+ setHeight(safeAreaFrameHeight);
120
+ }
121
+ }, [height, safeAreaFrameHeight, mode, visible]);
106
122
 
107
123
  /*
108
124
  If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
109
125
  Because of this we need to minus bottom SafeArea offset.
110
126
  */
111
127
  const minValue =
112
- height - minimisedHeight - (bottomTabBarHeight || bottomSafeArea);
128
+ height -
129
+ minimisedHeight -
130
+ (bottomTabBarHeight || bottomSafeArea) -
131
+ progressBarHeight;
113
132
 
114
133
  const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
115
134
  // Last snap state which will helps us to make smooth responder to scrollview animation
@@ -142,6 +161,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
142
161
  tabletLandscapePlayerTopPosition,
143
162
  setTabletLandscapePlayerTopPosition,
144
163
  startComponentsAnimationDistance,
164
+ progressBarHeight,
145
165
  }}
146
166
  >
147
167
  {children}
@@ -13,6 +13,7 @@ export enum ComponentAnimationType {
13
13
  }
14
14
 
15
15
  export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
16
+ export const PROGRESS_BAR_HEIGHT = 3;
16
17
 
17
18
  export const defaultAspectRatioWidth = (height: number): number =>
18
19
  (height / 9) * 16;
@@ -225,7 +225,7 @@ export const PlayerWrapper = (props: Props) => {
225
225
  </AnimationComponent>
226
226
  </View>
227
227
  <AnimatedScrollModal>
228
- {isInlineModal ? (
228
+ {isInlineModal && !docked ? (
229
229
  <AnimationComponent
230
230
  animationType={ComponentAnimationType.componentFade}
231
231
  style={defaultStyles.flex}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-rc.95",
3
+ "version": "12.0.0-rc.97",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.0-rc.95",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.95",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.95",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.95",
37
+ "@applicaster/applicaster-types": "12.0.0-rc.97",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.97",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.97",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.97",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",