@applicaster/zapp-react-native-ui-components 12.0.4-rc.1 → 12.0.4-rc.3

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.
@@ -25,7 +25,7 @@ type Props = {
25
25
  };
26
26
 
27
27
  export class BaseFocusable<
28
- T extends Props = Props
28
+ T extends Props = Props,
29
29
  > extends BaseFocusableInterface<T> {
30
30
  constructor(props) {
31
31
  super(props);
@@ -35,7 +35,7 @@ type Props = {
35
35
  };
36
36
 
37
37
  export class BaseFocusable<
38
- T extends Props = Props
38
+ T extends Props = Props,
39
39
  > extends BaseFocusableInterface<T> {
40
40
  constructor(props) {
41
41
  super(props);
@@ -1,25 +1,24 @@
1
1
  import * as React from "react";
2
2
 
3
- type Props =
4
- | {
5
- id: string;
6
- children: React.ReactNode;
7
- onPress?: (ref: FocusManager.TouchableRef) => void;
8
- onPressIn?: (ref: FocusManager.TouchableRef) => void;
9
- onPressOut?: (ref: FocusManager.TouchableRef) => void;
10
- onLongPress?: (ref: FocusManager.TouchableRef) => void;
11
- onFocus?: (
12
- ref: FocusManager.TouchableRef,
13
- options: FocusManager.Android.CallbackOptions
14
- ) => void;
15
- onBlur?: (
16
- ref: FocusManager.TouchableRef,
17
- options: FocusManager.Android.CallbackOptions
18
- ) => void;
19
-
20
- disableFocus?: boolean;
21
- blockFocus?: boolean;
22
- } & Partial<ParentFocus>;
3
+ type Props = {
4
+ id: string;
5
+ children: React.ReactNode;
6
+ onPress?: (ref: FocusManager.TouchableRef) => void;
7
+ onPressIn?: (ref: FocusManager.TouchableRef) => void;
8
+ onPressOut?: (ref: FocusManager.TouchableRef) => void;
9
+ onLongPress?: (ref: FocusManager.TouchableRef) => void;
10
+ onFocus?: (
11
+ ref: FocusManager.TouchableRef,
12
+ options: FocusManager.Android.CallbackOptions
13
+ ) => void;
14
+ onBlur?: (
15
+ ref: FocusManager.TouchableRef,
16
+ options: FocusManager.Android.CallbackOptions
17
+ ) => void;
18
+
19
+ disableFocus?: boolean;
20
+ blockFocus?: boolean;
21
+ } & Partial<ParentFocus>;
23
22
 
24
23
  export class Touchable extends React.Component<Props> {
25
24
  onPress(focusableRef: FocusManager.TouchableRef): void {
@@ -17,7 +17,7 @@ const SECONDARY_IMAGE_PREFIX = "secondary_image";
17
17
 
18
18
  type ImageSizing = typeof IMAGE_SIZING_FIT | typeof IMAGE_SIZING_FILL;
19
19
 
20
- type ImagePosition = typeof IMAGE_POSITION[keyof typeof IMAGE_POSITION];
20
+ type ImagePosition = (typeof IMAGE_POSITION)[keyof typeof IMAGE_POSITION];
21
21
 
22
22
  export type DisplayMode =
23
23
  | typeof DISPLAY_MODE_FIXED
@@ -103,7 +103,7 @@ export const useFilterChildren = <
103
103
  item: any;
104
104
  pluginIdentifier: string;
105
105
  };
106
- }
106
+ },
107
107
  >(
108
108
  children: T[]
109
109
  ): T[] => {
@@ -69,8 +69,8 @@ const getStyles = (configuration, selected, focused) => {
69
69
  ? tab_cell_background_color_selected_active
70
70
  : tab_cell_background_color_selected_default
71
71
  : focused
72
- ? tab_cell_background_color_active
73
- : tab_cell_background_color_default,
72
+ ? tab_cell_background_color_active
73
+ : tab_cell_background_color_default,
74
74
  justifyContent: "center",
75
75
  alignItems: "center",
76
76
  position: "relative",
@@ -85,8 +85,8 @@ const getStyles = (configuration, selected, focused) => {
85
85
  ? tab_cell_border_color_active_focused
86
86
  : tab_cell_border_color_active
87
87
  : focused
88
- ? tab_cell_border_color_default_focused
89
- : tab_cell_border_color_default,
88
+ ? tab_cell_border_color_default_focused
89
+ : tab_cell_border_color_default,
90
90
  },
91
91
  label: {
92
92
  fontFamily: text_label_font_family,
@@ -98,8 +98,8 @@ const getStyles = (configuration, selected, focused) => {
98
98
  ? text_label_selected_active_font_color
99
99
  : text_label_selected_default_font_color
100
100
  : focused
101
- ? text_label_active_font_color
102
- : text_label_default_font_color,
101
+ ? text_label_active_font_color
102
+ : text_label_default_font_color,
103
103
  },
104
104
  underline: {
105
105
  position: "absolute",
@@ -94,8 +94,8 @@ function TextInputTV(props: Props, ref) {
94
94
  styles.textAlign === "center"
95
95
  ? styles.textAlign
96
96
  : styles.textAlign === "left"
97
- ? "right"
98
- : "left";
97
+ ? "right"
98
+ : "left";
99
99
 
100
100
  return { style: { ...styles, textAlign } };
101
101
  }
@@ -3,19 +3,19 @@ import { Animated } from "react-native";
3
3
  import { NAV_ACTION_PUSH, NAV_ACTION_BACK } from "./Transitioner";
4
4
 
5
5
  type TransitionConfig = {
6
- duration: number,
7
- easing: any,
6
+ duration: number;
7
+ easing: any;
8
8
  from: {
9
- style: any,
10
- },
9
+ style: any;
10
+ };
11
11
  to: {
12
- style: any,
13
- },
12
+ style: any;
13
+ };
14
14
  };
15
15
 
16
16
  type Props = {
17
- transitionConfig: TransitionConfig,
18
- contentStyle: { [string]: any },
17
+ transitionConfig: TransitionConfig;
18
+ contentStyle: { [string]: any };
19
19
  };
20
20
 
21
21
  /**
@@ -135,13 +135,16 @@ const PlayerLiveImageComponent = (props: Props) => {
135
135
  } else {
136
136
  throw new Error("Player factory item is null");
137
137
  }
138
- }, [playerId, item, playerPluginId, screenConfig]);
138
+ }, [playerId, item.id, playerPluginId, screenConfig]);
139
139
 
140
140
  React.useEffect(() => {
141
141
  liveImageItem.setMode = setModeDebounced;
142
142
  }, [setModeDebounced, liveImageItem]);
143
143
 
144
- const { start, end } = React.useMemo(() => getAutoplaySettings(item), [item]);
144
+ const { start, end } = React.useMemo(
145
+ () => getAutoplaySettings(item),
146
+ [item.id]
147
+ );
145
148
 
146
149
  const controller = liveImageItem.getPlayer();
147
150
  const player = usePlayer(playerId);
@@ -174,7 +177,7 @@ const PlayerLiveImageComponent = (props: Props) => {
174
177
 
175
178
  unregister();
176
179
  };
177
- }, [item, liveImageItem]);
180
+ }, [item.id, liveImageItem]);
178
181
 
179
182
  React.useEffect(() => {
180
183
  if (!player) {
@@ -100,10 +100,11 @@ export const AnimationView = ({
100
100
  const moveUpValue = additionalData.saveArea
101
101
  ? -insets.top + (isAudioItem ? 0 : progressBarHeight)
102
102
  : isTablet
103
- ? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
104
- ? -tabletLandscapePlayerTopPosition + progressBarHeight
105
- : -130
106
- : -50 + progressBarHeight;
103
+ ? isTabletLandscape &&
104
+ (!isAudioItem || (isAudioItem && inlineAudioPlayer))
105
+ ? -tabletLandscapePlayerTopPosition + progressBarHeight
106
+ : -130
107
+ : -50 + progressBarHeight;
107
108
 
108
109
  const moveComponentHorizontalValue = additionalData.moveValue
109
110
  ? isRTL
@@ -434,8 +435,8 @@ export const AnimationComponent = (props: Props) => {
434
435
  const Component = useAnimation
435
436
  ? AnimationView
436
437
  : style
437
- ? View
438
- : React.Fragment;
438
+ ? View
439
+ : React.Fragment;
439
440
 
440
441
  if (
441
442
  additionalData.extraAnimation &&
@@ -108,8 +108,8 @@ export const calculateAnimationValue = (animationType, dragPosition, data) => {
108
108
  : { forWidth: 3, forHeight: 3 }
109
109
  : { forWidth: 2, forHeight: 2 }
110
110
  : isTabletLandscape
111
- ? { forWidth: 8, forHeight: 6.5 }
112
- : { forWidth: 3.5, forHeight: 2 };
111
+ ? { forWidth: 8, forHeight: 6.5 }
112
+ : { forWidth: 3.5, forHeight: 2 };
113
113
 
114
114
  const minWidth =
115
115
  isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
@@ -0,0 +1,33 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, View } from "react-native";
3
+
4
+ import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
5
+
6
+ import { Spinner } from "../Spinner";
7
+
8
+ const styles = StyleSheet.create({
9
+ container: {
10
+ ...StyleSheet.absoluteFillObject,
11
+ alignItems: "center",
12
+ justifyContent: "center",
13
+ },
14
+ });
15
+
16
+ export const OpaqueLayer = () => {
17
+ const theme = useTheme();
18
+
19
+ return (
20
+ <View
21
+ style={[
22
+ styles.container,
23
+ {
24
+ // we assume that it's non-transparent and we could show spinner always until it will be covered by player
25
+ // this spinner hides all content under modal
26
+ backgroundColor: theme?.app_background_color,
27
+ },
28
+ ]}
29
+ >
30
+ <Spinner />
31
+ </View>
32
+ );
33
+ };
@@ -10,7 +10,8 @@ import { Edge, SafeAreaView } from "react-native-safe-area-context";
10
10
  import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
11
11
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
12
12
  import { PlayerDetails } from "./PlayerDetails";
13
- import { playerDimesionsHack } from "./utils";
13
+ import { playerDimensionsHack } from "./utils";
14
+ import { useDelayedPlayerDetails } from "./hooks";
14
15
 
15
16
  import {
16
17
  AnimatedScrollModal,
@@ -121,34 +122,6 @@ const getTabletWidth = (
121
122
  return Number(width) - sidebarWidth;
122
123
  };
123
124
 
124
- const showDetails = (
125
- isMobile: boolean,
126
- docked: boolean,
127
- isInlineModal,
128
- pip
129
- ): boolean => {
130
- if (pip) {
131
- return false;
132
- }
133
-
134
- if (!isInlineModal) {
135
- return false;
136
- }
137
-
138
- // for mobile we always show details. Mounting of it very heavy operation.
139
- if (isMobile) {
140
- return true;
141
- }
142
-
143
- // workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
144
- // FIXME - find out the reason of dissapearing of content
145
- if (docked) {
146
- return false;
147
- }
148
-
149
- return true;
150
- };
151
-
152
125
  const PlayerWrapperComponent = (props: Props) => {
153
126
  const {
154
127
  entry,
@@ -167,7 +140,15 @@ const PlayerWrapperComponent = (props: Props) => {
167
140
 
168
141
  const isInlineModal = inline && isModal;
169
142
 
170
- // const style = getStyles(baseStyle, !isTablet, isInlineModal, pip);
143
+ // Mounting the PlayerDetails component is a resource-intensive process.
144
+ // Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
145
+ // The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
146
+ // This helps to avoid blocking the rotation and any animations related to the rotation.
147
+ const isShowPlayerDetails = useDelayedPlayerDetails({
148
+ isInline: isInlineModal,
149
+ isDocked: docked,
150
+ isPip: pip,
151
+ });
171
152
 
172
153
  const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
173
154
 
@@ -203,8 +184,8 @@ const PlayerWrapperComponent = (props: Props) => {
203
184
  const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
204
185
 
205
186
  const childrenStyles = React.useMemo(
206
- () => ({ ...playerDimensions, ...playerDimesionsHack }),
207
- [containerDimensions, playerDimesionsHack]
187
+ () => ({ ...playerDimensions, ...playerDimensionsHack }),
188
+ [containerDimensions, playerDimensionsHack]
208
189
  );
209
190
 
210
191
  return (
@@ -213,7 +194,7 @@ const PlayerWrapperComponent = (props: Props) => {
213
194
  style={[
214
195
  safeAreaStyles(configuration, isTablet),
215
196
  style,
216
- playerDimesionsHack,
197
+ playerDimensionsHack,
217
198
  ]}
218
199
  >
219
200
  <AnimationComponent
@@ -227,7 +208,7 @@ const PlayerWrapperComponent = (props: Props) => {
227
208
  defaultStyles.playerContainer,
228
209
  containerDimensions,
229
210
  containerStyle,
230
- playerDimesionsHack,
211
+ playerDimensionsHack,
231
212
  ]}
232
213
  >
233
214
  <AnimationComponent
@@ -246,7 +227,7 @@ const PlayerWrapperComponent = (props: Props) => {
246
227
  </View>
247
228
 
248
229
  <AnimatedScrollModal>
249
- {showDetails(!isTablet, docked, isInlineModal, pip) && (
230
+ {isShowPlayerDetails && (
250
231
  <AnimationComponent
251
232
  animationType={ComponentAnimationType.componentFade}
252
233
  style={defaultStyles.flex}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import * as R from "ramda";
3
- import { StyleSheet, View, StatusBar } from "react-native";
2
+ import { equals } from "ramda";
3
+ import { StyleSheet, StatusBar } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -17,17 +17,20 @@ import {
17
17
  import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
18
18
 
19
19
  import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
20
- import { useModalSize } from "./hooks/useModalSize";
21
- import { useBackgroundColor } from "./hooks/useBackgroundColor";
22
- import { useInitialPlayerState } from "./hooks/useInitialPlayerState";
20
+ import {
21
+ useModalSize,
22
+ useBackgroundColor,
23
+ useInitialPlayerState,
24
+ } from "./hooks";
25
+
23
26
  import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
24
- import { Spinner } from "../Spinner";
25
27
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
26
28
  import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
27
29
  import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
28
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
29
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
30
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { OpaqueLayer } from "./OpaqueLayer";
31
34
 
32
35
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
33
36
 
@@ -39,17 +42,6 @@ const styles = StyleSheet.create({
39
42
  bottom: 0,
40
43
  position: "absolute",
41
44
  },
42
- // eslint-disable-next-line react-native/no-color-literals
43
- loaderContainer: {
44
- top: 0,
45
- left: 0,
46
- right: 0,
47
- bottom: 0,
48
- position: "absolute",
49
- alignItems: "center",
50
- justifyContent: "center",
51
- backgroundColor: "rgba(64,64,64,.5)",
52
- },
53
45
  });
54
46
 
55
47
  const VideoModalComponent = () => {
@@ -100,7 +92,7 @@ const VideoModalComponent = () => {
100
92
 
101
93
  const onHooksSuccess = ({ payload }) => {
102
94
  // set new modified entry
103
- if (!R.equals(payload, item)) {
95
+ if (!equals(payload, item)) {
104
96
  onVideoModalHookSuccessAnalyticsEvent();
105
97
  setVideoModalItem(payload);
106
98
  }
@@ -136,7 +128,10 @@ const VideoModalComponent = () => {
136
128
 
137
129
  <PathnameContext.Provider value={pathname}>
138
130
  <ScreenContextProvider pathname={pathname}>
139
- {itemIdHooksFinished === item?.id ? (
131
+ {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
+ {mode === "FULLSCREEN" && <OpaqueLayer />}
133
+
134
+ {itemIdHooksFinished === item?.id && (
140
135
  <AnimatedPlayerModalWrapper
141
136
  style={[
142
137
  styles.container,
@@ -153,10 +148,6 @@ const VideoModalComponent = () => {
153
148
  mode={mode}
154
149
  />
155
150
  </AnimatedPlayerModalWrapper>
156
- ) : (
157
- <View style={styles.loaderContainer}>
158
- <Spinner />
159
- </View>
160
151
  )}
161
152
  </ScreenContextProvider>
162
153
  </PathnameContext.Provider>
@@ -59,7 +59,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
59
59
  })),
60
60
  }));
61
61
 
62
- jest.mock("../utils", () => ({ playerDimesionsHack: {} }));
62
+ jest.mock("../utils", () => ({ playerDimensionsHack: {} }));
63
63
 
64
64
  const { PlayerWrapper } = require("../PlayerWrapper");
65
65
 
@@ -71,36 +71,6 @@ exports[`PlayerWrapper renders inline 1`] = `
71
71
  }
72
72
  testID="test-player-container"
73
73
  />
74
- <View
75
- animationType="componentFade"
76
- style={
77
- Object {
78
- "flex": 1,
79
- }
80
- }
81
- >
82
- <View
83
- configuration={
84
- Object {
85
- "tablet_landscape_player_container_background_color": "red",
86
- "tablet_landscape_sidebar_width": "35%",
87
- }
88
- }
89
- entry={
90
- Object {
91
- "id": "test",
92
- }
93
- }
94
- isTablet={false}
95
- isTabletLandscape={false}
96
- style={
97
- Object {
98
- "flex": 1,
99
- "paddingTop": 20,
100
- }
101
- }
102
- />
103
- </View>
104
74
  </View>
105
75
  </RNCSafeAreaView>
106
76
  </RNCSafeAreaProvider>
@@ -177,36 +147,6 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
177
147
  }
178
148
  testID="test-player-container"
179
149
  />
180
- <View
181
- animationType="componentFade"
182
- style={
183
- Object {
184
- "flex": 1,
185
- }
186
- }
187
- >
188
- <View
189
- configuration={
190
- Object {
191
- "tablet_landscape_player_container_background_color": "red",
192
- "tablet_landscape_sidebar_width": "35%",
193
- }
194
- }
195
- entry={
196
- Object {
197
- "id": "test",
198
- }
199
- }
200
- isTablet={false}
201
- isTabletLandscape={false}
202
- style={
203
- Object {
204
- "flex": 1,
205
- "paddingTop": 20,
206
- }
207
- }
208
- />
209
- </View>
210
150
  </View>
211
151
  </RNCSafeAreaView>
212
152
  </RNCSafeAreaProvider>
@@ -299,36 +239,6 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
299
239
  }
300
240
  />
301
241
  </View>
302
- <View
303
- animationType="componentFade"
304
- style={
305
- Object {
306
- "flex": 1,
307
- }
308
- }
309
- >
310
- <View
311
- configuration={
312
- Object {
313
- "tablet_landscape_player_container_background_color": "red",
314
- "tablet_landscape_sidebar_width": "35%",
315
- }
316
- }
317
- entry={
318
- Object {
319
- "id": "test",
320
- }
321
- }
322
- isTablet={true}
323
- isTabletLandscape={true}
324
- style={
325
- Object {
326
- "flex": 1,
327
- "paddingTop": 20,
328
- }
329
- }
330
- />
331
- </View>
332
242
  </View>
333
243
  </RNCSafeAreaView>
334
244
  </RNCSafeAreaProvider>
@@ -0,0 +1,7 @@
1
+ export { useBackgroundColor } from "./useBackgroundColor";
2
+
3
+ export { useDelayedPlayerDetails } from "./useDelayedPlayerDetails";
4
+
5
+ export { useInitialPlayerState } from "./useInitialPlayerState";
6
+
7
+ export { useModalSize } from "./useModalSize";
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
3
+ import { withTimeout$ } from "@applicaster/zapp-react-native-utils/idleUtils";
4
+
5
+ import { showDetails } from "./utils";
6
+
7
+ const TIMEOUT = 100; // ms
8
+
9
+ type Props = { isInline: boolean; isDocked: boolean; isPip: boolean };
10
+
11
+ /**
12
+ * Custom hook to determine whether to show player details with a delay.
13
+ *
14
+ * @param {Object} params - The parameters object.
15
+ * @param {boolean} params.isInline - Indicates if the player is inline.
16
+ * @param {boolean} params.isDocked - Indicates if the player is docked.
17
+ * @param {boolean} params.isPip - Indicates if the player is in PIP mode.
18
+ * @returns {boolean} - Returns true if player details should be shown, otherwise false.
19
+ */
20
+ export const useDelayedPlayerDetails = ({
21
+ isInline,
22
+ isDocked,
23
+ isPip,
24
+ }: Props): boolean => {
25
+ const [shouldShowDetails, setShouldShowDetails] = React.useState(false);
26
+
27
+ const isTablet = useIsTablet();
28
+
29
+ React.useEffect(() => {
30
+ const subscription = withTimeout$(TIMEOUT).subscribe({
31
+ next: () => {
32
+ setShouldShowDetails(() => {
33
+ return showDetails({
34
+ isMobile: !isTablet,
35
+ isInline,
36
+ isDocked,
37
+ isPip,
38
+ });
39
+ });
40
+ },
41
+ });
42
+
43
+ return () => {
44
+ subscription.unsubscribe();
45
+ };
46
+ }, [isDocked, isTablet, isInline, isPip]);
47
+
48
+ return shouldShowDetails;
49
+ };
@@ -0,0 +1,91 @@
1
+ import { showDetails } from "..";
2
+
3
+ describe("showDetails", () => {
4
+ it("should return false if isPip is true", () => {
5
+ const result = showDetails({
6
+ isMobile: true,
7
+ isInline: true,
8
+ isDocked: false,
9
+ isPip: true,
10
+ });
11
+
12
+ expect(result).toBe(false);
13
+ });
14
+
15
+ it("should return false if isDocked is true", () => {
16
+ const result = showDetails({
17
+ isMobile: true,
18
+ isInline: true,
19
+ isDocked: true,
20
+ isPip: false,
21
+ });
22
+
23
+ expect(result).toBe(false);
24
+ });
25
+
26
+ it("should return true if isMobile is true and isInline is true", () => {
27
+ const result = showDetails({
28
+ isMobile: true,
29
+ isInline: true,
30
+ isDocked: false,
31
+ isPip: false,
32
+ });
33
+
34
+ expect(result).toBe(true);
35
+ });
36
+
37
+ it("should return false if isMobile is true and isInline is false", () => {
38
+ const result = showDetails({
39
+ isMobile: true,
40
+ isInline: false,
41
+ isDocked: false,
42
+ isPip: false,
43
+ });
44
+
45
+ expect(result).toBe(false);
46
+ });
47
+
48
+ it("should return true if isMobile is false", () => {
49
+ const result = showDetails({
50
+ isMobile: false,
51
+ isInline: true,
52
+ isDocked: false,
53
+ isPip: false,
54
+ });
55
+
56
+ expect(result).toBe(true);
57
+ });
58
+
59
+ it("should return true if isMobile is false and isInline is false", () => {
60
+ const result = showDetails({
61
+ isMobile: false,
62
+ isInline: false,
63
+ isDocked: false,
64
+ isPip: false,
65
+ });
66
+
67
+ expect(result).toBe(true);
68
+ });
69
+
70
+ it("should return false if all properties are false except isMobile", () => {
71
+ const result = showDetails({
72
+ isMobile: true,
73
+ isInline: false,
74
+ isDocked: false,
75
+ isPip: false,
76
+ });
77
+
78
+ expect(result).toBe(false);
79
+ });
80
+
81
+ it("should return true if all properties are false except isInline", () => {
82
+ const result = showDetails({
83
+ isMobile: false,
84
+ isInline: true,
85
+ isDocked: false,
86
+ isPip: false,
87
+ });
88
+
89
+ expect(result).toBe(true);
90
+ });
91
+ });
@@ -35,3 +35,36 @@ export const orientationWasChangedFromPortraitToLandscape = ({
35
35
  isOrientationLandscape(toOrientation)
36
36
  );
37
37
  };
38
+
39
+ export const showDetails = ({
40
+ isMobile,
41
+ isInline,
42
+ isDocked,
43
+ isPip,
44
+ }: {
45
+ isMobile: boolean;
46
+ isInline: boolean;
47
+ isDocked: boolean;
48
+ isPip: boolean;
49
+ }): boolean => {
50
+ if (isPip) {
51
+ return false;
52
+ }
53
+
54
+ if (isDocked) {
55
+ return false;
56
+ }
57
+
58
+ // for mobile with inline mode(rotation is portrait) we always show details.
59
+ if (isMobile && isInline) {
60
+ return true;
61
+ }
62
+
63
+ // for mobile with landscape rotation(player is fullscreen) we always hide details. Mounting of it is very heavy operation.
64
+ if (isMobile && !isInline) {
65
+ return false;
66
+ }
67
+
68
+ // for tablets we always show details
69
+ return true;
70
+ };
@@ -54,7 +54,7 @@ const fullSize = {
54
54
  height: "100%",
55
55
  };
56
56
 
57
- export const playerDimesionsHack = platformSelect({
57
+ export const playerDimensionsHack = platformSelect({
58
58
  android_tv: fullSize,
59
59
  amazon: fullSize,
60
60
  lg_tv: fullSize,
@@ -99,8 +99,9 @@ export function ScreenContextProvider({
99
99
  const isNested = useNestedNavigationContext();
100
100
  const currentScreenScreenData = useCurrentScreenData();
101
101
 
102
- const screenNavBarStateRef =
103
- useRef<null | ReturnType<typeof createStore>>(null);
102
+ const screenNavBarStateRef = useRef<null | ReturnType<typeof createStore>>(
103
+ null
104
+ );
104
105
 
105
106
  const getScreenNavBarState = useCallback(() => {
106
107
  if (screenNavBarStateRef.current !== null) {
@@ -5,18 +5,18 @@ import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
5
5
 
6
6
  type ComponentProps = {
7
7
  component: {
8
- id: string,
9
- rules: { item_limit: number, component_cells_selectable: boolean },
10
- component_type: string,
8
+ id: string;
9
+ rules: { item_limit: number; component_cells_selectable: boolean };
10
+ component_type: string;
11
11
  styles: {
12
- cell_style: string,
13
- header: { visible: boolean },
14
- component_cells_selectable: boolean,
15
- },
16
- },
17
- zappPipesData: { url: string, data: { title: string } },
18
- selected: boolean,
19
- assets: { menu_button: string },
12
+ cell_style: string;
13
+ header: { visible: boolean };
14
+ component_cells_selectable: boolean;
15
+ };
16
+ };
17
+ zappPipesData: { url: string; data: { title: string } };
18
+ selected: boolean;
19
+ assets: { menu_button: string };
20
20
  };
21
21
 
22
22
  function withAnalytics(Component) {
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
2
2
  import { View } from "react-native";
3
3
 
4
4
  type Props = {
5
- onLoadFinished: () => void,
5
+ onLoadFinished: () => void;
6
6
  };
7
7
 
8
8
  export function Hero(props: Props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.4-rc.1",
3
+ "version": "12.0.4-rc.3",
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",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "12.0.4-rc.1",
38
- "@applicaster/zapp-react-native-bridge": "12.0.4-rc.1",
39
- "@applicaster/zapp-react-native-redux": "12.0.4-rc.1",
40
- "@applicaster/zapp-react-native-utils": "12.0.4-rc.1",
37
+ "@applicaster/applicaster-types": "12.0.4-rc.3",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.4-rc.3",
39
+ "@applicaster/zapp-react-native-redux": "12.0.4-rc.3",
40
+ "@applicaster/zapp-react-native-utils": "12.0.4-rc.3",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",