@applicaster/zapp-react-native-ui-components 13.0.0-alpha.9112802542 → 13.0.0-alpha.9214758151

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 (26) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
  2. package/Components/AudioPlayer/helpers.tsx +1 -0
  3. package/Components/Cell/CellWithFocusable.tsx +1 -1
  4. package/Components/FocusableCell/index.tsx +1 -1
  5. package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
  6. package/Components/FocusableGroup/index.tsx +0 -1
  7. package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
  8. package/Components/MasterCell/utils/behaviorProvider.ts +4 -1
  9. package/Components/MasterCell/utils/index.ts +6 -6
  10. package/Components/OfflineHandler/utils/index.ts +1 -1
  11. package/Components/PlayerContainer/PlayerContainer.tsx +9 -5
  12. package/Components/PlayerImageBackground/index.tsx +4 -24
  13. package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
  14. package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
  15. package/Components/Screen/TV/index.web.tsx +5 -6
  16. package/Components/Screen/hooks.ts +3 -6
  17. package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
  18. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +33 -19
  19. package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
  20. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +17 -4
  21. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +2 -2
  22. package/Components/VideoModal/VideoModal.tsx +2 -2
  23. package/Decorators/RiverResolver/index.tsx +5 -7
  24. package/Decorators/ZappPipesDataConnector/index.tsx +2 -1
  25. package/package.json +5 -6
  26. package/.babelrc +0 -8
@@ -24,6 +24,7 @@ type Props = {
24
24
  audio_player_rtl?: boolean;
25
25
  magic_background?: boolean;
26
26
  audio_player_background_image_query?: string;
27
+ audio_player_background_image_default_color?: string;
27
28
  start_time?: string;
28
29
  end_time?: string;
29
30
  };
@@ -35,6 +36,7 @@ type Props = {
35
36
  audio_player_rtl?: string;
36
37
  magic_background?: string;
37
38
  audio_player_background_image_query?: string;
39
+ audio_player_background_image_default_color?: string;
38
40
  audio_player_background_image?: string;
39
41
  audio_player_artwork_aspect_ratio?: string;
40
42
  lg_tv_audio_player_title_font_family?: string;
@@ -80,6 +82,10 @@ export function AudioPlayer(props: Props) {
80
82
  "audio_player_background_image_query"
81
83
  );
82
84
 
85
+ const audioPlayerBackgroundImageDefaultColor = getProp(
86
+ "audio_player_background_image_default_color"
87
+ );
88
+
83
89
  const isRTL = rtlFlag === "1" || rtlFlag === "true" || rtlFlag === true;
84
90
 
85
91
  const titleFontFamily = getProp(
@@ -158,6 +164,7 @@ export function AudioPlayer(props: Props) {
158
164
  channelIcon,
159
165
  magicBackground,
160
166
  audioPlayerBackgroundImageQuery,
167
+ audioPlayerBackgroundImageDefaultColor,
161
168
  };
162
169
  }, [getProp]);
163
170
 
@@ -6,6 +6,7 @@ const defaults = {
6
6
  audio_player_rtl: false,
7
7
  magic_background: false,
8
8
  audio_player_background_image_query: "",
9
+ audio_player_background_image_default_color: "",
9
10
  };
10
11
 
