@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4620237415 → 12.0.0-alpha.4739493702
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/Cell/Cell.tsx +1 -8
- package/Components/Focusable/index.android.tsx +9 -15
- package/Components/FocusableList/FocusableChild.ts +2 -2
- package/Components/FocusableList/index.tsx +12 -11
- package/Components/FocusableScrollView/index.tsx +1 -1
- package/Components/Image/Image.android.tsx +1 -1
- package/Components/MasterCell/DefaultComponents/CellBadge/index.tsx +1 -6
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +0 -12
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -6
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/utils/index.ts +4 -3
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -14
- package/Components/Transitioner/Transitioner.tsx +3 -13
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +9 -3
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +40 -38
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +6 -9
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +26 -28
- package/Components/VideoModal/PlayerDetails.tsx +2 -16
- package/Components/VideoModal/PlayerWrapper.tsx +10 -40
- package/Components/VideoModal/VideoModal.tsx +27 -33
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +0 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +0 -2
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +10 -56
- package/Components/ZappFrameworkComponents/BarView/BarView.tsx +1 -4
- package/Components/ZappFrameworkComponents/BarView/Buttons/BackButton.tsx +2 -7
- package/Components/ZappFrameworkComponents/BarView/Buttons/CloseButton.tsx +2 -7
- package/Components/ZappFrameworkComponents/Buttons/ActionButton.tsx +4 -9
- package/Contexts/CachedDimensionsContext/index.ts +9 -13
- package/Contexts/ConfirmDialogState/index.ts +1 -1
- package/Contexts/ScreenContext/index.tsx +1 -6
- package/const.ts +0 -6
- package/index.js +0 -3
- package/package.json +5 -5
- package/Components/Focusable/__tests__/index.android.test.tsx +0 -72
- package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +0 -87
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -276,20 +276,13 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
276
276
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
277
277
|
>
|
|
278
278
|
{(focused, event) => {
|
|
279
|
-
const isFocused = this.isCellFocused(focused);
|
|
280
|
-
|
|
281
|
-
if (isFocused) {
|
|
282
|
-
const accessibilityManager = AccessibilityManager.getInstance();
|
|
283
|
-
accessibilityManager.readText({ text: item.title });
|
|
284
|
-
}
|
|
285
|
-
|
|
286
279
|
return (
|
|
287
280
|
<FocusableCell
|
|
288
281
|
{...{
|
|
289
282
|
index,
|
|
290
283
|
CellRenderer,
|
|
291
284
|
item,
|
|
292
|
-
focused:
|
|
285
|
+
focused: this.isCellFocused(focused),
|
|
293
286
|
scrollTo: this.scrollToIndex(event),
|
|
294
287
|
behavior,
|
|
295
288
|
}}
|
|
@@ -128,10 +128,7 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
128
128
|
|
|
129
129
|
const _onBlur = React.useCallback(
|
|
130
130
|
(ref, options = {}) => {
|
|
131
|
-
|
|
132
|
-
setFocused(false);
|
|
133
|
-
}
|
|
134
|
-
|
|
131
|
+
setFocused(false);
|
|
135
132
|
onBlur?.(ref, options);
|
|
136
133
|
},
|
|
137
134
|
[onBlur]
|
|
@@ -151,14 +148,15 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
151
148
|
[isRTL, nextFocusDown, nextFocusUp, nextFocusLeft, nextFocusRight]
|
|
152
149
|
);
|
|
153
150
|
|
|
154
|
-
const contextState = React.useMemo(
|
|
155
|
-
|
|
151
|
+
const contextState = React.useMemo(
|
|
152
|
+
() => ({
|
|
156
153
|
focused,
|
|
157
154
|
...parentFocus,
|
|
158
155
|
ref: touchableRef,
|
|
159
156
|
setIsFocusable,
|
|
160
|
-
}
|
|
161
|
-
|
|
157
|
+
}),
|
|
158
|
+
[parentFocus, focused]
|
|
159
|
+
);
|
|
162
160
|
|
|
163
161
|
return (
|
|
164
162
|
<Touchable
|
|
@@ -175,13 +173,9 @@ function FocusableComponent(props: Props, forwardedRef) {
|
|
|
175
173
|
{...parentFocus}
|
|
176
174
|
>
|
|
177
175
|
<FocusableContext.Provider value={contextState}>
|
|
178
|
-
{
|
|
179
|
-
()
|
|
180
|
-
|
|
181
|
-
? children(focused, parentFocus, touchableRef)
|
|
182
|
-
: children,
|
|
183
|
-
[children, focused, parentFocus]
|
|
184
|
-
)}
|
|
176
|
+
{typeof children === "function"
|
|
177
|
+
? children(focused, parentFocus, touchableRef)
|
|
178
|
+
: children}
|
|
185
179
|
</FocusableContext.Provider>
|
|
186
180
|
</Touchable>
|
|
187
181
|
);
|
|
@@ -31,14 +31,14 @@ const useParentFocus = (
|
|
|
31
31
|
|
|
32
32
|
function FocusableChildComponent(props) {
|
|
33
33
|
const { setIsFocusable, ...focusableContext } = useFocusable();
|
|
34
|
-
const focused = useCellState(props.id);
|
|
35
|
-
|
|
36
34
|
const parentFocus = useParentFocus(props, focusableContext);
|
|
37
35
|
|
|
38
36
|
const onLoadFailed = React.useCallback(() => {
|
|
39
37
|
setIsFocusable(false);
|
|
40
38
|
}, []);
|
|
41
39
|
|
|
40
|
+
const focused = useCellState(props.id);
|
|
41
|
+
|
|
42
42
|
return props.renderItem({
|
|
43
43
|
...props,
|
|
44
44
|
focused,
|
|
@@ -88,7 +88,6 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
|
|
|
88
88
|
data = [],
|
|
89
89
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
90
90
|
onAllComponentsLoaded, // TODO: re-implement it
|
|
91
|
-
omitPropsPropagation = [],
|
|
92
91
|
} = props;
|
|
93
92
|
|
|
94
93
|
useCheckItemIdsForUnique({ componentId: props.id, items: data });
|
|
@@ -253,9 +252,9 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
|
|
|
253
252
|
]
|
|
254
253
|
);
|
|
255
254
|
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
[
|
|
255
|
+
const flatListProps = React.useMemo(
|
|
256
|
+
() =>
|
|
257
|
+
R.omit([
|
|
259
258
|
"onListElementFocus",
|
|
260
259
|
"onListElementPress",
|
|
261
260
|
"onListElementPressOut",
|
|
@@ -268,17 +267,17 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
|
|
|
268
267
|
"focusableItemProps",
|
|
269
268
|
"renderItem",
|
|
270
269
|
"extraChildrenData",
|
|
270
|
+
"extraData",
|
|
271
|
+
"keyExtractor",
|
|
271
272
|
"onAllComponentsLoaded",
|
|
272
273
|
"focused",
|
|
273
274
|
"id",
|
|
274
275
|
"initialFocusDirection",
|
|
275
276
|
"withStateMemory",
|
|
276
277
|
"useSequentialLoading",
|
|
277
|
-
...omitPropsPropagation,
|
|
278
|
-
],
|
|
279
|
-
|
|
280
|
-
),
|
|
281
|
-
[omitPropsPropagation]
|
|
278
|
+
...(props.omitPropsPropagation || []),
|
|
279
|
+
])(props),
|
|
280
|
+
[props]
|
|
282
281
|
);
|
|
283
282
|
|
|
284
283
|
const onEndReached = React.useCallback(
|
|
@@ -290,7 +289,7 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
|
|
|
290
289
|
|
|
291
290
|
const initialNumToRender = toFiniteNumberWithDefault(
|
|
292
291
|
10,
|
|
293
|
-
|
|
292
|
+
flatListProps.initialNumToRender
|
|
294
293
|
);
|
|
295
294
|
|
|
296
295
|
return (
|
|
@@ -299,10 +298,12 @@ function FocusableListComponent<ItemT>(props: Props<ItemT>, ref) {
|
|
|
299
298
|
<FlatList
|
|
300
299
|
focusable={false}
|
|
301
300
|
scrollEnabled={false}
|
|
301
|
+
extraData={props.extraData}
|
|
302
302
|
ref={ref}
|
|
303
|
-
{...
|
|
303
|
+
{...flatListProps}
|
|
304
304
|
renderItem={renderItem}
|
|
305
305
|
onEndReached={onEndReached}
|
|
306
|
+
keyExtractor={props.keyExtractor}
|
|
306
307
|
initialNumToRender={initialNumToRender}
|
|
307
308
|
/>
|
|
308
309
|
</ChildrenFocusDeactivatorView>
|
|
@@ -8,5 +8,5 @@ import { useImageSource } from "./utils";
|
|
|
8
8
|
export const QBImage = (props: FastImageProps) => {
|
|
9
9
|
const source = useImageSource(props.source);
|
|
10
10
|
|
|
11
|
-
return <FastImage
|
|
11
|
+
return <FastImage {...props} source={source} />;
|
|
12
12
|
};
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
ifElseFocusedSelected,
|
|
4
4
|
ifElseSelected,
|
|
5
5
|
} from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
6
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
7
6
|
|
|
8
7
|
import { getPositionStyles } from "./utils";
|
|
9
8
|
|
|
@@ -32,11 +31,7 @@ export const CellBadge = ({
|
|
|
32
31
|
return {
|
|
33
32
|
type: View, // Cell badge view
|
|
34
33
|
style: {
|
|
35
|
-
flex:
|
|
36
|
-
tvos: 0,
|
|
37
|
-
android_tv: 0,
|
|
38
|
-
default: 1,
|
|
39
|
-
}),
|
|
34
|
+
flex: 1,
|
|
40
35
|
position: "absolute",
|
|
41
36
|
...getPositionStyles(position, {
|
|
42
37
|
width: value("cell_badge_width"),
|
|
@@ -5,7 +5,6 @@ import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/acti
|
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
7
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
8
|
-
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
9
8
|
|
|
10
9
|
const { Logger } = getXray();
|
|
11
10
|
|
|
@@ -45,11 +44,6 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
45
44
|
|
|
46
45
|
const actionContext = useActions(pluginIdentifier);
|
|
47
46
|
|
|
48
|
-
const accessibilityManager = useAccessibilityManager({});
|
|
49
|
-
|
|
50
|
-
const { ttsLabel = "" } =
|
|
51
|
-
actionContext?.initialEntryState(item)?.getAccessibility?.(item) || {};
|
|
52
|
-
|
|
53
47
|
const onPress = (event) => {
|
|
54
48
|
event?.preventDefault?.();
|
|
55
49
|
|
|
@@ -94,12 +88,6 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
94
88
|
mouse: focusable.mouse,
|
|
95
89
|
});
|
|
96
90
|
});
|
|
97
|
-
|
|
98
|
-
if (ttsLabel) {
|
|
99
|
-
accessibilityManager.readText({
|
|
100
|
-
text: ttsLabel,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
91
|
};
|
|
104
92
|
|
|
105
93
|
const handleBlur = (_focusable, _direction) => {
|
|
@@ -38,22 +38,21 @@ function Image({
|
|
|
38
38
|
|
|
39
39
|
const shouldRenderImg = source && !error;
|
|
40
40
|
|
|
41
|
-
// Default placeholder image fallback is empty string because it won't rerender
|
|
42
|
-
// in case of undefined or {uri: undefined} source
|
|
43
|
-
// https://github.com/facebook/react-native/issues/9195
|
|
44
41
|
const defaultPlaceHolderImage = React.useMemo(
|
|
45
42
|
() => ({ uri: placeholderImage || "" }),
|
|
46
43
|
[source, error]
|
|
47
44
|
);
|
|
48
45
|
|
|
46
|
+
const _source = shouldRenderImg
|
|
47
|
+
? withDimensions(source)
|
|
48
|
+
: defaultPlaceHolderImage;
|
|
49
|
+
|
|
49
50
|
return (
|
|
50
51
|
// @ts-ignore
|
|
51
52
|
<MemoizedImage
|
|
52
53
|
style={style as ImageStyle}
|
|
53
54
|
onError={() => setErrorState(true)}
|
|
54
|
-
source={
|
|
55
|
-
shouldRenderImg ? withDimensions(source) : defaultPlaceHolderImage
|
|
56
|
-
}
|
|
55
|
+
source={_source?.uri ? _source : undefined}
|
|
57
56
|
{...R.omit(["source"], otherProps)}
|
|
58
57
|
/>
|
|
59
58
|
);
|
|
@@ -31,10 +31,10 @@ function Image({
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<RnImage
|
|
34
|
-
defaultSource={placeholderImage ||
|
|
34
|
+
defaultSource={placeholderImage || ""}
|
|
35
35
|
style={style}
|
|
36
36
|
source={updatedSource}
|
|
37
|
-
{...R.omit(["source"
|
|
37
|
+
{...R.omit(["source"], otherProps)}
|
|
38
38
|
/>
|
|
39
39
|
);
|
|
40
40
|
}
|
|
@@ -53,9 +53,10 @@ function resolveColorForProp(entry, style, colorProp) {
|
|
|
53
53
|
const colorFromProp = style[colorProp];
|
|
54
54
|
const nestedEntryValue = R.path(colorFromProp.split("."), entry);
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
if (
|
|
57
|
+
nestedEntryValue === undefined &&
|
|
58
|
+
!validateColor(colorFromProp.replace(".00", "")) // https://github.com/dreamyguy/validate-color/issues/44
|
|
59
|
+
) {
|
|
59
60
|
logWarning(colorFromProp, style, entry, nestedEntryValue);
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -362,15 +362,13 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
362
362
|
const toggleFullscreen = (event) => {
|
|
363
363
|
const { fullscreen = false } = event || {};
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
});
|
|
365
|
+
if (fullscreen) {
|
|
366
|
+
playerEvent("onFullscreenPlayerWillPresent");
|
|
367
|
+
navigator.fullscreenVideoModal();
|
|
368
|
+
} else {
|
|
369
|
+
playerEvent("onFullscreenPlayerWillDismiss");
|
|
370
|
+
navigator.maximiseVideoModal();
|
|
371
|
+
}
|
|
374
372
|
};
|
|
375
373
|
|
|
376
374
|
const onCellTap = (entry) => {
|
|
@@ -465,10 +463,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
465
463
|
|
|
466
464
|
if (mode === VideoModalMode.FULLSCREEN) {
|
|
467
465
|
toggleFullscreen({ fullscreen: false });
|
|
468
|
-
|
|
469
|
-
if (!isModal) {
|
|
470
|
-
playerManager.closeNativePlayer();
|
|
471
|
-
}
|
|
472
466
|
}
|
|
473
467
|
|
|
474
468
|
return !!(
|
|
@@ -525,7 +519,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
525
519
|
}
|
|
526
520
|
|
|
527
521
|
return () => {
|
|
528
|
-
playerEvent("player_did_close"
|
|
522
|
+
playerEvent("player_did_close");
|
|
529
523
|
|
|
530
524
|
if (!isModal) {
|
|
531
525
|
showNavBar(true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { update, compose, tail, append, take, identity
|
|
3
|
+
import { update, compose, tail, append, take, identity } from "ramda";
|
|
4
4
|
|
|
5
5
|
import { AnimationManager } from "./AnimationManager";
|
|
6
6
|
import { Scene } from "./Scene";
|
|
@@ -50,10 +50,6 @@ function scenesForBackTransition(props: SceneProps, { scenes }) {
|
|
|
50
50
|
: [prepareScene(props.children), scenes[0]];
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const isModalClosed = (navigator) => {
|
|
54
|
-
return !!isNil(navigator?.modalData);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
53
|
type Props = {
|
|
58
54
|
transitionConfig: any;
|
|
59
55
|
children: React.ReactNode;
|
|
@@ -317,10 +313,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
317
313
|
<Scene
|
|
318
314
|
key={scenes[from.index].key}
|
|
319
315
|
pathname={scenes[from.index].key}
|
|
320
|
-
isActive={
|
|
321
|
-
scenes[from.index].key === this.props.navigator.currentRoute &&
|
|
322
|
-
isModalClosed(this.props.navigator)
|
|
323
|
-
}
|
|
316
|
+
isActive={scenes[from.index].key === this.props.navigator.currentRoute}
|
|
324
317
|
style={from.style}
|
|
325
318
|
pointerEvents="none"
|
|
326
319
|
overlayStyle={from.overlayStyle}
|
|
@@ -336,10 +329,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
336
329
|
const toScene = scenes[to.index] && (
|
|
337
330
|
<Scene
|
|
338
331
|
pathname={scenes[to.index].key}
|
|
339
|
-
isActive={
|
|
340
|
-
scenes[to.index].key === this.props.navigator.currentRoute &&
|
|
341
|
-
isModalClosed(this.props.navigator)
|
|
342
|
-
}
|
|
332
|
+
isActive={scenes[to.index].key === this.props.navigator.currentRoute}
|
|
343
333
|
key={scenes[to.index].key}
|
|
344
334
|
style={to.style}
|
|
345
335
|
overlayStyle={to.overlayStyle}
|
|
@@ -45,9 +45,15 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
React.useEffect(() => {
|
|
48
|
-
|
|
49
|
-
playerAnimationState === PlayerAnimationStateEnum.
|
|
50
|
-
|
|
48
|
+
const translateYListener = translateY.addListener(() => {
|
|
49
|
+
(playerAnimationState === PlayerAnimationStateEnum.minimize ||
|
|
50
|
+
playerAnimationState === PlayerAnimationStateEnum.maximaze) &&
|
|
51
|
+
setStartComponentsAnimation(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return () => {
|
|
55
|
+
translateYListener && translateY.removeListener(translateYListener);
|
|
56
|
+
};
|
|
51
57
|
}, [playerAnimationState]);
|
|
52
58
|
|
|
53
59
|
return (
|
|
@@ -66,10 +66,9 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
66
66
|
const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
|
|
67
67
|
useNavigation();
|
|
68
68
|
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
const previousItemId = usePrevious(videoModalItem?.id);
|
|
69
|
+
const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
|
|
70
|
+
const isMinimizedModal = videoModalState.mode === "MINIMIZED";
|
|
71
|
+
const previousItemId = usePrevious(videoModalState.item?.id);
|
|
73
72
|
|
|
74
73
|
const isNotMinimizeMaximazeAnimation =
|
|
75
74
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
@@ -82,9 +81,9 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
82
81
|
|
|
83
82
|
const isAudioItem = React.useMemo(
|
|
84
83
|
() =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[
|
|
84
|
+
videoModalState.item?.content?.type?.includes?.("audio") ||
|
|
85
|
+
videoModalState.item?.type?.value === "audio",
|
|
86
|
+
[videoModalState.item]
|
|
88
87
|
);
|
|
89
88
|
|
|
90
89
|
// Refs for components
|
|
@@ -115,7 +114,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
115
114
|
const preparedTranslationY =
|
|
116
115
|
Math.abs(translationY) - lastScrollYValue.current;
|
|
117
116
|
|
|
118
|
-
if (
|
|
117
|
+
if (videoModalState.mode === "MAXIMIZED") {
|
|
119
118
|
const endOffsetY =
|
|
120
119
|
lastSnap + preparedTranslationY + dragToss * velocityY + 150;
|
|
121
120
|
|
|
@@ -162,7 +161,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
162
161
|
resetPlayerAnimationState();
|
|
163
162
|
}
|
|
164
163
|
},
|
|
165
|
-
[lastSnap, modalSnapPoints, playerAnimationState,
|
|
164
|
+
[lastSnap, modalSnapPoints, playerAnimationState, videoModalState.mode]
|
|
166
165
|
);
|
|
167
166
|
|
|
168
167
|
const onScroll = React.useCallback(({ nativeEvent }) => {
|
|
@@ -197,9 +196,10 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
197
196
|
}, []);
|
|
198
197
|
|
|
199
198
|
React.useEffect(() => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
if (
|
|
200
|
+
videoModalState.mode === "MINIMIZED" &&
|
|
201
|
+
videoModalState.previousMode === "MAXIMIZED"
|
|
202
|
+
) {
|
|
203
203
|
// set animation to the minimize values if moving from the player to another screen
|
|
204
204
|
if (playerAnimationState === null) {
|
|
205
205
|
setScrollModalAnimatedValue(
|
|
@@ -214,17 +214,21 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
214
214
|
dragScrollY,
|
|
215
215
|
dragVideoPlayerY
|
|
216
216
|
);
|
|
217
|
+
} else {
|
|
218
|
+
resetPlayerAnimationState();
|
|
217
219
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (
|
|
223
|
+
(videoModalState.mode === "MAXIMIZED" &&
|
|
224
|
+
videoModalState.previousMode === "MINIMIZED" &&
|
|
225
|
+
previousItemId === videoModalState.item?.id) ||
|
|
226
|
+
previousItemId !== videoModalState.item?.id
|
|
224
227
|
) {
|
|
225
228
|
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
229
|
+
setTimeout(() => resetPlayerAnimationState());
|
|
226
230
|
}
|
|
227
|
-
}, [videoModalState]);
|
|
231
|
+
}, [videoModalState, previousItemId]);
|
|
228
232
|
|
|
229
233
|
React.useEffect(() => {
|
|
230
234
|
if (playerAnimationState === PlayerAnimationStateEnum.minimize) {
|
|
@@ -249,22 +253,22 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
249
253
|
translateYOffset,
|
|
250
254
|
getAnimatedConfig(modalSnapPoints[1])
|
|
251
255
|
).start(() => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
minimiseVideoModal();
|
|
258
|
+
|
|
259
|
+
setScrollModalAnimatedValue(
|
|
260
|
+
translateYOffset,
|
|
261
|
+
modalSnapPoints[1],
|
|
262
|
+
setLastSnap
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
resetScrollAnimatedValues(
|
|
266
|
+
lastScrollY,
|
|
267
|
+
lastScrollYValue,
|
|
268
|
+
dragScrollY,
|
|
269
|
+
dragVideoPlayerY
|
|
270
|
+
);
|
|
271
|
+
}, 150);
|
|
268
272
|
});
|
|
269
273
|
} else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
|
|
270
274
|
Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
|
|
@@ -281,9 +285,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
281
285
|
resetPlayerAnimationState();
|
|
282
286
|
});
|
|
283
287
|
}
|
|
284
|
-
}, [playerAnimationState]);
|
|
285
288
|
|
|
286
|
-
React.useEffect(() => {
|
|
287
289
|
const lastScrollYListenerId = lastScrollY.addListener(({ value }) => {
|
|
288
290
|
lastScrollYValue.current = value;
|
|
289
291
|
});
|
|
@@ -309,7 +311,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
309
311
|
lastScrollY.removeListener(lastScrollYListenerId);
|
|
310
312
|
dragScrollY.removeListener(dragListenerId);
|
|
311
313
|
};
|
|
312
|
-
}, [playerAnimationState, isAudioItem, isMinimizedModal]);
|
|
314
|
+
}, [playerAnimationState, isAudioItem, modalSnapPoints, isMinimizedModal]);
|
|
313
315
|
|
|
314
316
|
const Wrapper = React.useMemo(
|
|
315
317
|
() => (Platform.OS === "android" ? GestureHandlerRootView : View),
|
|
@@ -37,14 +37,11 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
37
37
|
setStartComponentsAnimation,
|
|
38
38
|
} = useModalAnimationContext();
|
|
39
39
|
|
|
40
|
-
const {
|
|
41
|
-
videoModalState: { mode: videoModalMode },
|
|
42
|
-
} = useNavigation();
|
|
43
|
-
|
|
40
|
+
const { videoModalState } = useNavigation();
|
|
44
41
|
const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
|
|
45
42
|
|
|
46
|
-
const isMaximazedModal =
|
|
47
|
-
const isMinimizedModal =
|
|
43
|
+
const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
|
|
44
|
+
const isMinimizedModal = videoModalState.mode === "MINIMIZED";
|
|
48
45
|
|
|
49
46
|
const isEnablePanGesture =
|
|
50
47
|
!isLanguageOverlayVisible && (isMaximazedModal || isMinimizedModal);
|
|
@@ -62,7 +59,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
62
59
|
const preparedTranslationY = Math.abs(translationY);
|
|
63
60
|
const dragToss = 0.05;
|
|
64
61
|
|
|
65
|
-
if (
|
|
62
|
+
if (videoModalState.mode === "MAXIMIZED") {
|
|
66
63
|
if (translationY > 0) {
|
|
67
64
|
const endOffsetY =
|
|
68
65
|
lastSnap + preparedTranslationY + dragToss * velocityY + 200;
|
|
@@ -87,7 +84,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
87
84
|
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
|
-
} else if (
|
|
87
|
+
} else if (videoModalState.mode === "MINIMIZED") {
|
|
91
88
|
if (translationY < 0) {
|
|
92
89
|
// from mini to full
|
|
93
90
|
setLastSnap(modalSnapPoints[0]);
|
|
@@ -103,7 +100,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
},
|
|
106
|
-
[lastSnap, modalSnapPoints,
|
|
103
|
+
[lastSnap, modalSnapPoints, videoModalState.mode]
|
|
107
104
|
);
|
|
108
105
|
|
|
109
106
|
React.useEffect(() => {
|