@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1486614302 → 13.0.0-alpha.1503493274

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 (38) hide show
  1. package/Components/AudioPlayer/AudioPlayer.tsx +0 -11
  2. package/Components/AudioPlayer/AudioPlayerLayout.tsx +8 -9
  3. package/Components/AudioPlayer/helpers.tsx +0 -2
  4. package/Components/CellRendererResolver/index.ts +2 -1
  5. package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
  6. package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
  7. package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
  8. package/Components/Layout/TV/LayoutBackground.tsx +28 -0
  9. package/Components/Layout/TV/ScreenContainer.tsx +0 -1
  10. package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
  11. package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
  12. package/Components/Layout/TV/index.tsx +6 -20
  13. package/Components/Layout/TV/index.web.tsx +4 -1
  14. package/Components/ModalComponent/BottomSheetModalContent.tsx +66 -54
  15. package/Components/ModalComponent/Button/Item.tsx +6 -5
  16. package/Components/ModalComponent/Button/index.tsx +45 -62
  17. package/Components/ModalComponent/Header/index.tsx +9 -8
  18. package/Components/ModalComponent/utils.ts +55 -7
  19. package/Components/PlayerContainer/PlayerContainer.tsx +23 -40
  20. package/Components/River/ComponentsMap/ComponentsMap.tsx +11 -3
  21. package/Components/River/RiverItem.tsx +8 -3
  22. package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +7 -1
  23. package/Components/RouteManager/TestId.tsx +1 -5
  24. package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +0 -1
  25. package/Components/RouteManager/__tests__/testId.test.js +0 -4
  26. package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
  27. package/Components/Screen/__tests__/Screen.test.tsx +22 -14
  28. package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
  29. package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
  30. package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +1 -1
  31. package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +1 -2
  32. package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +9 -1
  33. package/Components/VideoModal/ModalAnimation/utils.ts +3 -9
  34. package/Components/VideoModal/PlayerDetails.tsx +9 -4
  35. package/Components/VideoModal/PlayerWrapper.tsx +9 -19
  36. package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
  37. package/Components/VideoModal/utils.ts +1 -1
  38. package/package.json +5 -5
