@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7725319213 → 12.0.0-alpha.7843515010
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.
- package/Components/AudioPlayer/AudioPlayer.tsx +9 -1
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +5 -0
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.tsx +3 -3
- package/Components/Cell/Cell.tsx +32 -11
- package/Components/Cell/CellWithFocusable.tsx +40 -19
- package/Components/Cell/TvOSCellComponent.tsx +5 -9
- package/Components/ErrorScreen/index.tsx +1 -1
- package/Components/Focusable/Focusable.tsx +6 -1
- package/Components/FocusableCell/index.tsx +7 -7
- package/Components/FocusableGroup/index.tsx +11 -2
- package/Components/FocusableList/FocusableChild.ts +24 -14
- package/Components/FocusableList/FocusableItem.tsx +1 -1
- package/Components/FocusableList/FocusableListItemWrapper.tsx +76 -0
- package/Components/FocusableList/hooks/useCellState.android.ts +3 -1
- package/Components/FocusableList/index.tsx +26 -25
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +6 -3
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
- package/Components/HookRenderer/index.tsx +1 -6
- package/Components/Image/Image.android.tsx +3 -25
- package/Components/Image/Image.tsx +18 -2
- package/Components/Image/utils/index.ts +39 -0
- package/Components/Layout/TV/ScreenContainer.tsx +79 -5
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +20 -108
- package/Components/Layout/TV/index.tsx +15 -84
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +86 -116
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.android.tsx +9 -26
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImageSize.ts +65 -0
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +57 -0
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +37 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +3 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
- package/Components/MasterCell/DefaultComponents/Toggle.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
- package/Components/MasterCell/DefaultComponents/index.ts +2 -0
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +6 -14
- package/Components/MasterCell/dataAdapter.ts +21 -7
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/index.tsx +5 -3
- package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
- package/Components/MasterCell/utils/index.ts +33 -35
- package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
- package/Components/ModalComponent/BottomSheetModalContent.tsx +121 -0
- package/Components/ModalComponent/Button/Item.tsx +82 -0
- package/Components/ModalComponent/Button/ItemIcon.tsx +60 -0
- package/Components/ModalComponent/Button/ItemLabel.tsx +101 -0
- package/Components/ModalComponent/Button/assets.ts +4 -0
- package/Components/ModalComponent/Button/index.tsx +111 -0
- package/Components/ModalComponent/Header/CloseButton.tsx +59 -0
- package/Components/ModalComponent/Header/Title.tsx +70 -0
- package/Components/ModalComponent/Header/assets.ts +4 -0
- package/Components/ModalComponent/Header/index.tsx +71 -0
- package/Components/ModalComponent/Header/utils.ts +79 -0
- package/Components/ModalComponent/index.tsx +38 -0
- package/Components/ModalComponent/utils.ts +126 -0
- package/Components/Navigator/StackNavigator.tsx +57 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +65 -32
- package/Components/PlayerContainer/ProgramInfo/index.tsx +3 -1
- package/Components/PlayerImageBackground/index.tsx +34 -8
- package/Components/River/ComponentsMap/ComponentsMap.tsx +97 -2
- package/Components/River/RefreshControl.tsx +55 -1
- package/Components/River/TV/River.tsx +2 -25
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/River/__tests__/componentsMap.test.js +7 -0
- package/Components/River/useScreenConfiguration.ts +2 -2
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +1 -0
- package/Components/RouteManager/__tests__/routeManager.test.js +9 -2
- package/Components/RouteManager/index.tsx +4 -2
- package/Components/Screen/TV/hooks/index.ts +3 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
- package/Components/Screen/TV/index.web.tsx +165 -0
- package/Components/Screen/__tests__/Screen.test.tsx +91 -74
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +24 -6
- package/Components/Screen/__tests__/navigationHandler.test.ts +1 -178
- package/Components/Screen/index.tsx +110 -53
- package/Components/Screen/navigationHandler.ts +5 -82
- package/Components/ScreenResolver/index.tsx +10 -13
- package/Components/Tabs/TV/styles.ts +1 -1
- package/Components/Transitioner/Scene.tsx +32 -26
- package/Components/Transitioner/Transitioner.tsx +38 -43
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +30 -3
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +79 -48
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +45 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +21 -29
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +66 -0
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +360 -0
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +165 -0
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +456 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +182 -0
- package/Components/VideoModal/ModalAnimation/index.ts +15 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +302 -0
- package/Components/VideoModal/PlayerDetails.tsx +6 -3
- package/Components/VideoModal/PlayerWrapper.tsx +77 -47
- package/Components/VideoModal/VideoModal.tsx +23 -40
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -2
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +12 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +312 -166
- package/Components/VideoModal/hooks/useModalSize.ts +10 -12
- package/Components/VideoModal/utils.ts +8 -5
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +26 -21
- package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
- package/Components/Viewport/ViewportTracker/__tests__/viewportTracker.test.js +4 -5
- package/Components/Viewport/ViewportTracker/index.tsx +1 -0
- package/Components/Viewport/utils.js +1 -1
- package/Components/ZappUIComponent/index.tsx +22 -12
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
- package/Components/index.js +2 -0
- package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
- package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
- package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
- package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
- package/Contexts/FocusableGroupContext/index.ts +7 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
- package/Contexts/MenuToggleContext/{index.js → index.ts} +16 -0
- package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
- package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
- package/Contexts/ScreenContext/index.tsx +95 -29
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
- package/Decorators/ComponentsMapWrapper/withComponentsMapProvider.tsx +7 -2
- package/events/index.ts +1 -0
- package/package.json +5 -5
- package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
- package/Components/VideoModal/hooks/usePosition.ts +0 -50
- /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
- /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
- /package/Contexts/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/* eslint-disable padding-line-between-statements */
|
|
2
|
+
|
|
3
|
+
import { PlayerAnimationStateEnum } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
4
|
+
|
|
5
|
+
export enum ComponentAnimationType {
|
|
6
|
+
bottomBar = "bottomBar",
|
|
7
|
+
player = "player",
|
|
8
|
+
componentFade = "componentFade",
|
|
9
|
+
componentAppears = "componentAppears",
|
|
10
|
+
moveUpComponent = "moveUpComponent",
|
|
11
|
+
moveComponentHorizontal = "moveComponentHorizontal",
|
|
12
|
+
audioPlayerPaddingHorizontal = "audioPlayerPaddingHorizontal",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
|
|
16
|
+
export const PROGRESS_BAR_HEIGHT = 3;
|
|
17
|
+
|
|
18
|
+
export const defaultAspectRatioWidth = (height: number): number =>
|
|
19
|
+
(height / 9) * 16;
|
|
20
|
+
|
|
21
|
+
export const getAnimationStyle = (component, animatedValue) => {
|
|
22
|
+
switch (component) {
|
|
23
|
+
case ComponentAnimationType.bottomBar: {
|
|
24
|
+
return { zIndex: 99, transform: [{ translateY: animatedValue }] };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
case ComponentAnimationType.player: {
|
|
28
|
+
return { width: animatedValue.x, height: animatedValue.y };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
case ComponentAnimationType.componentFade:
|
|
32
|
+
case ComponentAnimationType.componentAppears: {
|
|
33
|
+
return { opacity: animatedValue };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
case ComponentAnimationType.moveUpComponent: {
|
|
37
|
+
return { transform: [{ translateY: animatedValue }] };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
case ComponentAnimationType.audioPlayerPaddingHorizontal:
|
|
41
|
+
case ComponentAnimationType.moveComponentHorizontal: {
|
|
42
|
+
return { transform: [{ translateX: animatedValue }] };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
default:
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getAnimationDefaultValue = (component, bottomTabBarHeight) => {
|
|
51
|
+
switch (component) {
|
|
52
|
+
case ComponentAnimationType.bottomBar: {
|
|
53
|
+
return bottomTabBarHeight;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
case ComponentAnimationType.player: {
|
|
57
|
+
return { x: 0, y: 0 };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
case ComponentAnimationType.componentFade: {
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case ComponentAnimationType.audioPlayerPaddingHorizontal:
|
|
65
|
+
case ComponentAnimationType.moveComponentHorizontal:
|
|
66
|
+
case ComponentAnimationType.componentAppears:
|
|
67
|
+
case ComponentAnimationType.moveUpComponent: {
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const calculateAnimationValue = (animationType, dragPosition, data) => {
|
|
74
|
+
const {
|
|
75
|
+
isAudioItem,
|
|
76
|
+
bottomTabBarHeight,
|
|
77
|
+
minimisedHeight,
|
|
78
|
+
minimisedWidth,
|
|
79
|
+
defaultValue,
|
|
80
|
+
moveUpValue,
|
|
81
|
+
moveComponentHorizontalValue,
|
|
82
|
+
isTablet,
|
|
83
|
+
isTabletLandscape,
|
|
84
|
+
isRTL,
|
|
85
|
+
fromMiniPlayer,
|
|
86
|
+
inlineAudioPlayer,
|
|
87
|
+
} = data;
|
|
88
|
+
|
|
89
|
+
switch (animationType) {
|
|
90
|
+
case ComponentAnimationType.bottomBar: {
|
|
91
|
+
if (fromMiniPlayer) {
|
|
92
|
+
return dragPosition < bottomTabBarHeight
|
|
93
|
+
? dragPosition
|
|
94
|
+
: bottomTabBarHeight;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return dragPosition < bottomTabBarHeight
|
|
98
|
+
? bottomTabBarHeight - dragPosition
|
|
99
|
+
: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
case ComponentAnimationType.player: {
|
|
103
|
+
const value =
|
|
104
|
+
isAudioItem && !inlineAudioPlayer
|
|
105
|
+
? isTabletLandscape
|
|
106
|
+
? fromMiniPlayer
|
|
107
|
+
? { forWidth: 4, forHeight: 4.5 }
|
|
108
|
+
: { forWidth: 3, forHeight: 3 }
|
|
109
|
+
: { forWidth: 2, forHeight: 2 }
|
|
110
|
+
: isTabletLandscape
|
|
111
|
+
? { forWidth: 8, forHeight: 6.5 }
|
|
112
|
+
: { forWidth: 3.5, forHeight: 2 };
|
|
113
|
+
|
|
114
|
+
const minWidth =
|
|
115
|
+
isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
|
|
116
|
+
|
|
117
|
+
if (fromMiniPlayer) {
|
|
118
|
+
const calculationWidth =
|
|
119
|
+
dragPosition * value.forWidth < minWidth
|
|
120
|
+
? minWidth
|
|
121
|
+
: dragPosition * value.forWidth;
|
|
122
|
+
const calculationHeight =
|
|
123
|
+
dragPosition * value.forHeight < minimisedHeight
|
|
124
|
+
? minimisedHeight
|
|
125
|
+
: dragPosition * value.forHeight;
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
x:
|
|
129
|
+
calculationWidth < defaultValue.x
|
|
130
|
+
? calculationWidth
|
|
131
|
+
: defaultValue.x,
|
|
132
|
+
y:
|
|
133
|
+
calculationHeight < defaultValue.y
|
|
134
|
+
? calculationHeight
|
|
135
|
+
: defaultValue.y,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const calculationWidth = defaultValue.x - dragPosition * value.forWidth;
|
|
140
|
+
|
|
141
|
+
const calculationHeight = defaultValue.y - dragPosition * value.forHeight;
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
x: calculationWidth > minWidth ? calculationWidth : minWidth,
|
|
145
|
+
y:
|
|
146
|
+
calculationHeight > minimisedHeight
|
|
147
|
+
? calculationHeight
|
|
148
|
+
: minimisedHeight,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
case ComponentAnimationType.componentFade: {
|
|
153
|
+
if (fromMiniPlayer) {
|
|
154
|
+
const calculation = dragPosition / (isTablet ? 200 : 150);
|
|
155
|
+
|
|
156
|
+
return calculation < 1 ? calculation : 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
|
|
160
|
+
|
|
161
|
+
return calculation > 0 ? calculation : 0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
case ComponentAnimationType.componentAppears: {
|
|
165
|
+
if (fromMiniPlayer) {
|
|
166
|
+
const calculation = 1 - dragPosition / (isTablet ? 200 : 150);
|
|
167
|
+
|
|
168
|
+
return calculation > 0 ? calculation : 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const calculation = dragPosition / (isTablet ? 200 : 150);
|
|
172
|
+
|
|
173
|
+
return calculation < 1 ? calculation : 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
case ComponentAnimationType.moveUpComponent: {
|
|
177
|
+
if (fromMiniPlayer) {
|
|
178
|
+
const calculation =
|
|
179
|
+
moveUpValue + dragPosition / (isTabletLandscape ? 1 : 4);
|
|
180
|
+
|
|
181
|
+
return calculation < 0 ? calculation : 0;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const calculation = 0 - dragPosition / (isTabletLandscape ? 1 : 2);
|
|
185
|
+
|
|
186
|
+
return calculation > moveUpValue ? calculation : moveUpValue;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
case ComponentAnimationType.moveComponentHorizontal: {
|
|
190
|
+
if (fromMiniPlayer) {
|
|
191
|
+
const calculation = isRTL
|
|
192
|
+
? moveComponentHorizontalValue - dragPosition * 2
|
|
193
|
+
: moveComponentHorizontalValue + dragPosition * 2;
|
|
194
|
+
const condition = isRTL ? calculation > 0 : calculation < 0;
|
|
195
|
+
|
|
196
|
+
return condition ? calculation : 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const calculation = isRTL ? dragPosition * 2 : -(dragPosition * 2);
|
|
200
|
+
const condition = isRTL
|
|
201
|
+
? calculation < moveComponentHorizontalValue
|
|
202
|
+
: calculation > moveComponentHorizontalValue;
|
|
203
|
+
|
|
204
|
+
return condition ? calculation : moveComponentHorizontalValue;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
case ComponentAnimationType.audioPlayerPaddingHorizontal: {
|
|
208
|
+
const padding = isRTL
|
|
209
|
+
? AUDIO_PLAYER_HORIZONTAL_PADDING
|
|
210
|
+
: -AUDIO_PLAYER_HORIZONTAL_PADDING;
|
|
211
|
+
|
|
212
|
+
if (fromMiniPlayer) {
|
|
213
|
+
const calculation = isRTL
|
|
214
|
+
? padding - dragPosition / 5
|
|
215
|
+
: padding + dragPosition / 5;
|
|
216
|
+
const condition = isRTL ? calculation > 0 : calculation < 0;
|
|
217
|
+
|
|
218
|
+
return condition ? calculation : 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const calculation = isRTL ? dragPosition / 5 : -(dragPosition / 5);
|
|
222
|
+
const condition = isRTL ? calculation < padding : calculation > padding;
|
|
223
|
+
|
|
224
|
+
return condition ? calculation : padding;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const gestureListenerHelper = (data) => {
|
|
230
|
+
const {
|
|
231
|
+
listenerValue,
|
|
232
|
+
preparedValue,
|
|
233
|
+
animationType,
|
|
234
|
+
animatedValue,
|
|
235
|
+
calculationData,
|
|
236
|
+
modalSnapPoint,
|
|
237
|
+
startComponentsAnimationDistance,
|
|
238
|
+
startComponentsAnimation,
|
|
239
|
+
setStartComponentsAnimation,
|
|
240
|
+
getAnimationValue,
|
|
241
|
+
} = data;
|
|
242
|
+
|
|
243
|
+
if (calculationData.fromMiniPlayer) {
|
|
244
|
+
if (listenerValue <= 0) {
|
|
245
|
+
if (
|
|
246
|
+
preparedValue >= 0 &&
|
|
247
|
+
preparedValue <= modalSnapPoint - startComponentsAnimationDistance
|
|
248
|
+
) {
|
|
249
|
+
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
250
|
+
|
|
251
|
+
animatedValue.setValue(
|
|
252
|
+
calculateAnimationValue(animationType, preparedValue, calculationData)
|
|
253
|
+
);
|
|
254
|
+
} else {
|
|
255
|
+
animatedValue.setValue(calculationData.defaultValue);
|
|
256
|
+
startComponentsAnimation && setStartComponentsAnimation(false);
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
const value = getAnimationValue(
|
|
260
|
+
animationType,
|
|
261
|
+
PlayerAnimationStateEnum.minimize
|
|
262
|
+
).toValue;
|
|
263
|
+
|
|
264
|
+
animatedValue.setValue(value);
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
if (preparedValue >= startComponentsAnimationDistance) {
|
|
268
|
+
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
269
|
+
const value = Math.round(
|
|
270
|
+
preparedValue - startComponentsAnimationDistance
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
animatedValue.setValue(
|
|
274
|
+
calculateAnimationValue(animationType, value, calculationData)
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
animatedValue.setValue(calculationData.defaultValue);
|
|
278
|
+
startComponentsAnimation && setStartComponentsAnimation(false);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export const setScrollModalAnimatedValue = (
|
|
284
|
+
animatedValue,
|
|
285
|
+
value,
|
|
286
|
+
setLastSnap
|
|
287
|
+
) => {
|
|
288
|
+
setLastSnap(value);
|
|
289
|
+
animatedValue.setValue(value);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const resetScrollAnimatedValues = (
|
|
293
|
+
lastScrollY,
|
|
294
|
+
lastScrollYValue,
|
|
295
|
+
dragScrollY,
|
|
296
|
+
dragVideoPlayerY
|
|
297
|
+
) => {
|
|
298
|
+
lastScrollY.setValue(0);
|
|
299
|
+
lastScrollYValue.current = 0;
|
|
300
|
+
dragScrollY.setValue(0);
|
|
301
|
+
dragVideoPlayerY.setValue(0);
|
|
302
|
+
};
|
|
@@ -23,6 +23,8 @@ const containerStyle = ({
|
|
|
23
23
|
backgroundColor: modal_background_color,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
// const audioMarginStyle = { marginTop: 0, marginBottom: 0 };
|
|
27
|
+
|
|
26
28
|
export const PlayerDetails = ({
|
|
27
29
|
entry,
|
|
28
30
|
style,
|
|
@@ -40,12 +42,12 @@ export const PlayerDetails = ({
|
|
|
40
42
|
: {};
|
|
41
43
|
|
|
42
44
|
// Animation setup
|
|
43
|
-
const translateY = useRef(new Animated.Value(
|
|
45
|
+
const translateY = useRef(new Animated.Value(50)).current;
|
|
44
46
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
45
47
|
|
|
46
48
|
const runAnimation = () => {
|
|
47
49
|
Animated.timing(translateY, {
|
|
48
|
-
toValue:
|
|
50
|
+
toValue: -30,
|
|
49
51
|
duration: 500,
|
|
50
52
|
easing: Easing.inOut(Easing.ease),
|
|
51
53
|
useNativeDriver: true,
|
|
@@ -61,7 +63,7 @@ export const PlayerDetails = ({
|
|
|
61
63
|
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
if (isAudioPlayer) {
|
|
64
|
-
setTimeout(() => runAnimation(),
|
|
66
|
+
setTimeout(() => runAnimation(), 1500);
|
|
65
67
|
}
|
|
66
68
|
}, [isAudioPlayer]);
|
|
67
69
|
|
|
@@ -75,6 +77,7 @@ export const PlayerDetails = ({
|
|
|
75
77
|
transform: [{ translateY }],
|
|
76
78
|
opacity,
|
|
77
79
|
},
|
|
80
|
+
// isAudioPlayer && audioMarginStyle,
|
|
78
81
|
]}
|
|
79
82
|
>
|
|
80
83
|
{screenData && (
|
|
@@ -14,10 +14,18 @@ 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";
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
AnimatedScrollModal,
|
|
21
|
+
AnimatedVideoPlayerComponent,
|
|
22
|
+
AnimationComponent,
|
|
23
|
+
ComponentAnimationType,
|
|
24
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
17
25
|
|
|
18
26
|
type DimensionsT = {
|
|
19
27
|
width: number | string;
|
|
20
|
-
height: number | string;
|
|
28
|
+
height: number | string | undefined;
|
|
21
29
|
aspectRatio?: number;
|
|
22
30
|
};
|
|
23
31
|
|
|
@@ -44,6 +52,7 @@ type Props = {
|
|
|
44
52
|
const defaultStyles = StyleSheet.create({
|
|
45
53
|
playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
|
|
46
54
|
playerDetails: { flex: 1, paddingTop: 20 },
|
|
55
|
+
flex: { flex: 1 },
|
|
47
56
|
});
|
|
48
57
|
|
|
49
58
|
const orientationStyles = StyleSheet.create({
|
|
@@ -82,18 +91,9 @@ const safeAreaStyles = (
|
|
|
82
91
|
};
|
|
83
92
|
};
|
|
84
93
|
|
|
85
|
-
const getEdges = (
|
|
86
|
-
isTablet: boolean,
|
|
87
|
-
docked: boolean,
|
|
88
|
-
isInlineModal: boolean
|
|
89
|
-
) => {
|
|
94
|
+
const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
90
95
|
if (isTablet) {
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// mobile
|
|
95
|
-
if (isInlineModal && docked) {
|
|
96
|
-
return ["bottom"];
|
|
96
|
+
return ["top"];
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
if (!isInlineModal && Platform.OS === "android") {
|
|
@@ -151,9 +151,9 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
151
151
|
() => ({
|
|
152
152
|
width:
|
|
153
153
|
isInlineModal && !docked && isTabletLandscape ? tabletWidth : "100%",
|
|
154
|
-
height:
|
|
154
|
+
height: undefined,
|
|
155
155
|
}),
|
|
156
|
-
[isInlineModal, tabletWidth,
|
|
156
|
+
[isInlineModal, tabletWidth, docked]
|
|
157
157
|
);
|
|
158
158
|
|
|
159
159
|
const playerDimensions: DimensionsT = React.useMemo(
|
|
@@ -181,41 +181,71 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
181
181
|
[containerDimensions, playerDimesionsHack]
|
|
182
182
|
);
|
|
183
183
|
|
|
184
|
+
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
|
|
185
|
+
|
|
184
186
|
return (
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
style={[
|
|
199
|
-
defaultStyles.playerContainer,
|
|
200
|
-
containerDimensions,
|
|
201
|
-
containerStyle,
|
|
202
|
-
playerDimesionsHack,
|
|
203
|
-
]}
|
|
187
|
+
<PathnameContext.Provider value={pathname}>
|
|
188
|
+
<ScreenContextProvider pathname={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), defaultStyles.flex]}
|
|
204
201
|
>
|
|
205
|
-
{
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
202
|
+
<PathnameContext.Provider value={pathname}>
|
|
203
|
+
<ScreenContextProvider pathname={pathname}>
|
|
204
|
+
<View
|
|
205
|
+
testID={`${entry?.id}-player-container`}
|
|
206
|
+
style={[
|
|
207
|
+
defaultStyles.playerContainer,
|
|
208
|
+
containerDimensions,
|
|
209
|
+
containerStyle,
|
|
210
|
+
playerDimesionsHack,
|
|
211
|
+
]}
|
|
212
|
+
>
|
|
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 && !docked ? (
|
|
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
|
+
</ScreenContextProvider>
|
|
245
|
+
</PathnameContext.Provider>
|
|
246
|
+
</AnimationComponent>
|
|
247
|
+
</WrapperView>
|
|
218
248
|
</ScreenContextProvider>
|
|
219
|
-
</
|
|
249
|
+
</PathnameContext.Provider>
|
|
220
250
|
);
|
|
221
251
|
};
|
|
@@ -4,9 +4,7 @@ import { StyleSheet, View } from "react-native";
|
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
7
|
-
MenuTypes,
|
|
8
7
|
useNavigation,
|
|
9
|
-
useNavigationType,
|
|
10
8
|
useZappHooksForEntry,
|
|
11
9
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
10
|
import { useIsInitialRender } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
@@ -16,12 +14,12 @@ import {
|
|
|
16
14
|
allowedOrientationsForScreen,
|
|
17
15
|
ORIENTATIONS,
|
|
18
16
|
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
17
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
|
|
19
18
|
|
|
20
19
|
import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
|
|
21
20
|
import { useModalSize } from "./hooks/useModalSize";
|
|
22
21
|
import { useBackgroundColor } from "./hooks/useBackgroundColor";
|
|
23
22
|
import { useInitialPlayerState } from "./hooks/useInitialPlayerState";
|
|
24
|
-
import { usePosition } from "./hooks/usePosition";
|
|
25
23
|
import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
|
|
26
24
|
import { Spinner } from "../Spinner";
|
|
27
25
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
@@ -31,6 +29,8 @@ import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/con
|
|
|
31
29
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
32
30
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
33
31
|
|
|
32
|
+
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
33
|
+
|
|
34
34
|
const styles = StyleSheet.create({
|
|
35
35
|
container: {
|
|
36
36
|
top: 0,
|
|
@@ -59,22 +59,9 @@ const VideoModalComponent = () => {
|
|
|
59
59
|
const onVideoModalHookSuccessAnalyticsEvent = useVideoModalAnalytics();
|
|
60
60
|
|
|
61
61
|
const modalSize = useModalSize();
|
|
62
|
-
|
|
63
62
|
const isFirstRender = useIsInitialRender();
|
|
64
|
-
|
|
65
63
|
const backgroundColor = useBackgroundColor();
|
|
66
64
|
|
|
67
|
-
const { top, height, bottom } = usePosition();
|
|
68
|
-
|
|
69
|
-
const navType = useNavigationType();
|
|
70
|
-
const isBottomBarsNavigation = navType === MenuTypes.bottomTabBar;
|
|
71
|
-
const heightWithSafeArea = height ? height + bottom : null;
|
|
72
|
-
|
|
73
|
-
const dockedHeight =
|
|
74
|
-
isBottomBarsNavigation && height ? height : heightWithSafeArea;
|
|
75
|
-
|
|
76
|
-
const dockedBottom = isBottomBarsNavigation ? bottom : 0;
|
|
77
|
-
|
|
78
65
|
const {
|
|
79
66
|
closeVideoModal,
|
|
80
67
|
setVideoModalItem,
|
|
@@ -83,8 +70,6 @@ const VideoModalComponent = () => {
|
|
|
83
70
|
maximiseVideoModal,
|
|
84
71
|
} = useNavigation();
|
|
85
72
|
|
|
86
|
-
const docked = mode === "MINIMIZED";
|
|
87
|
-
|
|
88
73
|
const logTimestamp = useProfilerLogging();
|
|
89
74
|
|
|
90
75
|
useInitialPlayerState(fullscreenVideoModal, maximiseVideoModal, item);
|
|
@@ -105,9 +90,10 @@ const VideoModalComponent = () => {
|
|
|
105
90
|
}, [item?.id]);
|
|
106
91
|
|
|
107
92
|
const isLandscape = modalSize.width > modalSize.height;
|
|
93
|
+
const isTablet = useIsTablet();
|
|
108
94
|
|
|
109
95
|
React.useEffect(() => {
|
|
110
|
-
if (isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
|
|
96
|
+
if (!isTablet && isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
|
|
111
97
|
fullscreenVideoModal();
|
|
112
98
|
}
|
|
113
99
|
}, [isLandscape]);
|
|
@@ -143,35 +129,32 @@ const VideoModalComponent = () => {
|
|
|
143
129
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
|
|
144
130
|
|
|
145
131
|
return (
|
|
146
|
-
<
|
|
147
|
-
style={[
|
|
148
|
-
styles.container,
|
|
149
|
-
{
|
|
150
|
-
top,
|
|
151
|
-
height: dockedHeight,
|
|
152
|
-
bottom: dockedBottom,
|
|
153
|
-
backgroundColor,
|
|
154
|
-
},
|
|
155
|
-
]}
|
|
156
|
-
>
|
|
132
|
+
<PathnameContext.Provider value={pathname}>
|
|
157
133
|
<ScreenContextProvider pathname={pathname}>
|
|
158
|
-
|
|
159
|
-
|
|
134
|
+
{itemIdHooksFinished === item?.id ? (
|
|
135
|
+
<AnimatedPlayerModalWrapper
|
|
136
|
+
style={[
|
|
137
|
+
styles.container,
|
|
138
|
+
{
|
|
139
|
+
backgroundColor,
|
|
140
|
+
},
|
|
141
|
+
]}
|
|
142
|
+
>
|
|
160
143
|
<HandlePlayable
|
|
161
144
|
item={item}
|
|
162
145
|
isModal={mode !== "PIP"}
|
|
163
|
-
modalHeight={
|
|
146
|
+
modalHeight={modalSize.height}
|
|
164
147
|
modalWidth={modalSize.width}
|
|
165
148
|
mode={mode}
|
|
166
149
|
/>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
150
|
+
</AnimatedPlayerModalWrapper>
|
|
151
|
+
) : (
|
|
152
|
+
<View style={styles.loaderContainer}>
|
|
153
|
+
<Spinner />
|
|
154
|
+
</View>
|
|
155
|
+
)}
|
|
173
156
|
</ScreenContextProvider>
|
|
174
|
-
</
|
|
157
|
+
</PathnameContext.Provider>
|
|
175
158
|
);
|
|
176
159
|
};
|
|
177
160
|
|
|
@@ -21,8 +21,17 @@ const useIsTablet = jest.fn();
|
|
|
21
21
|
|
|
22
22
|
jest.mock("react-native");
|
|
23
23
|
|
|
24
|
+
jest.mock("react-native-gesture-handler");
|
|
25
|
+
|
|
24
26
|
jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
|
|
25
27
|
|
|
28
|
+
jest.mock(
|
|
29
|
+
"@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
|
|
30
|
+
() => ({
|
|
31
|
+
useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
26
35
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
|
|
27
36
|
useIsTablet,
|
|
28
37
|
}));
|
|
@@ -38,6 +47,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
|
38
47
|
}));
|
|
39
48
|
|
|
40
49
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
50
|
+
isNavBarVisible: jest.fn(() => true),
|
|
41
51
|
useRoute: jest.fn(() => ({
|
|
42
52
|
pathname: "/river/testId",
|
|
43
53
|
})),
|
|
@@ -45,6 +55,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
|
45
55
|
canGoBack: () => false,
|
|
46
56
|
currentRoute: "/river/testId",
|
|
47
57
|
data: { screen: { id: "testId" } },
|
|
58
|
+
videoModalState: { visible: false },
|
|
48
59
|
})),
|
|
49
60
|
}));
|
|
50
61
|
|
|
@@ -94,7 +105,7 @@ describe("PlayerWrapper", () => {
|
|
|
94
105
|
useIsTablet.mockReturnValue(false);
|
|
95
106
|
|
|
96
107
|
const children = jest.fn(() => {});
|
|
97
|
-
const dimensions = { height:
|
|
108
|
+
const dimensions = { height: undefined, width: props.style.width };
|
|
98
109
|
|
|
99
110
|
const element = renderWithProviders(
|
|
100
111
|
<PlayerWrapper
|