@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4201443043 → 12.0.0-alpha.4223432180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/Components/BaseFocusable/index.tsx +2 -2
  2. package/Components/Cell/Cell.tsx +34 -6
  3. package/Components/Cell/CellWithFocusable.tsx +6 -4
  4. package/Components/Cell/TvOSCellComponent.tsx +3 -7
  5. package/Components/Focusable/Focusable.tsx +6 -1
  6. package/Components/Focusable/__tests__/index.android.test.tsx +72 -0
  7. package/Components/Focusable/index.android.tsx +15 -9
  8. package/Components/FocusableGroup/index.tsx +10 -2
  9. package/Components/FocusableList/FocusableChild.ts +2 -4
  10. package/Components/FocusableList/index.tsx +11 -12
  11. package/Components/FocusableScrollView/index.tsx +1 -1
  12. package/Components/FreezeWithCallback/Freeze.tsx +31 -0
  13. package/Components/FreezeWithCallback/LICENSE +21 -0
  14. package/Components/FreezeWithCallback/Suspender.tsx +17 -0
  15. package/Components/FreezeWithCallback/__tests__/index.test.tsx +170 -0
  16. package/Components/FreezeWithCallback/index.tsx +3 -0
  17. package/Components/Layout/TV/ScreenContainer.tsx +79 -5
  18. package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
  19. package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
  20. package/Components/Layout/TV/__tests__/index.test.tsx +3 -2
  21. package/Components/Layout/TV/index.tsx +52 -9
  22. package/Components/Layout/TV/index.web.tsx +33 -0
  23. package/Components/Layout/index.tsx +15 -11
  24. package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -1
  25. package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +86 -116
  26. package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +16 -1
  27. package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -5
  28. package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +2 -2
  29. package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +71 -0
  30. package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +20 -0
  31. package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
  32. package/Components/MasterCell/DefaultComponents/index.ts +2 -0
  33. package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +6 -1
  34. package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
  35. package/Components/MasterCell/dataAdapter.ts +21 -7
  36. package/Components/MasterCell/index.tsx +5 -3
  37. package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
  38. package/Components/MasterCell/utils/index.ts +17 -30
  39. package/Components/Navigator/StackNavigator.tsx +14 -5
  40. package/Components/PlayerContainer/PlayerContainer.tsx +16 -8
  41. package/Components/Screen/TV/hooks/index.ts +0 -2
  42. package/Components/Screen/TV/index.web.tsx +40 -41
  43. package/Components/Screen/__tests__/Screen.test.tsx +3 -49
  44. package/Components/Screen/index.tsx +55 -76
  45. package/Components/Screen/navigationHandler.ts +6 -3
  46. package/Components/Screen/orientationHandler.ts +18 -7
  47. package/Components/Screen/utils.ts +16 -0
  48. package/Components/ScreenResolver/index.tsx +6 -11
  49. package/Components/Transitioner/Scene.tsx +20 -12
  50. package/Components/Transitioner/Transitioner.tsx +52 -51
  51. package/Components/Transitioner/__tests__/Scene.test.js +7 -0
  52. package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +8 -4
  53. package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
  54. package/Components/VideoLive/LiveImageManager.ts +10 -0
  55. package/Components/VideoLive/PlayerLiveImageComponent.tsx +52 -24
  56. package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +31 -24
  57. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +2 -14
  58. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +81 -46
  59. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +47 -33
  60. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +129 -86
  61. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -4
  62. package/Components/VideoModal/ModalAnimation/utils.ts +7 -4
  63. package/Components/VideoModal/PlayerDetails.tsx +19 -5
  64. package/Components/VideoModal/PlayerWrapper.tsx +49 -19
  65. package/Components/VideoModal/VideoModal.tsx +31 -25
  66. package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +7 -0
  67. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -0
  68. package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +134 -22
  69. package/Components/VideoModal/hooks/useModalSize.ts +10 -12
  70. package/Components/VideoModal/utils.ts +5 -2
  71. package/Components/ZappFrameworkComponents/BarView/BarView.tsx +7 -3
  72. package/Components/ZappFrameworkComponents/BarView/Buttons/BackButton.tsx +7 -2
  73. package/Components/ZappFrameworkComponents/BarView/Buttons/CloseButton.tsx +7 -2
  74. package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +87 -0
  75. package/Components/ZappFrameworkComponents/Buttons/ActionButton.tsx +9 -4
  76. package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
  77. package/Contexts/CachedDimensionsContext/index.ts +13 -9
  78. package/Contexts/ConfirmDialogState/index.ts +1 -1
  79. package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
  80. package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
  81. package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
  82. package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
  83. package/Contexts/FocusableGroupContext/index.ts +7 -0
  84. package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
  85. package/Contexts/ScreenContext/index.tsx +6 -1
  86. package/Contexts/ScreenDataContext/index.tsx +20 -0
  87. package/const.ts +6 -0
  88. package/index.js +3 -0
  89. package/package.json +5 -5
  90. package/Components/Screen/TV/hooks/useRestoreFocus.ts +0 -22
  91. package/Contexts/ScreenDataContext/index.ts +0 -3
  92. /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
  93. /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