@@ -16,7 +16,7 @@ exports[`<Screen Component /> when the navbar should be hidden renders correctly
16
16
  pathname="/river/testId"
17
17
  selected="testId"
18
18
  testID="navBar"
19
- title=""
19
+ title="Test Title"
20
20
  />
21
21
  <View>
22
22
  <View
@@ -48,7 +48,7 @@ exports[`<Screen Component /> when the navbar should show renders correctly 1`]
48
48
  pathname="/river/testId"
49
49
  selected="testId"
50
50
  testID="navBar"
51
- title=""
51
+ title="Test Title"
52
52
  />
53
53
  <View>
54
54
  <View
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { View, ViewProps, ViewStyle } from "react-native";
3
3
  import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
4
4
  import { useCurrentScreenData } from "@applicaster/zapp-react-native-utils/reactHooks";
5
+ import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
5
6
 
6
7
  interface IProps {
7
8
  targetScreenId?: string;
@@ -31,11 +32,9 @@ export const useMarginTop = (targetScreenId: string): number => {
31
32
  * ScreenPicker is a component but should really be a screen.
32
33
  * We need to skip margin top for it as it's already applied to the target screen
33
34
  **/
34
- const isScreenPicker =
35
- screenData?.ui_components?.[0]?.component_type === "screen-picker-qb-tv";
36
35
 
37
36
  // ignore margin on screenPicker
38
- if (isScreenPicker) {
37
+ if (isFirstComponentScreenPicker(screenData?.ui_components)) {
39
38
  return 0;
40
39
  }
41
40
 
@@ -144,7 +144,7 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
144
144
 
145
145
  setLastSnap(destSnapPoint);
146
146
 
147
- if (destSnapPoint === modalSnapPoints[0] && isMinimizedModal) {
147
+ if (destSnapPoint === modalSnapPoints[0]) {
148
148
  translateYOffset.extractOffset();
149
149
  translateYOffset.setValue(preparedTranslationY);
150
150
  translateYOffset.flattenOffset();
@@ -94,7 +94,7 @@ export const AnimationView = ({
94
94
  const isAudioItem = React.useMemo(
95
95
  () =>
96
96
  videoModalItem?.content?.type?.includes?.("audio") ||
97
- videoModalItem?.type?.value === "audio",
97
+ videoModalItem?.type?.value?.includes?.("audio"),
98
98
  [videoModalItem]
99
99
  );
100
100
 
@@ -107,7 +107,6 @@ export const AnimationView = ({
107
107
  progressBarHeight,
108
108
  isTablet,
109
109
  isTabletLandscape,
110
- inlineAudioPlayer,
111
110
  tabletLandscapePlayerTopPosition,
112
111
  });
113
112
 
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useEffect } from "react";
2
2
  import { Animated } from "react-native";
3
3
 
4
4
  import {
@@ -17,6 +17,7 @@ export enum PlayerAnimationStateEnum {
17
17
  maximize = "maximize",
18
18
  drag_player = "drag_player",
19
19
  drag_scroll = "drag_scroll",
20
+ appear_as_docked = "appear_as_docked",
20
21
  }
21
22
 
22
23
  export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
@@ -95,6 +96,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
95
96
  setStartComponentsAnimation(false);
96
97
  }, []);
97
98
 
99
+ useEffect(() => {
100
+ // Reset player animation state when video modal is closed
101
+ if (!visible) {
102
+ resetPlayerAnimationState();
103
+ }
104
+ }, [visible, resetPlayerAnimationState]);
105
+
98
106
  // Animated values
99
107
  const lastScrollY = React.useRef(new Animated.Value(0)).current;
100
108
  const dragScrollY = React.useRef(new Animated.Value(0)).current;
@@ -309,7 +309,6 @@ export const getMoveUpValue = ({
309
309
  progressBarHeight,
310
310
  isTablet,
311
311
  isTabletLandscape,
312
- inlineAudioPlayer,
313
312
  tabletLandscapePlayerTopPosition,
314
313
  }) => {
315
314
  if (additionalData.saveArea) {
@@ -322,17 +321,12 @@ export const getMoveUpValue = ({
322
321
  }
323
322
 
324
323
  if (isTablet) {
325
- if (
326
- isTabletLandscape &&
327
- (!isAudioItem || (isAudioItem && inlineAudioPlayer))
328
- ) {
324
+ if (isTabletLandscape) {
329
325
  return -tabletLandscapePlayerTopPosition + progressBarHeight;
326
+ } else {
327
+ return -130;
330
328
  }
331
-
332
- // for audioPlayer(tablet/isTabletPortrait) in docked mode
333
- return -130;
334
329
  }
335
330
 
336
- // for audioPlayer(mobile) in docked mode
337
331
  return -50 + progressBarHeight;
338
332
  };
@@ -10,6 +10,7 @@ import {
10
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
11
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
12
12
  import { useSafeAreaInsets } from "react-native-safe-area-context";
13
+ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
13
14
 
14
15
  const { width: SCREEN_WIDTH } = Dimensions.get("screen");
15
16
 
@@ -22,9 +23,9 @@ type Props = {
22
23
  entry: ZappEntry;
23
24
  style: StyleProp<ViewStyle>;
24
25
  configuration: Configuration;
25
- isTabletLandscape: boolean;
26
+ isTabletLandscape?: boolean;
26
27
  isAudioPlayer?: boolean;
27
- isTablet: boolean;
28
+ isTablet?: boolean;
28
29
  };
29
30
 
30
31
  const containerStyle = ({
@@ -39,9 +40,9 @@ export const PlayerDetails = ({
39
40
  entry,
40
41
  style,
41
42
  configuration,
42
- isTabletLandscape,
43
+ isTabletLandscape = false,
43
44
  isAudioPlayer,
44
- isTablet,
45
+ isTablet = false,
45
46
  }: Props) => {
46
47
  const screenData = useTargetScreenData(entry);
47
48
  const insets = useSafeAreaInsets();
@@ -78,6 +79,10 @@ export const PlayerDetails = ({
78
79
  }
79
80
  }, [isAudioPlayer]);
80
81
 
82
+ if (isNilOrEmpty(screenData?.ui_components)) {
83
+ return null;
84
+ }
85
+
81
86
  return (
82
87
  <Animated.View
83
88
  style={[
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
74
74
  return longEdge / shortEdge;
75
75
  };
76
76
 
77
- const safeAreaStyles = (
78
- configuration: Configuration,
79
- isTablet: boolean
80
- ): ViewStyle => {
81
- const tablet_landscape_player_container_background_color =
82
- configuration?.tablet_landscape_player_container_background_color;
83
-
84
- return {
85
- backgroundColor: isTablet
86
- ? tablet_landscape_player_container_background_color
87
- : "transparent",
88
- };
89
- };
90
-
91
77
  const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
92
78
  if (isTablet) {
93
79
  return ["top"];
@@ -156,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
156
142
  children,
157
143
  isTabletPortrait,
158
144
  configuration,
145
+ fullscreen,
159
146
  pip,
160
147
  } = props;
161
148
 
@@ -211,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
211
198
  [containerDimensions, playerDimensionsHack]
212
199
  );
213
200
 
201
+ const wrapperViewStyle: ViewStyle = {
202
+ backgroundColor:
203
+ isTablet && !fullscreen
204
+ ? configuration?.tablet_landscape_player_container_background_color
205
+ : "transparent",
206
+ };
207
+
214
208
  return (
215
209
  <WrapperView
216
210
  edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
217
- style={[
218
- safeAreaStyles(configuration, isTablet),
219
- style,
220
- playerDimensionsHack,
221
- ]}
211
+ style={[wrapperViewStyle, style, playerDimensionsHack]}
222
212
  >
223
213
  <AnimationComponent
224
214
  animationType={ComponentAnimationType.moveUpComponent}
@@ -1,43 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`PlayerDetails renders properly 1`] = `
4
- <View
5
- collapsable={false}
6
- style={
7
- {
8
- "backgroundColor": "transparent",
9
- "flex": 1,
10
- "marginTop": -8,
11
- "paddingTop": -8,
12
- "width": 750,
13
- }
14
- }
15
- >
16
- <View
17
- feed="test-source"
18
- riverComponents={[]}
19
- riverId="test-id"
20
- />
21
- </View>
22
- `;
3
+ exports[`PlayerDetails renders properly 1`] = `null`;
23
4
 
24
- exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
25
- <View
26
- collapsable={false}
27
- style={
28
- {
29
- "backgroundColor": "transparent",
30
- "flex": 1,
31
- "marginTop": -20,
32
- "paddingTop": 40,
33
- "width": 750,
34
- }
35
- }
36
- >
37
- <View
38
- feed="test-source"
39
- riverComponents={[]}
40
- riverId="test-id"
41
- />
42
- </View>
43
- `;
5
+ exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
@@ -1,4 +1,4 @@
1
- import { mergeRight } from "@applicaster/zapp-react-native-utils/utils";
1
+ import { mergeRight } from "ramda";
2
2
  import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
3
3
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
4
4
  import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.1486614302",
3
+ "version": "13.0.0-alpha.1503493274",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.0-alpha.1486614302",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1486614302",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1486614302",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1486614302",
34
+ "@applicaster/applicaster-types": "13.0.0-alpha.1503493274",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1503493274",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1503493274",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1503493274",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",