11
12
  export function getPropertyFromEntryOrConfig({ entry, plugin_configuration }) {
@@ -40,7 +40,7 @@ export function CellWithFocusable(props: Props) {
40
40
  const [isFocused, setIsFocused] = React.useState(false);
41
41
 
42
42
  const state = useCellState({
43
- id: item.id,
43
+ item,
44
44
  behavior,
45
45
  focused: isFocused || toBooleanWithDefaultFalse(focused),
46
46
  });
@@ -23,7 +23,7 @@ export function FocusableCell(props: Props) {
23
23
  behavior,
24
24
  } = props;
25
25
 
26
- const state = useCellState({ id: item.id, behavior, focused });
26
+ const state = useCellState({ item, behavior, focused });
27
27
 
28
28
  React.useEffect(() => {
29
29
  if (focused && scrollTo && !isAndroid) {
@@ -24,8 +24,7 @@ type Props = {
24
24
  id: string;
25
25
  children: (arg1: boolean) => React.ComponentType<any>;
26
26
  isFocusDisabled: boolean;
27
- initialItemId: string;
28
- isPreferredFocusDisabled: boolean;
27
+ isWithMemory: boolean;
29
28
  focusGroupRef: React.Component;
30
29
  shouldUsePreferredFocus: boolean;
31
30
  groupId: string;
@@ -40,8 +39,7 @@ export class FocusableGroup extends BaseFocusable<Props> {
40
39
  children,
41
40
  id,
42
41
  isFocusDisabled,
43
- initialItemId,
44
- isPreferredFocusDisabled,
42
+ isWithMemory,
45
43
  style = {},
46
44
  groupId,
47
45
  ...otherProps
@@ -63,8 +61,7 @@ export class FocusableGroup extends BaseFocusable<Props> {
63
61
  itemId={id}
64
62
  ref={this.ref}
65
63
  isFocusDisabled={isFocusDisabled}
66
- initialItemId={initialItemId}
67
- isPreferredFocusDisabled={isPreferredFocusDisabled}
64
+ isWithMemory={isWithMemory}
68
65
  onGroupFocus={onGroupFocus}
69
66
  onGroupBlur={onGroupBlur}
70
67
  style={style}
@@ -16,7 +16,6 @@ type Props = {
16
16
  prioritiseFocusOn?: number;
17
17
  groupId?: string;
18
18
  hasTVPreferredFocus?: boolean;
19
- isPreferredFocusDisabled?: boolean;
20
19
  onFocus?: () => void;
21
20
  onBlur?: () => void;
22
21
  willReceiveFocus?: (event?: any) => void;
@@ -1,14 +1,14 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
- import { ViewStyle } from "react-native";
4
3
  import {
5
4
  findPluginByType,
6
5
  findPluginByIdentifier,
7
6
  } from "@applicaster/zapp-react-native-utils/pluginUtils";
8
- import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
9
7
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
10
- import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
11
- import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
8
+ import {
9
+ useDimensions,
10
+ useNavigation,
11
+ } from "@applicaster/zapp-react-native-utils/reactHooks";
12
12
 
13
13
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
14
  import { PlayerContainer } from "../PlayerContainer";
@@ -78,12 +78,6 @@ const getPlayer = (
78
78
  return getPlayerWithModuleProperties(PlayerModule);
79
79
  };
80
80
 
81
- const dimensionsContext: "window" | "screen" = platformSelect({
82
- android_tv: "window",
83
- amazon: "window",
84
- default: "screen",
85
- });
86
-
87
81
  type PlayableComponent = {
88
82
  Component: React.ComponentType<any>;
89
83
  };
@@ -91,16 +85,11 @@ type PlayableComponent = {
91
85
  export function HandlePlayable({
92
86
  item,
93
87
  isModal,
94
- modalHeight,
95
- modalWidth,
96
88
  mode,
97
89
  groupId,
98
90
  }: Props): React.ReactElement | null {
99
91
  const state = usePickFromState();
100
92
 
101
- const { width: screenWidth, height: screenHeight } =
102
- useDimensions(dimensionsContext);
103
-
104
93
  const { closeVideoModal } = useNavigation();
105
94
 
106
95
  const [Player, playerModuleProperties] = getPlayer(item, state);
@@ -118,9 +107,7 @@ export function HandlePlayable({
118
107
  if (!isModal) {
119
108
  closeVideoModal();
120
109
  }
121
- }, []);
122
110
 
123
- React.useEffect(() => {
124
111
  const castStateHandler = async () => {
125
112
  const castState = await CastPlugin?.getCastState();
126
113
  setCasting(castState === "Connected");
@@ -142,23 +129,23 @@ export function HandlePlayable({
142
129
  }, []);
143
130
 
144
131
  React.useEffect(() => {
145
- if (casting) {
146
- setPlayable({ Component: CastPlugin?.CastHandler });
147
- } else {
148
- setPlayable({ Component: PlayerContainer });
149
- }
132
+ setPlayable({
133
+ Component: casting ? CastPlugin?.CastHandler : PlayerContainer,
134
+ });
150
135
  }, [casting]);
151
136
 
152
- const Component = playable?.Component;
137
+ const { width: screenWidth, height: screenHeight } = useDimensions("window");
153
138
 
154
139
  const style = React.useMemo(
155
140
  () => ({
156
- width: isModal ? modalWidth : mode === "PIP" ? "100%" : screenWidth,
157
- height: isModal ? modalHeight : mode === "PIP" ? "100%" : screenHeight,
141
+ width: isModal ? "100%" : mode === "PIP" ? "100%" : screenWidth,
142
+ height: isModal ? "100%" : mode === "PIP" ? "100%" : screenHeight,
158
143
  }),
159
- [screenWidth, screenHeight, modalHeight, modalWidth, isModal, mode]
144
+ [screenWidth, screenHeight, isModal, mode]
160
145
  );
161
146
 
147
+ const Component = playable?.Component;
148
+
162
149
  if (Component) {
163
150
  return (
164
151
  <Component
@@ -174,5 +161,5 @@ export function HandlePlayable({
174
161
  );
175
162
  }
176
163
 
177
- return !isModal ? <BufferAnimation videoStyle={style as ViewStyle} /> : null;
164
+ return !isModal ? <BufferAnimation videoStyle={style} /> : null;
178
165
  }
@@ -6,6 +6,7 @@ import React, { useEffect } from "react";
6
6
  import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayer";
7
7
  import { BehaviorSubject } from "rxjs";
8
8
  import { masterCellLogger } from "../logger";
9
+ import get from "lodash/get";
9
10
 
10
11
  const parseContextKey = (key: string): string | null => {
11
12
  if (!key?.startsWith("@{ctx/")) return null;
@@ -72,11 +73,13 @@ export const useBehaviorUpdate = (behavior: Behavior) => {
72
73
  // We cant use async in this function (its inside render),
73
74
  // so we rely on useBehaviorUpdate to update current value and trigger re-render
74
75
  export const isCellSelected = (
75
- id: string | number,
76
+ item: ZappEntry,
76
77
  behavior?: Behavior
77
78
  ): boolean => {
78
79
  if (!behavior) return false;
79
80
 
81
+ const id = behavior.selector ? get(item, behavior.selector) : item.id;
82
+
80
83
  if (behavior.selection_source === "now_playing") {
81
84
  const player = playerManager.getActivePlayer();
82
85
 
@@ -190,24 +190,24 @@ export const getFocusedButtonId = (focusable) => {
190
190
  });
191
191
  };
192
192
 
193
- export const isSelected = (id: string | number, behavior?: Behavior) => {
194
- return isCellSelected(id, behavior);
193
+ export const isSelected = (item: ZappEntry, behavior?: Behavior) => {
194
+ return isCellSelected(item, behavior);
195
195
  };
196
196
 
197
197
  export const useCellState = ({
198
- id,
198
+ item,
199
199
  behavior,
200
200
  focused,
201
201
  }: {
202
- id: string | number;
202
+ item: ZappEntry;
203
203
  behavior: Behavior;
204
204
  focused: boolean;
205
205
  }): CellState => {
206
206
  const lastUpdate = useBehaviorUpdate(behavior);
207
207
 
208
208
  const _isSelected = useMemo(
209
- () => isSelected(id, behavior),
210
- [behavior, id, lastUpdate]
209
+ () => isSelected(item, behavior),
210
+ [behavior, item, lastUpdate]
211
211
  );
212
212
 
213
213
  return getCellState({ focused, selected: _isSelected });
@@ -57,7 +57,7 @@ export const useNotificationHeight = () => {
57
57
 
58
58
  const navBarHeight = platformSelect({ ios: 44, android: 56 });
59
59
 
60
- const statusHeight = Platform.OS === "android" ? 0 : insets.top;
60
+ const statusHeight = insets.top;
61
61
  const notificationHeight = statusHeight + navBarHeight;
62
62
 
63
63
  return { statusHeight, notificationHeight };
@@ -335,9 +335,9 @@ const PlayerContainerComponent = (props: Props) => {
335
335
 
336
336
  const resumeTime = Number(item?.extensions?.resumeTime);
337
337
 
338
- // TODO: This is temp hack, will be removed on next pr with player refactoring
338
+ // Сhecking that the player itself knows where to start playing, and there is no need to call seekTo after returning from the Сhromecast
339
339
  if (
340
- !!playerManager.getActivePlayer()?.getContinueWatchingOffset === false &&
340
+ !playerManager.getActivePlayer()?.hasResumePosition() &&
341
341
  !isNaN(resumeTime)
342
342
  ) {
343
343
  player?.seekTo(resumeTime);
@@ -514,6 +514,12 @@ const PlayerContainerComponent = (props: Props) => {
514
514
  useEffect(() => {
515
515
  playerEvent("source_changed", { item });
516
516
 
517
+ return () => {
518
+ playerEvent("player_did_close", { item });
519
+ };
520
+ }, [item?.id, Player]);
521
+
522
+ useEffect(() => {
517
523
  if (!isModal) {
518
524
  showNavBar(false);
519
525
  }
@@ -523,13 +529,11 @@ const PlayerContainerComponent = (props: Props) => {
523
529
  }
524
530
 
525
531
  return () => {
526
- playerEvent("player_did_close", { item });
527
-
528
532
  if (!isModal) {
529
533
  showNavBar(true);
530
534
  }
531
535
  };
532
- }, [showNavBar, /* added as suggested: */ item?.id, isModal, Player]);
536
+ }, [showNavBar, isModal, Player]);
533
537
 
534
538
  useEffect(() => {
535
539
  if (prevItemId && !R.equals(prevItemId, item?.id)) {
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren, useEffect, useState } from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { ImageBackground, View } from "react-native";
3
3
 
4
4
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
@@ -12,7 +12,6 @@ import {
12
12
  type Props = PropsWithChildren<{
13
13
  entry: ZappEntry;
14
14
  style?: { [K: string]: any };
15
- docked?: boolean;
16
15
  imageStyle?: { [K: string]: any };
17
16
  imageKey?: string;
18
17
  defaultImageDimensions?: { [K: string]: any };
@@ -24,7 +23,6 @@ const PlayerImageBackgroundComponent = ({
24
23
  entry,
25
24
  children,
26
25
  style,
27
- docked,
28
26
  imageStyle,
29
27
  imageKey,
30
28
  defaultImageDimensions,
@@ -36,42 +34,24 @@ const PlayerImageBackgroundComponent = ({
36
34
 
37
35
  const { playerAnimationState } = useModalAnimationContext();
38
36
 
39
- const [lastNonNullAnimationState, setLastNonNullAnimationState] =
40
- useState(playerAnimationState);
41
-
42
- useEffect(() => {
43
- if (playerAnimationState !== null) {
44
- setLastNonNullAnimationState(playerAnimationState);
45
- }
46
- }, [playerAnimationState]);
47
-
48
37
  if (!source) return <>{children}</>;
49
38
 
50
- const imageBackgroundStyle =
51
- lastNonNullAnimationState !== PlayerAnimationStateEnum.minimize && !docked
52
- ? defaultImageDimensions
53
- : imageSize;
54
-
55
39
  return (
56
40
  <View
57
41
  style={
58
- playerAnimationState === PlayerAnimationStateEnum.maximaze
42
+ playerAnimationState === PlayerAnimationStateEnum.maximize
59
43
  ? defaultImageDimensions
60
44
  : style
61
45
  }
62
46
  >
63
47
  <AnimationComponent
64
- style={
65
- playerAnimationState === PlayerAnimationStateEnum.maximaze
66
- ? defaultImageDimensions
67
- : style
68
- }
48
+ style={style}
69
49
  animationType={ComponentAnimationType.player}
70
50
  additionalData={defaultImageDimensions}
71
51
  >
72
52
  <ImageBackground
73
53
  resizeMode="cover"
74
- style={imageBackgroundStyle}
54
+ style={imageSize}
75
55
  imageStyle={imageStyle}
76
56
  source={source}
77
57
  >
@@ -34,6 +34,7 @@ type Props = {
34
34
  getStaticComponentFeed: any;
35
35
  pullToRefreshPipesV1RefreshingStateUpdater: () => boolean;
36
36
  refreshingPipesV1?: boolean;
37
+ stickyHeaderIndices?: number[];
37
38
  };
38
39
 
39
40
  const styles = StyleSheet.create({
@@ -61,6 +62,7 @@ function ComponentsMapComponent(props: Props) {
61
62
  // TODO: Remove when pipes v1 is deprecated.
62
63
  pullToRefreshPipesV1RefreshingStateUpdater,
63
64
  refreshingPipesV1,
65
+ stickyHeaderIndices,
64
66
  } = props;
65
67
 
66
68
  const flatListRef = React.useRef<FlatList | null>(null);
@@ -274,6 +276,7 @@ function ComponentsMapComponent(props: Props) {
274
276
  overScrollMode={Platform.OS === "android" ? "never" : "auto"}
275
277
  scrollIndicatorInsets={scrollIndicatorInsets}
276
278
  extraData={feed}
279
+ stickyHeaderIndices={stickyHeaderIndices}
277
280
  onLayout={handleOnLayout}
278
281
  removeClippedSubviews
279
282
  initialNumToRender={3}
@@ -28,10 +28,10 @@ type Return = {
28
28
  // TODO: Take this value from Zapp configuration, when feature is added to GeneralScreen
29
29
  const SHOULD_FAIL_ON_COMPONENT_LOADING = false;
30
30
 
31
- const createLoadingStateObservable = () =>
31
+ const createLoadingStateObservable = (count: number) =>
32
32
  new BehaviorSubject<LoadingState>({
33
33
  index: -1,
34
- done: false,
34
+ done: count === 0,
35
35
  waitForAllComponents: SHOULD_FAIL_ON_COMPONENT_LOADING,
36
36
  });
37
37
 
@@ -43,7 +43,7 @@ export const useLoadingState = (
43
43
  const [loadingError, setLoadingError] = React.useState(null);
44
44
 
45
45
  const loadingState = useRefWithInitialValue<BehaviorSubject<LoadingState>>(
46
- createLoadingStateObservable
46
+ () => createLoadingStateObservable(count)
47
47
  );
48
48
 
49
49
  const arePreviousComponentsLoaded = React.useCallback((index) => {
@@ -92,6 +92,10 @@ const getNavigations = ({
92
92
  return fallbackNavigations;
93
93
  };
94
94
 
95
+ const onRelease = () => {
96
+ focusManager.setInitialFocus();
97
+ };
98
+
95
99
  export const Screen = ({ route, Components }: Props) => {
96
100
  if (isNilOrEmpty(route)) {
97
101
  throw Error("Required props: route is missing");
@@ -152,12 +156,7 @@ export const Screen = ({ route, Components }: Props) => {
152
156
  const isScreenActive = useIsScreenActive();
153
157
 
154
158
  return (
155
- <FreezeWithCallback
156
- freeze={!isScreenActive}
157
- onRelease={() => {
158
- focusManager.setInitialFocus();
159
- }}
160
- >
159
+ <FreezeWithCallback freeze={!isScreenActive} onRelease={onRelease}>
161
160
  <View style={[styles.container, { backgroundColor }]}>
162
161
  <NavBarContainer isVisible={isNavBarVisible} onReady={noop}>
163
162
  <NavBar
@@ -7,15 +7,12 @@ import {
7
7
  useCurrentScreenData,
8
8
  useDimensions,
9
9
  useRoute,
10
+ useIsTablet,
10
11
  } from "@applicaster/zapp-react-native-utils/reactHooks";
11
12
  import { useMemo, useEffect, useState } from "react";
12
13
 
13
14
  export const useWaitForValidOrientation = () => {
14
- const {
15
- width: screenWidth,
16
- height,
17
- deviceInfo,
18
- } = useDimensions("screen", {
15
+ const { width: screenWidth, height } = useDimensions("screen", {
19
16
  fullDimensions: true,
20
17
  updateForInactiveScreens: false,
21
18
  });
@@ -26,7 +23,7 @@ export const useWaitForValidOrientation = () => {
26
23
 
27
24
  const [readyState, setReadyState] = useState(false);
28
25
 
29
- const isTablet = deviceInfo?.isTablet;
26
+ const isTablet = useIsTablet();
30
27
 
31
28
  const { appData } = usePickFromState(["appData"]);
32
29
  const isTabletPortrait = appData?.isTabletPortrait;
@@ -46,7 +46,7 @@ export const AnimatedPlayerModalWrapper = (props: Props) => {
46
46
 
47
47
  React.useEffect(() => {
48
48
  (playerAnimationState === PlayerAnimationStateEnum.minimize ||
49
- playerAnimationState === PlayerAnimationStateEnum.maximaze) &&
49
+ playerAnimationState === PlayerAnimationStateEnum.maximize) &&
50
50
  setStartComponentsAnimation(true);
51
51
  }, [playerAnimationState]);
52
52
 
@@ -70,14 +70,19 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
70
70
  const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
71
71
  useNavigation();
72
72
 
73
- const { mode: videoModalMode, item: videoModalItem } = videoModalState;
73
+ const {
74
+ mode: videoModalMode,
75
+ previousMode: previousVideoModalMode,
76
+ item: videoModalItem,
77
+ } = videoModalState;
78
+
74
79
  const isMaximizedModal: boolean = videoModalMode === "MAXIMIZED";
75
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.maximaze;
85
+ playerAnimationState !== PlayerAnimationStateEnum.maximize;
81
86
 
82
87
  const isEnablePanGesture =
83
88
  enableGesture &&
@@ -121,7 +126,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
121
126
  const preparedTranslationY =
122
127
  Math.abs(translationY) - lastScrollYValue.current;
123
128
 
124
- if (videoModalMode === "MAXIMIZED") {
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.maximaze);
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.maximaze);
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
- [lastSnap, modalSnapPoints, playerAnimationState, videoModalMode]
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
- mode === "MAXIMIZED" &&
234
+ videoModalMode === "MAXIMIZED" &&
226
235
  !enableGesture &&
227
236
  scrollPosition.current === 0
228
237
  ) {
229
238
  setIEnableGesture(true);
230
239
  }
231
240
 
232
- if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
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 === item?.id &&
251
- mode === "MAXIMIZED" &&
252
- (previousMode === "MINIMIZED" || previousMode === "MAXIMIZED")) ||
253
- (previousItemId !== item?.id && mode !== "FULLSCREEN"))
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.maximaze);
269
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
256
270
  }
257
- }, [videoModalState]);
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.maximaze) {
313
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
300
314
  Animated.timing(translateYOffset, getAnimatedConfig(0)).start(() => {
301
315
  maximiseVideoModal();
302
316
  setScrollModalAnimatedValue(translateYOffset, 0, setLastSnap);
@@ -50,7 +50,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
50
50
 
51
51
  const isNotMinimizeMaximazeAnimation =
52
52
  playerAnimationState !== PlayerAnimationStateEnum.minimize &&
53
- playerAnimationState !== PlayerAnimationStateEnum.maximaze;
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.maximaze);
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.maximaze);
108
+ setPlayerAnimationState(PlayerAnimationStateEnum.maximize);
109
109
  } else {
110
110
  resetPlayerAnimationState();
111
111
  }
@@ -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.maximaze
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
- }, [videoModalState]);
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.maximaze) {
360
+ } else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
348
361
  animatedValue.setValue(defaultValue);
349
362
  }
350
363
  }, [playerAnimationState, startComponentsAnimation, defaultValue]);
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
14
14
 
15
15
  export enum PlayerAnimationStateEnum {
16
16
  minimize = "minimize",
17
- maximaze = "maximaze",
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;
@@ -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>
@@ -1,8 +1,8 @@
1
1
  import * as React from "react";
2
2
 
3
- import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
3
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
5
4
  import { usePathname } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/usePathname";
5
+ import { useRivers } from "@applicaster/zapp-react-native-utils/reactHooks";
6
6
 
7
7
  type Props = ZappUIComponentProps & {
8
8
  rivers: ZappRivers;
@@ -12,27 +12,25 @@ type Props = ZappUIComponentProps & {
12
12
 
13
13
  export function withRiver(Component: ZappComponent): ZappComponent {
14
14
  const RiverWithData = ({ screenId, ...otherProps }: Props) => {
15
- const { rivers } = usePickFromState(["rivers"]);
15
+ const river = useRivers()?.[screenId];
16
16
  const pathname = usePathname();
17
- const river = rivers[screenId];
18
17
 
19
18
  if (!river) {
20
19
  return null;
21
20
  }
22
21
 
23
- if (!otherProps.screenData) {
24
- otherProps.screenData = river;
25
- }
26
-
27
22
  return (
28
23
  <Component
29
24
  screenId={screenId}
30
25
  river={river}
31
26
  key={isTV() ? pathname : undefined}
32
27
  {...otherProps}
28
+ screenData={otherProps.screenData || river}
33
29
  />
34
30
  );
35
31
  };
36
32
 
33
+ RiverWithData.displayName = `RiverWithData(${Component.displayName || Component.name})`;
34
+
37
35
  return RiverWithData;
38
36
  }
@@ -230,7 +230,8 @@ export function zappPipesDataConnector(
230
230
  const entryContext =
231
231
  (shouldUseNestedContext && screenContextData?.nested?.entry
232
232
  ? screenContextData?.nested?.entry
233
- : screenContextData?.entry) || {};
233
+ : (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
234
+ {};
234
235
 
235
236
  const screenContext =
236
237
  (shouldUseNestedContext && screenContextData?.nested?.screen
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.9112802542",
3
+ "version": "13.0.0-alpha.9214758151",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
- "test": "jest -w=2",
9
8
  "build": "echo skipping hybrid typescript build for now"
10
9
  },
11
10
  "publishConfig": {
@@ -32,10 +31,10 @@
32
31
  "redux-mock-store": "^1.5.3"
33
32
  },
34
33
  "dependencies": {
35
- "@applicaster/applicaster-types": "13.0.0-alpha.9112802542",
36
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9112802542",
37
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.9112802542",
38
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.9112802542",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.9214758151",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.9214758151",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.9214758151",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.9214758151",
39
38
  "promise": "^8.3.0",
40
39
  "react-router-native": "^5.1.2",
41
40
  "url": "^0.11.0",
package/.babelrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "presets": ["react-native", "flow", "react-native-stage-0/decorator-support"],
3
- "env": {
4
- "test": {
5
- "presets": [["env", { "modules": "commonjs" }], "react-native", "flow"]
6
- }
7
- }
8
- }