@applicaster/zapp-react-native-ui-components 12.0.0-rc.5 → 12.0.0-rc.50

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 (95) hide show
  1. package/Components/AnimatedInOut/index.tsx +18 -10
  2. package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
  3. package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
  4. package/Components/AudioPlayer/helpers.tsx +1 -0
  5. package/Components/Cell/Cell.tsx +2 -2
  6. package/Components/Cell/CellWithFocusable.tsx +21 -14
  7. package/Components/Cell/TvOSCellComponent.tsx +2 -2
  8. package/Components/ErrorScreen/index.tsx +1 -1
  9. package/Components/FocusableCell/index.tsx +7 -7
  10. package/Components/FocusableList/FocusableChild.ts +24 -14
  11. package/Components/FocusableList/FocusableItem.tsx +1 -1
  12. package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
  13. package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
  14. package/Components/FocusableList/index.tsx +26 -25
  15. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +11 -8
  16. package/Components/HandlePlayable/HandlePlayable.tsx +1 -1
  17. package/Components/HookRenderer/index.tsx +1 -6
  18. package/Components/Image/Image.android.tsx +3 -22
  19. package/Components/Image/Image.tsx +18 -2
  20. package/Components/Image/utils/index.ts +39 -0
  21. package/Components/Layout/TV/__tests__/index.test.tsx +1 -34
  22. package/Components/Layout/TV/index.tsx +20 -36
  23. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +0 -1
  24. package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +21 -8
  25. package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
  26. package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
  27. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +17 -2
  28. package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
  29. package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
  30. package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +8 -10
  31. package/Components/MasterCell/utils/index.ts +16 -5
  32. package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
  33. package/Components/ModalComponent/Button/Item.tsx +82 -0
  34. package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
  35. package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
  36. package/Components/ModalComponent/Button/assets.ts +4 -0
  37. package/Components/ModalComponent/Button/index.tsx +111 -0
  38. package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
  39. package/Components/ModalComponent/Header/Title.tsx +70 -0
  40. package/Components/ModalComponent/Header/assets.ts +4 -0
  41. package/Components/ModalComponent/Header/index.tsx +71 -0
  42. package/Components/ModalComponent/Header/utils.ts +79 -0
  43. package/Components/ModalComponent/index.tsx +38 -0
  44. package/Components/ModalComponent/utils.ts +126 -0
  45. package/Components/PlayerContainer/ErrorDisplay/ErrorDisplay.tsx +4 -7
  46. package/Components/PlayerContainer/PlayerContainer.tsx +56 -29
  47. package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
  48. package/Components/PlayerImageBackground/index.tsx +34 -8
  49. package/Components/River/ComponentsMap/ComponentsMap.tsx +25 -0
  50. package/Components/River/River.tsx +8 -5
  51. package/Components/River/TV/River.tsx +2 -2
  52. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
  53. package/Components/River/__tests__/componentsMap.test.js +7 -0
  54. package/Components/River/useScreenConfiguration.ts +5 -6
  55. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
  56. package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
  57. package/Components/RouteManager/index.tsx +5 -3
  58. package/Components/Screen/__tests__/Screen.test.tsx +48 -36
  59. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +20 -6
  60. package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
  61. package/Components/Screen/index.tsx +92 -44
  62. package/Components/Screen/navigationHandler.ts +0 -82
  63. package/Components/Screen/orientationHandler.ts +1 -1
  64. package/Components/ScreenResolver/index.tsx +1 -1
  65. package/Components/Tabs/TV/styles.ts +1 -1
  66. package/Components/TrackedView/index.tsx +6 -3
  67. package/Components/VideoLive/LiveImageManager.ts +42 -13
  68. package/Components/VideoLive/PlayerLiveImageComponent.tsx +81 -72
  69. package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
  70. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +22 -27
  71. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +78 -0
  72. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +335 -0
  73. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +144 -0
  74. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +438 -0
  75. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +143 -0
  76. package/Components/VideoModal/ModalAnimation/index.ts +15 -0
  77. package/Components/VideoModal/ModalAnimation/utils.ts +299 -0
  78. package/Components/VideoModal/PlayerDetails.tsx +3 -0
  79. package/Components/VideoModal/PlayerWrapper.tsx +119 -95
  80. package/Components/VideoModal/VideoModal.tsx +8 -25
  81. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
  82. package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +8 -3
  83. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +242 -166
  84. package/Components/VideoModal/hooks/useModalSize.ts +13 -4
  85. package/Components/VideoModal/utils.ts +3 -3
  86. package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
  87. package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
  88. package/Components/ZappUIComponent/index.tsx +22 -12
  89. package/Components/index.js +2 -0
  90. package/Contexts/ScreenContext/index.tsx +1 -4
  91. package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
  92. package/Decorators/RiverResolver/index.tsx +0 -4
  93. package/Decorators/index.tsx +0 -4
  94. package/package.json +5 -6
  95. package/Components/VideoModal/hooks/usePosition.ts +0 -50
