@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6523249552 → 13.0.0-alpha.6651373134
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/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.tsx +1 -2
- package/Components/Cell/Cell.tsx +4 -13
- package/Components/Cell/CellWithFocusable.tsx +48 -59
- package/Components/Cell/CellWrapper.ts +5 -0
- package/Components/Cell/TvOSCellComponent.tsx +20 -22
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/index.js +3 -1
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/ErrorScreen/index.tsx +14 -6
- package/Components/Focusable/Focusable.tsx +1 -0
- package/Components/Focusable/FocusableTvOS.tsx +5 -1
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/FocusableList/index.tsx +26 -9
- package/Components/FocusableScrollView/index.tsx +43 -13
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
- package/Components/Layout/TV/NavBarContainer.tsx +19 -23
- package/Components/Layout/TV/ScreenContainer.tsx +8 -1
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +8 -134
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +6 -6
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +17 -13
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +37 -2
- package/Components/River/TV/index.tsx +6 -1
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/componentsMap.test.js +3 -4
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/hooks.ts +53 -0
- package/Components/Screen/index.tsx +16 -43
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Tabs/Tab.tsx +5 -3
- package/Components/TextInputTv/index.tsx +2 -1
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/Scene.tsx +1 -1
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -68
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +7 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +44 -30
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +24 -11
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -5
- package/Components/VideoModal/PlayerDetails.tsx +9 -6
- package/Components/VideoModal/PlayerWrapper.tsx +28 -5
- package/Components/VideoModal/VideoModal.tsx +2 -2
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +3 -16
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +49 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +3 -10
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +4 -30
- package/package.json +7 -11
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Animated, StyleSheet, View
|
|
2
|
+
import { Animated, Platform, StyleSheet, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import {
|
|
6
|
+
GestureHandlerRootView,
|
|
6
7
|
NativeViewGestureHandler,
|
|
7
8
|
PanGestureHandler,
|
|
8
9
|
State,
|
|
9
10
|
TapGestureHandler,
|
|
10
|
-
GestureHandlerRootView,
|
|
11
11
|
} from "react-native-gesture-handler";
|
|
12
12
|
|
|
13
13
|
import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
|
|
14
14
|
import {
|
|
15
|
-
useModalAnimationContext,
|
|
16
15
|
PlayerAnimationStateEnum,
|
|
16
|
+
useModalAnimationContext,
|
|
17
17
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
18
18
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
19
19
|
import { usePrevious } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
setScrollModalAnimatedValue,
|
|
23
22
|
resetScrollAnimatedValues,
|
|
23
|
+
setScrollModalAnimatedValue,
|
|
24
24
|
} from "./utils";
|
|
25
25
|
|
|
26
26
|
const getAnimatedConfig = (toValue) => {
|
|
@@ -70,21 +70,26 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
70
70
|
const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
|
|
71
71
|
useNavigation();
|
|
72
72
|
|
|
73
|
-
const {
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const {
|
|
74
|
+
mode: videoModalMode,
|
|
75
|
+
previousMode: previousVideoModalMode,
|
|
76
|
+
item: videoModalItem,
|
|
77
|
+
} = videoModalState;
|
|
78
|
+
|
|
79
|
+
const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
|
|
80
|
+
const isMinimizedModal: boolean = videoModalMode === "MINIMIZED";
|
|
76
81
|
const previousItemId = usePrevious(videoModalItem?.id);
|
|
77
82
|
|
|
78
83
|
const isNotMinimizeMaximazeAnimation =
|
|
79
84
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
80
|
-
playerAnimationState !== PlayerAnimationStateEnum.
|
|
85
|
+
playerAnimationState !== PlayerAnimationStateEnum.maximize;
|
|
81
86
|
|
|
82
87
|
const isEnablePanGesture =
|
|
83
88
|
enableGesture &&
|
|
84
89
|
!isLanguageOverlayVisible &&
|
|
85
90
|
isNotMinimizeMaximazeAnimation &&
|
|
86
91
|
!isSeekBarTouch &&
|
|
87
|
-
(
|
|
92
|
+
(isMaximizedModal || isMinimizedModal);
|
|
88
93
|
|
|
89
94
|
const isAudioItem = React.useMemo(
|
|
90
95
|
() =>
|
|
@@ -121,7 +126,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
121
126
|
const preparedTranslationY =
|
|
122
127
|
Math.abs(translationY) - lastScrollYValue.current;
|
|
123
128
|
|
|
124
|
-
if (
|
|
129
|
+
if (isMaximizedModal) {
|
|
125
130
|
const endOffsetY =
|
|
126
131
|
lastSnap + preparedTranslationY + dragToss * velocityY + 150;
|
|
127
132
|
|
|
@@ -137,14 +142,14 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
137
142
|
|
|
138
143
|
setLastSnap(destSnapPoint);
|
|
139
144
|
|
|
140
|
-
if (destSnapPoint === modalSnapPoints[0]) {
|
|
145
|
+
if (destSnapPoint === modalSnapPoints[0] && isMinimizedModal) {
|
|
141
146
|
translateYOffset.extractOffset();
|
|
142
147
|
translateYOffset.setValue(preparedTranslationY);
|
|
143
148
|
translateYOffset.flattenOffset();
|
|
144
149
|
dragScrollY.setValue(0);
|
|
145
150
|
|
|
146
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
147
|
-
} else {
|
|
151
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
152
|
+
} else if (destSnapPoint !== modalSnapPoints[0] && isMaximizedModal) {
|
|
148
153
|
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
149
154
|
}
|
|
150
155
|
} else {
|
|
@@ -158,7 +163,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
158
163
|
|
|
159
164
|
dragScrollY.setValue(0);
|
|
160
165
|
|
|
161
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
166
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
162
167
|
} else {
|
|
163
168
|
resetPlayerAnimationState();
|
|
164
169
|
}
|
|
@@ -168,7 +173,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
168
173
|
resetPlayerAnimationState();
|
|
169
174
|
}
|
|
170
175
|
},
|
|
171
|
-
[
|
|
176
|
+
[
|
|
177
|
+
lastSnap,
|
|
178
|
+
modalSnapPoints,
|
|
179
|
+
playerAnimationState,
|
|
180
|
+
isMinimizedModal,
|
|
181
|
+
isMaximizedModal,
|
|
182
|
+
]
|
|
172
183
|
);
|
|
173
184
|
|
|
174
185
|
const onScroll = React.useCallback(({ nativeEvent }) => {
|
|
@@ -219,17 +230,18 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
219
230
|
}, []);
|
|
220
231
|
|
|
221
232
|
React.useEffect(() => {
|
|
222
|
-
const { mode, previousMode, item } = videoModalState;
|
|
223
|
-
|
|
224
233
|
if (
|
|
225
|
-
|
|
234
|
+
videoModalMode === "MAXIMIZED" &&
|
|
226
235
|
!enableGesture &&
|
|
227
236
|
scrollPosition.current === 0
|
|
228
237
|
) {
|
|
229
238
|
setIEnableGesture(true);
|
|
230
239
|
}
|
|
231
240
|
|
|
232
|
-
if (
|
|
241
|
+
if (
|
|
242
|
+
videoModalMode === "MINIMIZED" &&
|
|
243
|
+
previousVideoModalMode === "MAXIMIZED"
|
|
244
|
+
) {
|
|
233
245
|
// set animation to the minimize values if moving from the player to another screen
|
|
234
246
|
if (playerAnimationState === null) {
|
|
235
247
|
setScrollModalAnimatedValue(
|
|
@@ -247,14 +259,16 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
247
259
|
}
|
|
248
260
|
} else if (
|
|
249
261
|
playerAnimationState === null &&
|
|
250
|
-
((previousItemId ===
|
|
251
|
-
|
|
252
|
-
(
|
|
253
|
-
|
|
262
|
+
((previousItemId === videoModalItem?.id &&
|
|
263
|
+
videoModalMode === "MAXIMIZED" &&
|
|
264
|
+
(previousVideoModalMode === "MINIMIZED" ||
|
|
265
|
+
previousVideoModalMode === "MAXIMIZED")) ||
|
|
266
|
+
(previousItemId !== videoModalItem?.id &&
|
|
267
|
+
videoModalMode !== "FULLSCREEN"))
|
|
254
268
|
) {
|
|
255
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
269
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
256
270
|
}
|
|
257
|
-
}, [
|
|
271
|
+
}, [videoModalMode, previousVideoModalMode, videoModalItem]);
|
|
258
272
|
|
|
259
273
|
React.useEffect(() => {
|
|
260
274
|
if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
|
|
@@ -296,7 +310,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
296
310
|
|
|
297
311
|
resetPlayerAnimationState();
|
|
298
312
|
});
|
|
299
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
313
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
300
314
|
Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
|
|
301
315
|
maximiseVideoModal();
|
|
302
316
|
setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
|
|
@@ -346,6 +360,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
346
360
|
[]
|
|
347
361
|
);
|
|
348
362
|
|
|
363
|
+
const scrollEnabled = isMaximizedModal && isNotMinimizeMaximazeAnimation;
|
|
364
|
+
|
|
349
365
|
return (
|
|
350
366
|
<Wrapper style={generalStyles.container}>
|
|
351
367
|
<TapGestureHandler
|
|
@@ -359,7 +375,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
359
375
|
enabled={isEnablePanGesture}
|
|
360
376
|
ref={panHandlerRef}
|
|
361
377
|
simultaneousHandlers={[scrollRef, tapHandlerRef]}
|
|
362
|
-
shouldCancelWhenOutside={
|
|
378
|
+
shouldCancelWhenOutside={isMaximizedModal}
|
|
363
379
|
onGestureEvent={onGestureEvent}
|
|
364
380
|
onHandlerStateChange={onHandlerStateChange}
|
|
365
381
|
activeOffsetY={[-5, 5]}
|
|
@@ -371,9 +387,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
371
387
|
simultaneousHandlers={panHandlerRef}
|
|
372
388
|
>
|
|
373
389
|
<Animated.ScrollView
|
|
374
|
-
scrollEnabled={
|
|
375
|
-
isMaximazedModal && isNotMinimizeMaximazeAnimation
|
|
376
|
-
}
|
|
390
|
+
scrollEnabled={scrollEnabled}
|
|
377
391
|
bounces={false}
|
|
378
392
|
onScrollBeginDrag={onRegisterLastScroll}
|
|
379
393
|
onScroll={onScroll}
|
|
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
50
50
|
|
|
51
51
|
const isNotMinimizeMaximazeAnimation =
|
|
52
52
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
53
|
-
playerAnimationState !== PlayerAnimationStateEnum.
|
|
53
|
+
playerAnimationState !== PlayerAnimationStateEnum.maximize;
|
|
54
54
|
|
|
55
55
|
const isEnablePanGesture =
|
|
56
56
|
!isLanguageOverlayVisible &&
|
|
@@ -89,7 +89,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
89
89
|
setLastSnap(destSnapPoint);
|
|
90
90
|
|
|
91
91
|
if (destSnapPoint === modalSnapPoints[0]) {
|
|
92
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
92
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
93
93
|
} else {
|
|
94
94
|
lastScrollY.setValue(0);
|
|
95
95
|
lastScrollYValue.current = 0;
|
|
@@ -105,7 +105,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
105
105
|
modalSnapPoints[1] - preparedTranslationY
|
|
106
106
|
);
|
|
107
107
|
|
|
108
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.
|
|
108
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
|
|
109
109
|
} else {
|
|
110
110
|
resetPlayerAnimationState();
|
|
111
111
|
}
|
|
@@ -4,26 +4,26 @@ import { Animated, View } from "react-native";
|
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
useModalAnimationContext,
|
|
8
7
|
PlayerAnimationStateEnum,
|
|
8
|
+
useModalAnimationContext,
|
|
9
9
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
+
useDimensions,
|
|
12
13
|
useGetBottomTabBarHeight,
|
|
13
14
|
useNavigation,
|
|
14
|
-
useDimensions,
|
|
15
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
16
16
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
17
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
18
|
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
22
|
+
ComponentAnimationType,
|
|
23
23
|
defaultAspectRatioWidth,
|
|
24
|
+
gestureListenerHelper,
|
|
24
25
|
getAnimationDefaultValue,
|
|
25
|
-
|
|
26
|
-
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
26
|
+
getAnimationStyle,
|
|
27
27
|
} from "./utils";
|
|
28
28
|
|
|
29
29
|
type Props = {
|
|
@@ -228,6 +228,8 @@ export const AnimationView = ({
|
|
|
228
228
|
isAudioItem,
|
|
229
229
|
moveUpValue,
|
|
230
230
|
moveComponentHorizontalValue,
|
|
231
|
+
isRTL,
|
|
232
|
+
inlineAudioPlayer,
|
|
231
233
|
]
|
|
232
234
|
);
|
|
233
235
|
|
|
@@ -246,7 +248,7 @@ export const AnimationView = ({
|
|
|
246
248
|
default:
|
|
247
249
|
return getAnimationValue(
|
|
248
250
|
animationType,
|
|
249
|
-
PlayerAnimationStateEnum.
|
|
251
|
+
PlayerAnimationStateEnum.maximize
|
|
250
252
|
).toValue;
|
|
251
253
|
}
|
|
252
254
|
}, [defaultValue, videoModalState]);
|
|
@@ -278,6 +280,11 @@ export const AnimationView = ({
|
|
|
278
280
|
moveUpValue,
|
|
279
281
|
moveComponentHorizontalValue,
|
|
280
282
|
videoModalMode,
|
|
283
|
+
isAudioItem,
|
|
284
|
+
isTablet,
|
|
285
|
+
isTabletLandscape,
|
|
286
|
+
isRTL,
|
|
287
|
+
inlineAudioPlayer,
|
|
281
288
|
]
|
|
282
289
|
);
|
|
283
290
|
|
|
@@ -306,7 +313,7 @@ export const AnimationView = ({
|
|
|
306
313
|
}
|
|
307
314
|
|
|
308
315
|
if (
|
|
309
|
-
videoModalMode === "MAXIMIZED" &&
|
|
316
|
+
(videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
|
|
310
317
|
defaultValue.x !== screenWidth &&
|
|
311
318
|
width &&
|
|
312
319
|
height
|
|
@@ -332,7 +339,13 @@ export const AnimationView = ({
|
|
|
332
339
|
animatedValue.setValue(value);
|
|
333
340
|
}
|
|
334
341
|
}
|
|
335
|
-
}, [
|
|
342
|
+
}, [
|
|
343
|
+
animatedValue,
|
|
344
|
+
animationType,
|
|
345
|
+
getAnimationValue,
|
|
346
|
+
playerAnimationState,
|
|
347
|
+
videoModalState,
|
|
348
|
+
]);
|
|
336
349
|
|
|
337
350
|
React.useEffect(() => {
|
|
338
351
|
if (
|
|
@@ -344,7 +357,7 @@ export const AnimationView = ({
|
|
|
344
357
|
animatedValue,
|
|
345
358
|
getAnimationValue(animationType, playerAnimationState)
|
|
346
359
|
).start();
|
|
347
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
360
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
348
361
|
animatedValue.setValue(defaultValue);
|
|
349
362
|
}
|
|
350
363
|
}, [playerAnimationState, startComponentsAnimation, defaultValue]);
|
|
@@ -405,7 +418,7 @@ export const AnimationView = ({
|
|
|
405
418
|
|
|
406
419
|
return (
|
|
407
420
|
<Animated.View
|
|
408
|
-
onLayout={additionalData.useLayoutMeasure
|
|
421
|
+
onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
|
|
409
422
|
ref={animationComponentRef}
|
|
410
423
|
style={[
|
|
411
424
|
...preparedStyles,
|
|
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
|
|
|
14
14
|
|
|
15
15
|
export enum PlayerAnimationStateEnum {
|
|
16
16
|
minimize = "minimize",
|
|
17
|
-
|
|
17
|
+
maximize = "maximize",
|
|
18
18
|
drag_player = "drag_player",
|
|
19
19
|
drag_scroll = "drag_scroll",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
22
|
+
export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
23
23
|
|
|
24
24
|
export type ModalAnimationContextT = {
|
|
25
25
|
isActiveGesture: boolean;
|
|
@@ -118,11 +118,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
118
118
|
If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
|
|
119
119
|
Because of this we need to minus bottom SafeArea offset.
|
|
120
120
|
*/
|
|
121
|
+
|
|
121
122
|
const minValue =
|
|
122
123
|
height -
|
|
123
|
-
minimisedHeight
|
|
124
|
-
(bottomTabBarHeight || bottomSafeArea) -
|
|
125
|
-
progressBarHeight;
|
|
124
|
+
(minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
|
|
126
125
|
|
|
127
126
|
const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
|
|
128
127
|
// Last snap state which will helps us to make smooth responder to scrollview animation
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
2
|
import {
|
|
3
|
-
StyleProp,
|
|
4
|
-
ViewStyle,
|
|
5
3
|
Animated,
|
|
6
|
-
Easing,
|
|
7
4
|
Dimensions,
|
|
5
|
+
Easing,
|
|
6
|
+
StyleProp,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
StyleSheet,
|
|
8
9
|
} from "react-native";
|
|
9
10
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
10
11
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
@@ -90,17 +91,19 @@ export const PlayerDetails = ({
|
|
|
90
91
|
{
|
|
91
92
|
// workaround for avoid wrong text-height after going back to portrait rotation
|
|
92
93
|
// we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
|
|
93
|
-
width: isTablet
|
|
94
|
+
width: isTablet
|
|
95
|
+
? undefined
|
|
96
|
+
: (StyleSheet.flatten(style)?.width ?? SCREEN_WIDTH),
|
|
94
97
|
},
|
|
95
98
|
]}
|
|
96
99
|
>
|
|
97
|
-
{screenData
|
|
100
|
+
{screenData ? (
|
|
98
101
|
<ComponentsMap
|
|
99
102
|
riverId={screenData.id}
|
|
100
103
|
feed={screenData?.data?.source}
|
|
101
104
|
riverComponents={screenData.ui_components}
|
|
102
105
|
/>
|
|
103
|
-
)}
|
|
106
|
+
) : null}
|
|
104
107
|
</Animated.View>
|
|
105
108
|
);
|
|
106
109
|
};
|
|
@@ -100,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
|
100
100
|
return ["top"];
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
const isPercentage = (value: string | number): boolean => {
|
|
104
|
+
if (typeof value === "string") {
|
|
105
|
+
return value.includes("%");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return false;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const getPercentageOf = (percent: string, value: number) => {
|
|
112
|
+
const percentageValue = parseFloat(percent.replace("%", ""));
|
|
113
|
+
|
|
114
|
+
if (isNaN(percentageValue)) {
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (value * percentageValue) / 100;
|
|
119
|
+
};
|
|
120
|
+
|
|
103
121
|
const getTabletWidth = (
|
|
104
122
|
configuration: Configuration,
|
|
105
123
|
dimensions: DimensionsT
|
|
@@ -108,18 +126,23 @@ const getTabletWidth = (
|
|
|
108
126
|
configuration?.tablet_landscape_sidebar_width;
|
|
109
127
|
|
|
110
128
|
const { width } = dimensions;
|
|
129
|
+
let widthValue = Number(width);
|
|
130
|
+
|
|
131
|
+
if (isPercentage(width)) {
|
|
132
|
+
widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
|
|
133
|
+
}
|
|
111
134
|
|
|
112
135
|
const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
|
|
113
136
|
|
|
114
137
|
if (tablet_landscape_sidebar_width?.includes("%")) {
|
|
115
|
-
return
|
|
138
|
+
return widthValue * (1 - sidebarWidth / 100);
|
|
116
139
|
}
|
|
117
140
|
|
|
118
141
|
if (Number.isNaN(sidebarWidth)) {
|
|
119
|
-
return
|
|
142
|
+
return widthValue * 0.65;
|
|
120
143
|
}
|
|
121
144
|
|
|
122
|
-
return
|
|
145
|
+
return widthValue - sidebarWidth;
|
|
123
146
|
};
|
|
124
147
|
|
|
125
148
|
const PlayerWrapperComponent = (props: Props) => {
|
|
@@ -227,7 +250,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
227
250
|
</View>
|
|
228
251
|
|
|
229
252
|
<AnimatedScrollModal>
|
|
230
|
-
{isShowPlayerDetails
|
|
253
|
+
{isShowPlayerDetails ? (
|
|
231
254
|
<AnimationComponent
|
|
232
255
|
animationType={ComponentAnimationType.componentFade}
|
|
233
256
|
style={defaultStyles.flex}
|
|
@@ -240,7 +263,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
240
263
|
isTablet={isTablet}
|
|
241
264
|
/>
|
|
242
265
|
</AnimationComponent>
|
|
243
|
-
)}
|
|
266
|
+
) : null}
|
|
244
267
|
</AnimatedScrollModal>
|
|
245
268
|
</AnimationComponent>
|
|
246
269
|
</WrapperView>
|
|
@@ -137,14 +137,14 @@ const VideoModalComponent = () => {
|
|
|
137
137
|
styles.container,
|
|
138
138
|
{
|
|
139
139
|
backgroundColor,
|
|
140
|
+
width: modalSize.width,
|
|
141
|
+
height: modalSize.height,
|
|
140
142
|
},
|
|
141
143
|
]}
|
|
142
144
|
>
|
|
143
145
|
<HandlePlayable
|
|
144
146
|
item={item}
|
|
145
147
|
isModal={mode !== "PIP"}
|
|
146
|
-
modalHeight={modalSize.height}
|
|
147
|
-
modalWidth={modalSize.width}
|
|
148
148
|
mode={mode}
|
|
149
149
|
/>
|
|
150
150
|
</AnimatedPlayerModalWrapper>
|
package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap
CHANGED
|
@@ -33,45 +33,33 @@ exports[`<ViewportAware /> invokes the onViewportLeave function when leaving the
|
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
35
|
exports[`<ViewportAware /> passes the correct view port flag 1`] = `
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
<RCTScrollView
|
|
37
|
+
onContentSizeChange={[Function]}
|
|
38
|
+
onLayout={[Function]}
|
|
39
|
+
onScroll={[Function]}
|
|
40
40
|
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
<View>
|
|
42
|
+
<RCTScrollView
|
|
43
|
+
testID="test-component-false"
|
|
44
|
+
>
|
|
45
|
+
<View />
|
|
46
|
+
</RCTScrollView>
|
|
47
|
+
</View>
|
|
48
|
+
</RCTScrollView>
|
|
45
49
|
`;
|
|
46
50
|
|
|
47
51
|
exports[`<ViewportAware /> renders its children correctly 1`] = `
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"lastEvent": null,
|
|
53
|
-
"listeners": [],
|
|
54
|
-
"notify": [Function],
|
|
55
|
-
}
|
|
56
|
-
}
|
|
52
|
+
<RCTScrollView
|
|
53
|
+
onContentSizeChange={[Function]}
|
|
54
|
+
onLayout={[Function]}
|
|
55
|
+
onScroll={[Function]}
|
|
57
56
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
>
|
|
68
|
-
<ScrollView>
|
|
69
|
-
<TestComponent
|
|
70
|
-
onViewportEnter={[MockFunction]}
|
|
71
|
-
onViewportLeave={[MockFunction]}
|
|
72
|
-
preTriggerRatio={0.1}
|
|
73
|
-
/>
|
|
74
|
-
</ScrollView>
|
|
75
|
-
</ViewportTracker>
|
|
76
|
-
</ContextProvider>
|
|
57
|
+
<View>
|
|
58
|
+
<RCTScrollView
|
|
59
|
+
testID="test-component-false"
|
|
60
|
+
>
|
|
61
|
+
<View />
|
|
62
|
+
</RCTScrollView>
|
|
63
|
+
</View>
|
|
64
|
+
</RCTScrollView>
|
|
77
65
|
`;
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
5
|
+
import { act, create as render } from "react-test-renderer";
|
|
6
|
+
|
|
7
|
+
import { ViewportAware } from "../";
|
|
8
|
+
import { ViewportTracker } from "../../ViewportTracker";
|
|
8
9
|
|
|
9
10
|
import { ViewportEvents } from "../../ViewportEvents";
|
|
11
|
+
import ReactNative from "react-native";
|
|
10
12
|
|
|
11
13
|
jest.useFakeTimers();
|
|
12
14
|
|
|
@@ -24,17 +26,10 @@ jest.mock("react-native/Libraries/Renderer/shims/ReactNative", () => ({
|
|
|
24
26
|
findNodeHandle: () => 1234,
|
|
25
27
|
}));
|
|
26
28
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const { Animated, ScrollView } = ReactNative;
|
|
30
|
-
|
|
31
|
-
Animated.timing = jest.fn(() => ({ start: jest.fn() }));
|
|
29
|
+
const { ScrollView } = ReactNative;
|
|
32
30
|
|
|
33
31
|
const viewportEventsManager = new ViewportEvents(true);
|
|
34
32
|
|
|
35
|
-
const { ViewportAware } = require("../");
|
|
36
|
-
const { ViewportTracker } = require("../../ViewportTracker");
|
|
37
|
-
|
|
38
33
|
const TestComponent = (props) => {
|
|
39
34
|
const {
|
|
40
35
|
preTriggerRatio,
|
|
@@ -90,7 +85,7 @@ describe("<ViewportAware />", () => {
|
|
|
90
85
|
});
|
|
91
86
|
|
|
92
87
|
it("renders its children correctly", () => {
|
|
93
|
-
const wrapper =
|
|
88
|
+
const wrapper = render(
|
|
94
89
|
getWrapper(() => (
|
|
95
90
|
<TestComponent
|
|
96
91
|
preTriggerRatio={0.1}
|
|
@@ -100,11 +95,11 @@ describe("<ViewportAware />", () => {
|
|
|
100
95
|
))
|
|
101
96
|
);
|
|
102
97
|
|
|
103
|
-
expect(
|
|
98
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
it("passes the correct view port flag", () => {
|
|
107
|
-
const wrapper =
|
|
102
|
+
const wrapper = render(
|
|
108
103
|
getWrapper(() => (
|
|
109
104
|
<TestComponent
|
|
110
105
|
preTriggerRatio={0.1}
|
|
@@ -114,12 +109,11 @@ describe("<ViewportAware />", () => {
|
|
|
114
109
|
))
|
|
115
110
|
);
|
|
116
111
|
|
|
117
|
-
|
|
118
|
-
expect(shallowToJson(testComponentWrapper.shallow())).toMatchSnapshot();
|
|
112
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
119
113
|
});
|
|
120
114
|
|
|
121
115
|
it("invokes the onViewportEnter function when entering the viewport", () => {
|
|
122
|
-
const wrapper =
|
|
116
|
+
const wrapper = render(
|
|
123
117
|
getWrapper(() => (
|
|
124
118
|
<TestComponent
|
|
125
119
|
preTriggerRatio={0.1}
|
|
@@ -156,7 +150,7 @@ describe("<ViewportAware />", () => {
|
|
|
156
150
|
});
|
|
157
151
|
|
|
158
152
|
it("invokes the onViewportLeave function when leaving the viewport", () => {
|
|
159
|
-
const wrapper =
|
|
153
|
+
const wrapper = render(
|
|
160
154
|
getWrapper(() => (
|
|
161
155
|
<TestComponent
|
|
162
156
|
preTriggerRatio={0.1}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { View } from "react-native";
|
|
4
|
-
import {
|
|
4
|
+
import { render } from "@testing-library/react-native";
|
|
5
5
|
import { callOnChildren, isInViewport } from "../utils";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// IDK what this is doing
|
|
8
|
+
describe.skip("callOnChildren", () => {
|
|
8
9
|
const arg1 = "arg1";
|
|
9
10
|
const arg2 = "arg2";
|
|
10
11
|
|
|
@@ -28,7 +29,7 @@ describe("callOnChildren", () => {
|
|
|
28
29
|
});
|
|
29
30
|
|
|
30
31
|
it("calls the method on the child component's props if it exists", () => {
|
|
31
|
-
|
|
32
|
+
render(
|
|
32
33
|
<TestComponent
|
|
33
34
|
isMounted={() => {
|
|
34
35
|
expect(testMethod).toHaveBeenCalledWith(arg1, arg2);
|
|
@@ -40,7 +41,7 @@ describe("callOnChildren", () => {
|
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
it("fails silently if the child component doesn't have any prop", () => {
|
|
43
|
-
|
|
44
|
+
render(
|
|
44
45
|
<TestComponent
|
|
45
46
|
isMounted={() => {
|
|
46
47
|
expect(testMethod).not.toHaveBeenCalled();
|
|
@@ -30,5 +30,7 @@ export const Placeholder = ({ readyToBeDisplayed }: Props) => {
|
|
|
30
30
|
|
|
31
31
|
if (readyToBeDisplayed && !isTV()) return null;
|
|
32
32
|
|
|
33
|
-
return
|
|
33
|
+
return (
|
|
34
|
+
<View testID="ZappUIComponent-placeholder" style={styles.placeholder} />
|
|
35
|
+
);
|
|
34
36
|
};
|