@@ -1,13 +1,12 @@
1
1
  import React from "react";
2
- import {
3
- Animated,
4
- useWindowDimensions,
5
- ViewProps,
6
- ViewStyle,
7
- } from "react-native";
2
+ import { Animated, ViewProps, ViewStyle } from "react-native";
8
3
  import { useSafeAreaFrame } from "react-native-safe-area-context";
4
+
5
+ import { useScreenOrientationHandler } from "@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler";
6
+
9
7
  import { PathnameContext } from "../../Contexts/PathnameContext";
10
8
  import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
9
+ import { ScreenContextProvider } from "../../Contexts/ScreenContext";
11
10
 
12
11
  type Props = {
13
12
  children: any;
@@ -46,6 +45,11 @@ export function Scene({
46
45
  }: Props) {
47
46
  const [initialScreenData, setInitialScreenData] = React.useState(screenData);
48
47
 
48
+ useScreenOrientationHandler({
49
+ screenData,
50
+ isActive,
51
+ });
52
+
49
53
  React.useLayoutEffect(() => {
50
54
  if (isActive) {
51
55
  setInitialScreenData(screenData);
@@ -53,12 +57,14 @@ export function Scene({
53
57
  }, [screenData, isActive]);
54
58
 
55
59
  const frame = useSafeAreaFrame();
56
- const { height, width } = useWindowDimensions();
57
-
58
- // Safe frame takes too long to update,
59
- // so we can not rely on it there, and use height and width instead.
60
60
  const isAnimating = animating && overlayStyle;
61
- const dimensions = isAnimating ? { height, width } : frame;
61
+
62
+ const dimensions = isAnimating
63
+ ? {
64
+ width: "100%",
65
+ height: "100%",
66
+ }
67
+ : frame;
62
68
 
63
69
  return (
64
70
  <Animated.View
@@ -67,7 +73,9 @@ export function Scene({
67
73
  >
68
74
  <ScreenDataContext.Provider value={initialScreenData}>
69
75
  <PathnameContext.Provider value={pathname}>
70
- {children}
76
+ <ScreenContextProvider pathname={pathname}>
77
+ {children}
78
+ </ScreenContextProvider>
71
79
  </PathnameContext.Provider>
72
80
  </ScreenDataContext.Provider>
73
81
  {isAnimating && <Animated.View style={overlayStyle} />}
@@ -1,13 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { View } from "react-native";
3
- import * as R from "ramda";
3
+ import { update, compose, tail, append, take, identity, isNil } from "ramda";
4
4
 
5
5
  import { AnimationManager } from "./AnimationManager";
6
6
  import { Scene } from "./Scene";
7
- import {
8
- getScreenOrientation,
9
- isOrientationCompatible,
10
- } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
7
+
11
8
  import {
12
9
  getSceneByRoute,
13
10
  shouldSkipAnimationForPreviousWebViewScene,
@@ -49,10 +46,14 @@ function prepareScene(children) {
49
46
  */
50
47
  function scenesForBackTransition(props: SceneProps, { scenes }) {
51
48
  return scenes.length > 1
52
- ? R.identity(scenes)
49
+ ? identity(scenes)
53
50
  : [prepareScene(props.children), scenes[0]];
54
51
  }
55
52
 
53
+ const isModalClosed = (navigator) => {
54
+ return !!isNil(navigator?.modalData);
55
+ };
56
+
56
57
  type Props = {
57
58
  transitionConfig: any;
58
59
  children: React.ReactNode;
@@ -113,7 +114,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
113
114
  pushTransitionStart() {
114
115
  this.setState(
115
116
  {
116
- scenes: R.append(prepareScene(this.props.children), this.state.scenes),
117
+ scenes: append(prepareScene(this.props.children), this.state.scenes),
117
118
  ...this.animationManager.stateForAction(this.state, NAV_ACTION_PUSH),
118
119
  },
119
120
  () => {
@@ -169,21 +170,23 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
169
170
 
170
171
  transitionWithoutAnimation(resetState) {
171
172
  const { scenes } = this.state;
172
-
173
- const newState = resetState
174
- ? {
175
- scenes: [prepareScene(this.props.children)],
176
- to: {
177
- index: 0,
178
- },
179
- }
180
- : {
181
- scenes: R.update(
182
- scenes.length - 1,
183
- prepareScene(this.props.children),
184
- scenes
185
- ),
186
- };
173
+ const newScene = prepareScene(this.props.children);
174
+ const isLastSceneHook = scenes[scenes.length - 1].key.startsWith("/hook");
175
+
176
+ let newState;
177
+
178
+ if (resetState) {
179
+ newState = {
180
+ scenes: [newScene],
181
+ to: { index: 0 },
182
+ };
183
+ } else if (isLastSceneHook || scenes.length === 1) {
184
+ newState = { scenes: update(scenes.length - 1, newScene, scenes) };
185
+ } else {
186
+ newState = {
187
+ scenes: compose(tail, append(newScene))(scenes),
188
+ };
189
+ }
187
190
 
188
191
  this.setState(newState);
189
192
  }
@@ -226,7 +229,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
226
229
  this.shouldSkipAnimationForRoute(previousRoute) ||
227
230
  this.shouldSkipAnimationForRoute(currentRoute)
228
231
  ) {
229
- return this.transitionWithoutAnimation();
232
+ // we are going back, in this case we need to have only one scene using resetState
233
+ const resetState = isGoingBack ? true : undefined;
234
+
235
+ return this.transitionWithoutAnimation(resetState);
230
236
  }
231
237
 
232
238
  switch (this.props.navigator.previousAction) {
@@ -269,7 +275,7 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
269
275
  backTransitionEnd(stepsBack) {
270
276
  this.setState({
271
277
  animating: false,
272
- scenes: R.take(this.state.scenes.length - stepsBack, this.state.scenes),
278
+ scenes: take(this.state.scenes.length - stepsBack, this.state.scenes),
273
279
  });
274
280
  }
275
281
 
@@ -277,36 +283,25 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
277
283
  // so only a single scene should be rendered,
278
284
  // instead of dangerous nulls or duplicates.
279
285
  renderSingleScene({ scenes, to }) {
280
- const { contentStyle, layoutData } = this.props;
286
+ const { contentStyle } = this.props;
281
287
  const screenData = this.props.children.props.screenData;
282
288
  const pathname = scenes[to.index].key;
283
289
 
284
- const orientation = getScreenOrientation({
285
- screenData,
286
- layoutData,
287
- });
288
-
289
- // We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
290
- // This saves unnecessary re-renders and user will not see distorted aspect screen.
291
290
  return (
292
291
  <View style={styles.container}>
293
- {scenes[to.index] &&
294
- isOrientationCompatible({
295
- orientation,
296
- layoutData,
297
- }) && (
298
- <Scene
299
- {...{ style: to.style }}
300
- pathname={pathname}
301
- isActive={pathname === this.props.navigator.currentRoute}
302
- contentStyle={contentStyle}
303
- key={scenes[to.index].key}
304
- screenUniqueId={scenes[to.index].screenUniqueId}
305
- screenData={screenData}
306
- >
307
- {scenes[to.index].children}
308
- </Scene>
309
- )}
292
+ {scenes[to.index] && (
293
+ <Scene
294
+ {...{ style: to?.style || {} }}
295
+ pathname={pathname}
296
+ isActive={pathname === this.props.navigator.currentRoute}
297
+ contentStyle={contentStyle}
298
+ key={scenes[to.index].key}
299
+ screenUniqueId={scenes[to.index].screenUniqueId}
300
+ screenData={screenData}
301
+ >
302
+ {scenes[to.index].children}
303
+ </Scene>
304
+ )}
310
305
  </View>
311
306
  );
312
307
  }
@@ -322,7 +317,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
322
317
  <Scene
323
318
  key={scenes[from.index].key}
324
319
  pathname={scenes[from.index].key}
325
- isActive={scenes[from.index].key === this.props.navigator.currentRoute}
320
+ isActive={
321
+ scenes[from.index].key === this.props.navigator.currentRoute &&
322
+ isModalClosed(this.props.navigator)
323
+ }
326
324
  style={from.style}
327
325
  pointerEvents="none"
328
326
  overlayStyle={from.overlayStyle}
@@ -338,7 +336,10 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
338
336
  const toScene = scenes[to.index] && (
339
337
  <Scene
340
338
  pathname={scenes[to.index].key}
341
- isActive={scenes[to.index].key === this.props.navigator.currentRoute}
339
+ isActive={
340
+ scenes[to.index].key === this.props.navigator.currentRoute &&
341
+ isModalClosed(this.props.navigator)
342
+ }
342
343
  key={scenes[to.index].key}
343
344
  style={to.style}
344
345
  overlayStyle={to.overlayStyle}
@@ -16,6 +16,13 @@ jest.mock("react-native-safe-area-context", () => ({
16
16
  })),
17
17
  }));
18
18
 
19
+ jest.mock(
20
+ "@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler",
21
+ () => ({
22
+ useScreenOrientationHandler: jest.fn(),
23
+ })
24
+ );
25
+
19
26
  const { Scene } = require("../Scene");
20
27
 
21
28
  const wrapper = shallow(
@@ -22,7 +22,9 @@ exports[`<Scene /> renders correctly 1`] = `
22
22
  }
23
23
  >
24
24
  <ContextProvider>
25
- <ContextProvider />
25
+ <ContextProvider>
26
+ <ScreenContextProvider />
27
+ </ContextProvider>
26
28
  </ContextProvider>
27
29
  </ForwardRef(AnimatedComponentWrapper)>
28
30
  `;
@@ -39,14 +41,16 @@ exports[`<Scene /> renders the overlay while animating 1`] = `
39
41
  "paddingBottom": 49,
40
42
  },
41
43
  Object {
42
- "height": 1334,
43
- "width": 750,
44
+ "height": "100%",
45
+ "width": "100%",
44
46
  },
45
47
  ]
46
48
  }
47
49
  >
48
50
  <ContextProvider>
49
- <ContextProvider />
51
+ <ContextProvider>
52
+ <ScreenContextProvider />
53
+ </ContextProvider>
50
54
  </ContextProvider>
51
55
  <ForwardRef(AnimatedComponentWrapper)
52
56
  style={
@@ -12,6 +12,7 @@ exports[`<TransitionerComponent /> renders correctly 1`] = `
12
12
  <Scene
13
13
  isActive={true}
14
14
  screenUniqueId="mocked-uuid"
15
+ style={Object {}}
15
16
  >
16
17
  <View
17
18
  foo="bar"
@@ -525,6 +525,16 @@ export class LiveImage implements QuickBrickPlayer.SharedPlayerCallBacks {
525
525
  LiveImageManager.instance.onLiveImageError(this, error);
526
526
  };
527
527
 
528
+ onVideoError = (error: Error) => {
529
+ log_error(
530
+ `onVideoError: live-image, fail to play, switching back to image. error: ${
531
+ error?.message
532
+ }, ${playerInfo(this.player)}`
533
+ );
534
+
535
+ LiveImageManager.instance.onLiveImageError(this, error);
536
+ };
537
+
528
538
  onVideoEnd = (_event) => {
529
539
  log_info(
530
540
  `onVideoEnd: live-image, video completed, switching back to image, ${playerInfo(
@@ -2,7 +2,7 @@
2
2
  //
3
3
  import * as React from "react";
4
4
 
5
- import { AppState, AppStateStatus } from "react-native";
5
+ import { AppState, AppStateStatus, View } from "react-native";
6
6
  import { TrackedView } from "../TrackedView";
7
7
  import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
8
8
 
@@ -25,8 +25,9 @@ import { PlayerRole } from "@applicaster/zapp-react-native-utils/appUtils/player
25
25
  import { getAutoplaySettings } from "./utils";
26
26
  import { isString } from "@applicaster/zapp-react-native-utils/stringUtils";
27
27
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
28
+ import { useEffect } from "react";
28
29
 
29
- const { log_error } = loggerLiveImageComponent;
30
+ const { log_error, log_debug } = loggerLiveImageComponent;
30
31
 
31
32
  const isMeasurement = (item: ZappEntry) =>
32
33
  isString(item.id) && item.id.startsWith("pre-measurement-");
@@ -56,6 +57,7 @@ const PlayerLiveImageComponent = (props: Props) => {
56
57
  );
57
58
 
58
59
  const ref = React.useRef(null);
60
+ const trackViewRef = React.useRef(null);
59
61
 
60
62
  /**
61
63
  * Debounced setMode function.
@@ -86,6 +88,30 @@ const PlayerLiveImageComponent = (props: Props) => {
86
88
  [mode]
87
89
  );
88
90
 
91
+ const entryToViewIdMapping = React.useRef({});
92
+
93
+ useEffect(() => {
94
+ const nativeTag = trackViewRef.current?._nativeTag?.toString();
95
+
96
+ if (!nativeTag) {
97
+ return;
98
+ }
99
+
100
+ const prevValue = entryToViewIdMapping.current[nativeTag];
101
+
102
+ if (prevValue && prevValue.itemId !== item.id) {
103
+ if (mode === LiveImageType.Video) {
104
+ log_debug(
105
+ "Entry to view association changed, stopping current live image"
106
+ );
107
+
108
+ setMode(LiveImageType.Image);
109
+ }
110
+ }
111
+
112
+ entryToViewIdMapping.current[nativeTag] = { itemId: item.id };
113
+ }, [trackViewRef.current, item.id, mode]);
114
+
89
115
  const { screenConfig, playerPluginId } = props;
90
116
 
91
117
  const liveImageItem: LiveImage = React.useMemo(() => {
@@ -295,28 +321,30 @@ const PlayerLiveImageComponent = (props: Props) => {
295
321
  testId={`tracked-view-${playerId}-${item.title}`}
296
322
  onPositionUpdated={onPositionUpdated}
297
323
  >
298
- {isVideoMode && (
299
- <Player
300
- autoplay={false}
301
- ref={_assignRoot}
302
- entry={item} // Must be passed first in list
303
- style={videoStyles}
304
- playerId={playerId}
305
- muted={muted}
306
- listener={controller?.getListener()}
307
- resizeMode={"cover"}
308
- {...platformSpecificProps}
309
- />
310
- )}
311
- {
312
- <AnimatedInOut
313
- visible={isBackgroundImageVisible}
314
- animationConfig={overlayFadeIn}
315
- staticStyles={style}
316
- >
317
- <Image {...props} resizeMode="cover" style={style} applyMaxSize />
318
- </AnimatedInOut>
319
- }
324
+ <View ref={trackViewRef}>
325
+ {isVideoMode && (
326
+ <Player
327
+ autoplay={false}
328
+ ref={_assignRoot}
329
+ entry={item} // Must be passed first in list
330
+ style={videoStyles}
331
+ playerId={playerId}
332
+ muted={muted}
333
+ listener={controller?.getListener()}
334
+ resizeMode={"cover"}
335
+ {...platformSpecificProps}
336
+ />
337
+ )}
338
+ {
339
+ <AnimatedInOut
340
+ visible={isBackgroundImageVisible}
341
+ animationConfig={overlayFadeIn}
342
+ staticStyles={style}
343
+ >
344
+ <Image {...props} resizeMode="cover" style={style} applyMaxSize />
345
+ </AnimatedInOut>
346
+ }
347
+ </View>
320
348
  </TrackedView>
321
349
  );
322
350
  };
@@ -5,33 +5,40 @@ exports[`PlayerLiveImageComponent should render correctly with default props 1`]
5
5
  onPositionUpdated={[Function]}
6
6
  testId="tracked-view-player1-Test"
7
7
  >
8
- <View
9
- collapsable={false}
10
- style={
11
- Object {
12
- "opacity": 1,
13
- }
14
- }
15
- >
16
- <Image
17
- applyMaxSize={true}
18
- audioMutedByDefault={false}
19
- imageKey="image1"
20
- item={
8
+ <View>
9
+ <View
10
+ collapsable={false}
11
+ style={
21
12
  Object {
22
- "id": "1",
23
- "title": "Test",
24
- "type": Object {
25
- "value": "",
26
- },
13
+ "opacity": 1,
27
14
  }
28
15
  }
29
- onError={[Function]}
30
- playerId="player1"
31
- resizeMode="cover"
32
- screenConfig={Object {}}
33
- style={Object {}}
34
- />
16
+ >
17
+ <Image
18
+ applyMaxSize={true}
19
+ audioMutedByDefault={false}
20
+ imageKey="image1"
21
+ item={
22
+ Object {
23
+ "id": "1",
24
+ "title": "Test",
25
+ "type": Object {
26
+ "value": "",
27
+ },
28
+ }
29
+ }
30
+ onError={[Function]}
31
+ playerId="player1"
32
+ resizeMode="cover"
33
+ screenConfig={Object {}}
34
+ source={
35
+ Object {
36
+ "uri": "",
37
+ }
38
+ }
39
+ style={Object {}}
40
+ />
41
+ </View>
35
42
  </View>
36
43
  </TrackedView>
37
44
  `;
@@ -5,7 +5,6 @@ import {
5
5
  useModalAnimationContext,
6
6
  PlayerAnimationStateEnum,
7
7
  } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
8
- import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks";
9
8
 
10
9
  type Props = {
11
10
  style: ViewStyle[];
@@ -18,13 +17,8 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
18
17
  animatedValues: { lastScrollY, dragScrollY, translateYOffset },
19
18
  modalSnapPoints,
20
19
  setStartComponentsAnimation,
21
- lastScrollYValue,
22
20
  } = useModalAnimationContext();
23
21
 
24
- const { height: screenHeight } = useDimensions("screen", {
25
- deviceInfo: true,
26
- });
27
-
28
22
  const interpolateConfig: Animated.InterpolationConfigType = React.useMemo(
29
23
  () => ({
30
24
  inputRange: modalSnapPoints,
@@ -51,16 +45,10 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
51
45
  }
52
46
 
53
47
  React.useEffect(() => {
54
- const translateYListener = translateY.addListener(({ value }) => {
55
- const preparedValue = Math.round(
56
- Math.abs(value) - lastScrollYValue.current
57
- );
58
-
48
+ const translateYListener = translateY.addListener(() => {
59
49
  (playerAnimationState === PlayerAnimationStateEnum.minimize ||
60
50
  playerAnimationState === PlayerAnimationStateEnum.maximaze) &&
61
- setStartComponentsAnimation(
62
- preparedValue >= Math.round((screenHeight * 10) / 100)
63
- );
51
+ setStartComponentsAnimation(true);
64
52
  });
65
53
 
66
54
  return () => {