@@ -0,0 +1,335 @@
1
+ import React from "react";
2
+ import { Animated, StyleSheet, View, Platform } from "react-native";
3
+
4
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
+ import {
6
+ NativeViewGestureHandler,
7
+ PanGestureHandler,
8
+ State,
9
+ TapGestureHandler,
10
+ GestureHandlerRootView,
11
+ } from "react-native-gesture-handler";
12
+ import {
13
+ useModalAnimationContext,
14
+ PlayerAnimationStateEnum,
15
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
16
+ import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
17
+ import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
18
+
19
+ import {
20
+ setScrollModalAnimatedValue,
21
+ resetScrollAnimatedValues,
22
+ } from "./utils";
23
+
24
+ const getAnimatedConfig = (toValue) => {
25
+ return {
26
+ toValue,
27
+ duration: 200,
28
+ useNativeDriver: true,
29
+ };
30
+ };
31
+
32
+ const generalStyles = StyleSheet.create({
33
+ container: {
34
+ flex: 1,
35
+ },
36
+ });
37
+
38
+ type Props = {
39
+ children: React.ReactNode;
40
+ };
41
+
42
+ export const AnimatedScrollModalComponent = ({ children }: Props) => {
43
+ const {
44
+ isActiveGesture,
45
+ playerAnimationState,
46
+ setPlayerAnimationState,
47
+ resetPlayerAnimationState,
48
+ animatedValues: {
49
+ lastScrollY,
50
+ dragScrollY,
51
+ dragVideoPlayerY,
52
+ translateYOffset,
53
+ },
54
+ lastScrollYValue,
55
+ scrollPosition,
56
+ modalSnapPoints,
57
+ lastSnap,
58
+ setLastSnap,
59
+ } = useModalAnimationContext();
60
+
61
+ const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
62
+ useNavigation();
63
+
64
+ const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
65
+ const isMinimizedModal = videoModalState.mode === "MINIMIZED";
66
+ const previousItemId = usePrevious(videoModalState.item?.id);
67
+
68
+ const isNotMinimizeMaximazeAnimation =
69
+ playerAnimationState !== PlayerAnimationStateEnum.minimize &&
70
+ playerAnimationState !== PlayerAnimationStateEnum.maximaze;
71
+
72
+ const isAudioItem = React.useMemo(
73
+ () =>
74
+ videoModalState.item?.content?.type?.includes?.("audio") ||
75
+ videoModalState.item?.type?.value === "audio",
76
+ [videoModalState.item]
77
+ );
78
+
79
+ // Refs for components
80
+ const scrollRef = React.useRef(null);
81
+ const tapHandlerRef = React.useRef(null);
82
+ const panHandlerRef = React.useRef(null);
83
+
84
+ const onRegisterLastScroll = Animated.event(
85
+ [{ nativeEvent: { contentOffset: { y: lastScrollY } } }],
86
+ { useNativeDriver: true }
87
+ );
88
+
89
+ const onGestureEvent = Animated.event(
90
+ [{ nativeEvent: { translationY: dragScrollY } }],
91
+ { useNativeDriver: true }
92
+ );
93
+
94
+ const onHandlerStateChange = ({ nativeEvent }) => {
95
+ if (nativeEvent.oldState === State.ACTIVE && scrollPosition.current === 0) {
96
+ // eslint-disable-next-line prefer-const
97
+ const { velocityY, translationY } = nativeEvent;
98
+ const dragToss = 0.05;
99
+
100
+ const preparedTranslationY =
101
+ Math.abs(translationY) - lastScrollYValue.current;
102
+
103
+ if (videoModalState.mode === "MAXIMIZED") {
104
+ const endOffsetY =
105
+ lastSnap + preparedTranslationY + dragToss * velocityY + 150;
106
+
107
+ let destSnapPoint = modalSnapPoints[0];
108
+
109
+ for (const snapPoint of modalSnapPoints) {
110
+ const distFromSnap = Math.abs(snapPoint - endOffsetY);
111
+
112
+ if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
113
+ destSnapPoint = snapPoint;
114
+ }
115
+ }
116
+
117
+ setLastSnap(destSnapPoint);
118
+
119
+ if (destSnapPoint === modalSnapPoints[0]) {
120
+ translateYOffset.extractOffset();
121
+ translateYOffset.setValue(preparedTranslationY);
122
+ translateYOffset.flattenOffset();
123
+ dragScrollY.setValue(0);
124
+
125
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
126
+ } else {
127
+ setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
128
+ }
129
+ } else {
130
+ if (translationY < 0) {
131
+ // from mini to full
132
+ setLastSnap(modalSnapPoints[0]);
133
+ translateYOffset.setValue(modalSnapPoints[1] - preparedTranslationY);
134
+ dragScrollY.setValue(0);
135
+
136
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
137
+ } else {
138
+ resetPlayerAnimationState();
139
+ }
140
+ }
141
+ } else {
142
+ playerAnimationState === PlayerAnimationStateEnum.drag_scroll &&
143
+ resetPlayerAnimationState();
144
+ }
145
+ };
146
+
147
+ const onScroll = React.useCallback(({ nativeEvent }) => {
148
+ scrollPosition.current = nativeEvent.contentOffset.y;
149
+ }, []);
150
+
151
+ const onMomentumScrollEnd = React.useCallback(
152
+ ({ nativeEvent }) => {
153
+ if (nativeEvent.contentOffset.y === 0 && !isActiveGesture) {
154
+ resetScrollAnimatedValues(
155
+ lastScrollY,
156
+ lastScrollYValue,
157
+ dragScrollY,
158
+ dragVideoPlayerY
159
+ );
160
+ }
161
+ },
162
+ [isActiveGesture]
163
+ );
164
+
165
+ React.useEffect(() => {
166
+ return () => {
167
+ scrollPosition.current = 0;
168
+
169
+ resetScrollAnimatedValues(
170
+ lastScrollY,
171
+ lastScrollYValue,
172
+ dragScrollY,
173
+ dragVideoPlayerY
174
+ );
175
+ };
176
+ }, []);
177
+
178
+ React.useEffect(() => {
179
+ if (
180
+ videoModalState.mode === "MINIMIZED" &&
181
+ videoModalState.previousMode === "MAXIMIZED"
182
+ ) {
183
+ resetPlayerAnimationState();
184
+ }
185
+
186
+ if (
187
+ (videoModalState.mode === "MAXIMIZED" &&
188
+ videoModalState.previousMode === "MAXIMIZED") ||
189
+ previousItemId !== videoModalState.item?.id
190
+ ) {
191
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
192
+ setTimeout(() => resetPlayerAnimationState());
193
+ }
194
+ }, [videoModalState, previousItemId]);
195
+
196
+ React.useEffect(() => {
197
+ if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
198
+ if (
199
+ (scrollPosition.current === 0 &&
200
+ (lastScrollY as any)._value !== 0 &&
201
+ (dragScrollY as any)._value === 0 &&
202
+ (dragVideoPlayerY as any)._value === 0) ||
203
+ (scrollPosition.current !== 0 &&
204
+ ((dragScrollY as any)._value !== 0 ||
205
+ (dragVideoPlayerY as any)._value !== 0))
206
+ ) {
207
+ resetScrollAnimatedValues(
208
+ lastScrollY,
209
+ lastScrollYValue,
210
+ dragScrollY,
211
+ dragVideoPlayerY
212
+ );
213
+ }
214
+
215
+ Animated.timing(
216
+ translateYOffset,
217
+ getAnimatedConfig(modalSnapPoints[1])
218
+ ).start(() => {
219
+ setTimeout(() => {
220
+ minimiseVideoModal();
221
+
222
+ setScrollModalAnimatedValue(
223
+ translateYOffset,
224
+ modalSnapPoints[1],
225
+ setLastSnap
226
+ );
227
+
228
+ resetScrollAnimatedValues(
229
+ lastScrollY,
230
+ lastScrollYValue,
231
+ dragScrollY,
232
+ dragVideoPlayerY
233
+ );
234
+ }, 150);
235
+ });
236
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
237
+ Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
238
+ maximiseVideoModal();
239
+ setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
240
+
241
+ resetScrollAnimatedValues(
242
+ lastScrollY,
243
+ lastScrollYValue,
244
+ dragScrollY,
245
+ dragVideoPlayerY
246
+ );
247
+
248
+ resetPlayerAnimationState();
249
+ });
250
+ }
251
+
252
+ const lastScrollYListenerId = lastScrollY.addListener(({ value }) => {
253
+ lastScrollYValue.current = value;
254
+ });
255
+
256
+ const dragListenerId = dragScrollY.addListener(({ value }) => {
257
+ const preparedValue =
258
+ isMinimizedModal && value >= 0
259
+ ? 0
260
+ : Math.round(isAudioItem ? Math.abs(value) : value);
261
+
262
+ if (
263
+ preparedValue > 0 &&
264
+ scrollPosition.current === 0 &&
265
+ playerAnimationState !== PlayerAnimationStateEnum.drag_player
266
+ ) {
267
+ playerAnimationState !== PlayerAnimationStateEnum.drag_scroll &&
268
+ setPlayerAnimationState(PlayerAnimationStateEnum.drag_scroll);
269
+ }
270
+ });
271
+
272
+ return () => {
273
+ lastScrollY.removeListener(lastScrollYListenerId);
274
+ dragScrollY.removeListener(dragListenerId);
275
+ };
276
+ }, [playerAnimationState, isAudioItem, modalSnapPoints]);
277
+
278
+ const Wrapper = React.useMemo(
279
+ () => (Platform.OS === "android" ? GestureHandlerRootView : View),
280
+ []
281
+ );
282
+
283
+ return (
284
+ <Wrapper style={generalStyles.container}>
285
+ <TapGestureHandler
286
+ maxDurationMs={100000}
287
+ ref={tapHandlerRef}
288
+ maxDeltaY={lastSnap - modalSnapPoints[0]}
289
+ numberOfTaps={1}
290
+ >
291
+ <View pointerEvents="box-none">
292
+ <PanGestureHandler
293
+ enabled={
294
+ (isMaximazedModal || isMinimizedModal) &&
295
+ isNotMinimizeMaximazeAnimation
296
+ }
297
+ ref={panHandlerRef}
298
+ simultaneousHandlers={[scrollRef, tapHandlerRef]}
299
+ shouldCancelWhenOutside={isMaximazedModal}
300
+ onGestureEvent={onGestureEvent}
301
+ onHandlerStateChange={onHandlerStateChange}
302
+ >
303
+ <Animated.View>
304
+ <NativeViewGestureHandler
305
+ ref={scrollRef}
306
+ waitFor={tapHandlerRef}
307
+ simultaneousHandlers={panHandlerRef}
308
+ >
309
+ <Animated.ScrollView
310
+ scrollEnabled={
311
+ isMaximazedModal && isNotMinimizeMaximazeAnimation
312
+ }
313
+ bounces={false}
314
+ onScrollBeginDrag={onRegisterLastScroll}
315
+ onScroll={onScroll}
316
+ onMomentumScrollEnd={onMomentumScrollEnd}
317
+ scrollEventThrottle={1}
318
+ showsVerticalScrollIndicator={false}
319
+ >
320
+ {children}
321
+ </Animated.ScrollView>
322
+ </NativeViewGestureHandler>
323
+ </Animated.View>
324
+ </PanGestureHandler>
325
+ </View>
326
+ </TapGestureHandler>
327
+ </Wrapper>
328
+ );
329
+ };
330
+
331
+ export const AnimatedScrollModal = ({ children }: Props) => {
332
+ const Component = !isTV() ? AnimatedScrollModalComponent : React.Fragment;
333
+
334
+ return <Component>{children}</Component>;
335
+ };
@@ -0,0 +1,144 @@
1
+ import React from "react";
2
+ import { Animated, StyleSheet } from "react-native";
3
+
4
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
5
+ import { PanGestureHandler, State } from "react-native-gesture-handler";
6
+ import {
7
+ useModalAnimationContext,
8
+ PlayerAnimationStateEnum,
9
+ } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
10
+ import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
+
12
+ const generalStyles = StyleSheet.create({
13
+ container: {
14
+ flex: 1,
15
+ width: "100%",
16
+ position: "absolute",
17
+ zIndex: 201,
18
+ },
19
+ });
20
+
21
+ type Props = {
22
+ children: React.ReactNode;
23
+ };
24
+
25
+ export const AnimatedVideoPlayer = ({ children }: Props) => {
26
+ const {
27
+ playerAnimationState,
28
+ setPlayerAnimationState,
29
+ animatedValues: { translateYOffset, dragVideoPlayerY, lastScrollY },
30
+ lastScrollYValue,
31
+ modalSnapPoints,
32
+ lastSnap,
33
+ setLastSnap,
34
+ resetPlayerAnimationState,
35
+ } = useModalAnimationContext();
36
+
37
+ const { videoModalState } = useNavigation();
38
+ const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
39
+ const isMinimizedModal = videoModalState.mode === "MINIMIZED";
40
+
41
+ const onGestureEvent = Animated.event(
42
+ [{ nativeEvent: { translationY: dragVideoPlayerY } }],
43
+ { useNativeDriver: true }
44
+ );
45
+
46
+ const onHandlerStateChange = ({ nativeEvent }) => {
47
+ if (nativeEvent.oldState === State.ACTIVE) {
48
+ // eslint-disable-next-line prefer-const
49
+ const { velocityY, translationY } = nativeEvent;
50
+ const preparedTranslationY = Math.abs(translationY);
51
+ const dragToss = 0.05;
52
+
53
+ if (videoModalState.mode === "MAXIMIZED") {
54
+ if (translationY > 0) {
55
+ const endOffsetY =
56
+ lastSnap + preparedTranslationY + dragToss * velocityY + 150;
57
+
58
+ let destSnapPoint = modalSnapPoints[0];
59
+
60
+ for (const snapPoint of modalSnapPoints) {
61
+ const distFromSnap = Math.abs(snapPoint - endOffsetY);
62
+
63
+ if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
64
+ destSnapPoint = snapPoint;
65
+ }
66
+ }
67
+
68
+ setLastSnap(destSnapPoint);
69
+
70
+ if (destSnapPoint === modalSnapPoints[0]) {
71
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
72
+ } else {
73
+ lastScrollY.setValue(0);
74
+ lastScrollYValue.current = 0;
75
+ setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
76
+ }
77
+ }
78
+ } else if (videoModalState.mode === "MINIMIZED") {
79
+ if (translationY < 0) {
80
+ // from mini to full
81
+ setLastSnap(modalSnapPoints[0]);
82
+ translateYOffset.setValue(modalSnapPoints[1] - preparedTranslationY);
83
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
84
+ } else {
85
+ resetPlayerAnimationState();
86
+ }
87
+ }
88
+ }
89
+ };
90
+
91
+ React.useEffect(() => {
92
+ const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
93
+ ({ value }) => {
94
+ if (
95
+ (isMinimizedModal && value >= 0) ||
96
+ (isMaximazedModal && value <= 0)
97
+ ) {
98
+ if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
99
+ translateYOffset.setValue(
100
+ modalSnapPoints[isMinimizedModal ? 1 : 0]
101
+ );
102
+ }
103
+ } else {
104
+ const preparedValue = Math.round(Math.abs(value));
105
+
106
+ if (
107
+ preparedValue > 0 &&
108
+ playerAnimationState !== PlayerAnimationStateEnum.drag_scroll
109
+ ) {
110
+ playerAnimationState !== PlayerAnimationStateEnum.drag_player &&
111
+ setPlayerAnimationState(PlayerAnimationStateEnum.drag_player);
112
+
113
+ translateYOffset.setValue(
114
+ isMaximazedModal
115
+ ? preparedValue
116
+ : modalSnapPoints[1] - preparedValue
117
+ );
118
+ }
119
+ }
120
+ }
121
+ );
122
+
123
+ return () => {
124
+ dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
125
+ };
126
+ }, [playerAnimationState, isMinimizedModal, isMaximazedModal]);
127
+
128
+ return (
129
+ <PanGestureHandler
130
+ enabled={isMaximazedModal || isMinimizedModal}
131
+ shouldCancelWhenOutside={isMaximazedModal}
132
+ onGestureEvent={onGestureEvent}
133
+ onHandlerStateChange={onHandlerStateChange}
134
+ >
135
+ <Animated.View style={generalStyles.container}>{children}</Animated.View>
136
+ </PanGestureHandler>
137
+ );
138
+ };
139
+
140
+ export const AnimatedVideoPlayerComponent = ({ children }: Props) => {
141
+ const Component = !isTV() ? AnimatedVideoPlayer : React.Fragment;
142
+
143
+ return <Component>{children}</Component>;
144
+ };