@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7517336525 → 12.0.0-alpha.7531504237

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.
@@ -117,9 +117,6 @@ export const BorderContainerView = (props: Props) => {
117
117
  children,
118
118
  } = props;
119
119
 
120
- const borderStyleForMissingBorder =
121
- style?.borderWidth === 0 || !style?.borderColor ? { borderRadius: 0 } : {};
122
-
123
120
  const padding =
124
121
  borderPosition === "outside"
125
122
  ? {
@@ -131,10 +128,7 @@ export const BorderContainerView = (props: Props) => {
131
128
  : {};
132
129
 
133
130
  return (
134
- <View
135
- {...props}
136
- style={[style, styles.container, borderStyleForMissingBorder]}
137
- >
131
+ <View {...props} style={[style, styles.container]} pointerEvents="box-none">
138
132
  <Border style={style} padding={padding} borderPosition={borderPosition} />
139
133
  {children}
140
134
  </View>
@@ -0,0 +1,57 @@
1
+ import { ImageStyle } from "react-native";
2
+
3
+ import {
4
+ getImageContainerMarginStyles,
5
+ ifElseFocusedSelected,
6
+ } from "@applicaster/zapp-react-native-utils/cellUtils";
7
+ import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
8
+
9
+ export const ImageBorderContainer = ({
10
+ value,
11
+ state,
12
+ imageStyles,
13
+ }: {
14
+ value: (key: string) => string;
15
+ state: CellState;
16
+ imageStyles: ImageStyle;
17
+ }) => {
18
+ return {
19
+ type: "BorderContainerView",
20
+ style: {
21
+ ...getImageContainerMarginStyles({ value }),
22
+ position: "absolute",
23
+ top: 0,
24
+ zIndex: 1,
25
+ borderWidth: value("image_border_size"),
26
+ borderColor: ifElseFocusedSelected(
27
+ state,
28
+ value("image_focused_border_color"),
29
+ value("image_selected_border_color"),
30
+ value("image_focused_selected_border_color"),
31
+ value("image_border_color")
32
+ ),
33
+ borderRadius: toNumberWithDefaultZero(value("image_corner_radius")),
34
+ },
35
+ additionalProps: {
36
+ borderPosition: value("image_border_position"),
37
+ borderPaddingTop: toNumberWithDefaultZero(
38
+ value("image_border_padding_top")
39
+ ),
40
+ borderPaddingRight: toNumberWithDefaultZero(
41
+ value("image_border_padding_right")
42
+ ),
43
+ borderPaddingBottom: toNumberWithDefaultZero(
44
+ value("image_border_padding_bottom")
45
+ ),
46
+ borderPaddingLeft: toNumberWithDefaultZero(
47
+ value("image_border_padding_left")
48
+ ),
49
+ },
50
+ elements: [
51
+ {
52
+ type: "View",
53
+ style: imageStyles,
54
+ },
55
+ ],
56
+ };
57
+ };
@@ -15,6 +15,7 @@ import { BorderContainerView } from "./BorderContainerView";
15
15
  import { CellBadge } from "./CellBadge";
16
16
  import { TvActionButtons } from "./tv/TvActionButtons";
17
17
  import { ButtonContainerView } from "./tv/ButtonContainerView";
18
+ import { ImageBorderContainer } from "./ImageBorderContainer";
18
19
 
19
20
  export const defaultComponents = {
20
21
  View,
@@ -28,6 +29,7 @@ export const defaultComponents = {
28
29
  ProgressBar,
29
30
  Toggle,
30
31
  LiveImage,
32
+ ImageBorderContainer,
31
33
  BorderContainerView,
32
34
  DynamicBadge,
33
35
  SecondaryImage,
@@ -5,6 +5,7 @@ import * as R from "ramda";
5
5
 
6
6
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
7
7
  import { normalizeProgressValue } from "./utils";
8
+ import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHooks";
8
9
 
9
10
  const ACTION_NAME = "continue-watching";
10
11
  const DEFAULT_FILL = 0;
@@ -27,6 +28,7 @@ const getProgressValue = (
27
28
 
28
29
  export const useFillInPercent = (entry: ZappEntry): number => {
29
30
  const action = useActions(ACTION_NAME);
31
+ const isActive = useIsScreenActive();
30
32
 
31
33
  const [fillInPercent, setFillInPercent] =
32
34
  React.useState<number>(DEFAULT_FILL);
@@ -39,6 +41,10 @@ export const useFillInPercent = (entry: ZappEntry): number => {
39
41
  }, []);
40
42
 
41
43
  React.useEffect(() => {
44
+ if (!isActive) {
45
+ return;
46
+ }
47
+
42
48
  // refresh progress in UI when it was changed in CW
43
49
  const unsubscribe = action?.addDataSourceListener?.(() => {
44
50
  getProgressValue(action, entry, (progress) => {
@@ -49,7 +55,7 @@ export const useFillInPercent = (entry: ZappEntry): number => {
49
55
  return () => {
50
56
  unsubscribe?.();
51
57
  };
52
- }, []);
58
+ }, [isActive]);
53
59
 
54
60
  return fillInPercent;
55
61
  };
@@ -76,8 +76,8 @@ export function masterCellBuilder({
76
76
  const selectedState = screen?.selectedEntry;
77
77
 
78
78
  const entryIsSelected = React.useMemo(
79
- () => selectedState?.id === item?.id,
80
- [selectedState?.id]
79
+ () => !!(selectedState?.id && selectedState?.id === item?.id),
80
+ [selectedState?.id, item?.id]
81
81
  );
82
82
 
83
83
  const elements = React.useMemo(
@@ -200,7 +200,23 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
200
200
  videoModalState.mode === "MINIMIZED" &&
201
201
  videoModalState.previousMode === "MAXIMIZED"
202
202
  ) {
203
- resetPlayerAnimationState();
203
+ // set animation to the minimize values if moving from the player to another screen
204
+ if (playerAnimationState === null) {
205
+ setScrollModalAnimatedValue(
206
+ translateYOffset,
207
+ modalSnapPoints[1],
208
+ setLastSnap
209
+ );
210
+
211
+ resetScrollAnimatedValues(
212
+ lastScrollY,
213
+ lastScrollYValue,
214
+ dragScrollY,
215
+ dragVideoPlayerY
216
+ );
217
+ } else {
218
+ resetPlayerAnimationState();
219
+ }
204
220
  }
205
221
 
206
222
  if (
@@ -349,7 +365,12 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
349
365
  };
350
366
 
351
367
  export const AnimatedScrollModal = ({ children }: Props) => {
352
- const Component = !isTV() ? AnimatedScrollModalComponent : React.Fragment;
368
+ const {
369
+ videoModalState: { visible },
370
+ } = useNavigation();
371
+
372
+ const Component =
373
+ !isTV() && visible ? AnimatedScrollModalComponent : React.Fragment;
353
374
 
354
375
  return <Component>{children}</Component>;
355
376
  };
@@ -155,7 +155,11 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
155
155
  };
156
156
 
157
157
  export const AnimatedVideoPlayerComponent = ({ children }: Props) => {
158
- const Component = !isTV() ? AnimatedVideoPlayer : React.Fragment;
158
+ const {
159
+ videoModalState: { visible },
160
+ } = useNavigation();
161
+
162
+ const Component = !isTV() && visible ? AnimatedVideoPlayer : React.Fragment;
159
163
 
160
164
  return <Component>{children}</Component>;
161
165
  };
@@ -309,6 +309,23 @@ export const AnimationView = ({
309
309
  }
310
310
  }, [additionalData, screenWidth]);
311
311
 
312
+ React.useEffect(() => {
313
+ if (
314
+ videoModalState.mode === "MINIMIZED" &&
315
+ videoModalState.previousMode === "MAXIMIZED"
316
+ ) {
317
+ // set animation to the minimize values if moving from the player to another screen
318
+ if (playerAnimationState === null) {
319
+ const value = getAnimationValue(
320
+ animationType,
321
+ PlayerAnimationStateEnum.minimize
322
+ ).toValue;
323
+
324
+ animatedValue.setValue(value);
325
+ }
326
+ }
327
+ }, [videoModalState]);
328
+
312
329
  React.useEffect(() => {
313
330
  if (
314
331
  playerAnimationState === PlayerAnimationStateEnum.minimize &&
@@ -72,12 +72,34 @@ exports[`PlayerWrapper renders inline 1`] = `
72
72
  testID="test-player-container"
73
73
  />
74
74
  <View
75
+ animationType="componentFade"
75
76
  style={
76
77
  Object {
77
78
  "flex": 1,
78
79
  }
79
80
  }
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
+ isTabletLandscape={false}
95
+ style={
96
+ Object {
97
+ "flex": 1,
98
+ "paddingTop": 20,
99
+ }
100
+ }
101
+ />
102
+ </View>
81
103
  </View>
82
104
  </RNCSafeAreaView>
83
105
  </RNCSafeAreaProvider>
@@ -158,6 +180,7 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
158
180
  style={
159
181
  Object {
160
182
  "flex": 1,
183
+ "paddingTop": 20,
161
184
  }
162
185
  }
163
186
  />
@@ -254,12 +277,34 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
254
277
  />
255
278
  </View>
256
279
  <View
280
+ animationType="componentFade"
257
281
  style={
258
282
  Object {
259
283
  "flex": 1,
260
284
  }
261
285
  }
262
- />
286
+ >
287
+ <View
288
+ configuration={
289
+ Object {
290
+ "tablet_landscape_player_container_background_color": "red",
291
+ "tablet_landscape_sidebar_width": "35%",
292
+ }
293
+ }
294
+ entry={
295
+ Object {
296
+ "id": "test",
297
+ }
298
+ }
299
+ isTabletLandscape={true}
300
+ style={
301
+ Object {
302
+ "flex": 1,
303
+ "paddingTop": 20,
304
+ }
305
+ }
306
+ />
307
+ </View>
263
308
  </View>
264
309
  </RNCSafeAreaView>
265
310
  </RNCSafeAreaProvider>
@@ -340,6 +385,7 @@ exports[`PlayerWrapper renders properly 1`] = `
340
385
  style={
341
386
  Object {
342
387
  "flex": 1,
388
+ "paddingTop": 20,
343
389
  }
344
390
  }
345
391
  />
@@ -16,9 +16,9 @@ exports[`DefaultCellRenderer returns a react component and it renders correctly
16
16
  store={null}
17
17
  style={
18
18
  Object {
19
- "backgroundColor": "#CCC",
19
+ "backgroundColor": "transparent",
20
20
  "margin": 12,
21
- "opacity": 0.6,
21
+ "opacity": 1,
22
22
  "width": 169,
23
23
  }
24
24
  }
@@ -105,7 +105,7 @@ exports[`DefaultCellRenderer returns a react component for LG TVs 1`] = `
105
105
  store={null}
106
106
  style={
107
107
  Object {
108
- "backgroundColor": "rgba(252,70,27,1.0)",
108
+ "backgroundColor": "rgba(47,47,47,1.0)",
109
109
  "borderRadius": 4,
110
110
  "flex": 1,
111
111
  "overflow": "hidden",
@@ -238,7 +238,7 @@ exports[`DefaultCellRenderer returns a react component for Samsung TVs 1`] = `
238
238
  store={null}
239
239
  style={
240
240
  Object {
241
- "backgroundColor": "rgba(252,70,27,1.0)",
241
+ "backgroundColor": "rgba(47,47,47,1.0)",
242
242
  "borderRadius": 4,
243
243
  "flex": 1,
244
244
  "overflow": "hidden",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-alpha.7517336525",
3
+ "version": "12.0.0-alpha.7531504237",
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.0-alpha.7517336525",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7517336525",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7517336525",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7517336525",
37
+ "@applicaster/applicaster-types": "12.0.0-alpha.7531504237",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7531504237",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-alpha.7531504237",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-alpha.7531504237",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",