@applicaster/zapp-react-native-ui-components 12.0.8 → 12.0.9-alpha.3292285337

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.
@@ -4,7 +4,6 @@ import { TouchableOpacity, ViewStyle } from "react-native";
4
4
  import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/actions";
5
5
 
6
6
  import Image from "./Image";
7
-
8
7
  type Props = {
9
8
  item: ZappEntry | ZappFeed;
10
9
  flavour?: "flavour_1" | "flavour_2";
@@ -69,7 +68,7 @@ export function ActionButton(props: Props) {
69
68
  if (!((actionDisabled || !actionContext) && actionState !== null)) {
70
69
  setActionState(actionContext.initialEntryState(item));
71
70
  }
72
- }, [actionDisabled, item?.id, actionContext, action]);
71
+ }, [actionDisabled, item?.id, actionContext, action, setActionState]);
73
72
 
74
73
  const onPress = useCallback(() => {
75
74
  actionContext.invokeAction(item, {
@@ -85,7 +84,7 @@ export function ActionButton(props: Props) {
85
84
  setActionState(state);
86
85
  });
87
86
  }
88
- }, [item?.id]);
87
+ }, [item?.id, setActionState, actionContext]);
89
88
 
90
89
  if (actionDisabled || !actionContext) return null;
91
90
  const AssetComponent = actionState?.asset;
@@ -34,7 +34,6 @@ export const useFillInPercent = (entry: ZappEntry): number => {
34
34
  React.useState<number>(DEFAULT_FILL);
35
35
 
36
36
  React.useEffect(() => {
37
- // setup progress in UI on mount
38
37
  getProgressValue(action, entry, (progress) => {
39
38
  setFillInPercent(progress);
40
39
  });
@@ -45,17 +44,12 @@ export const useFillInPercent = (entry: ZappEntry): number => {
45
44
  return;
46
45
  }
47
46
 
48
- // refresh progress in UI when it was changed in CW
49
- const unsubscribe = action?.addDataSourceListener?.(() => {
47
+ return action?.addDataSourceListener?.(() => {
50
48
  getProgressValue(action, entry, (progress) => {
51
49
  setFillInPercent(progress);
52
50
  });
53
51
  });
54
-
55
- return () => {
56
- unsubscribe?.();
57
- };
58
- }, [isActive]);
52
+ }, [isActive, action, entry, setFillInPercent]);
59
53
 
60
54
  return fillInPercent;
61
55
  };
@@ -1,4 +1,4 @@
1
- import React, { PropsWithChildren } from "react";
1
+ import React, { PropsWithChildren, useEffect, useState } from "react";
2
2
  import { ImageBackground, View } from "react-native";
3
3
 
4
4
  import { imageSrcFromMediaItem } from "@applicaster/zapp-react-native-utils/configurationUtils";
@@ -12,6 +12,7 @@ import {
12
12
  type Props = PropsWithChildren<{
13
13
  entry: ZappEntry;
14
14
  style?: { [K: string]: any };
15
+ docked?: boolean;
15
16
  imageStyle?: { [K: string]: any };
16
17
  imageKey?: string;
17
18
  defaultImageDimensions?: { [K: string]: any };
@@ -23,6 +24,7 @@ const PlayerImageBackgroundComponent = ({
23
24
  entry,
24
25
  children,
25
26
  style,
27
+ docked,
26
28
  imageStyle,
27
29
  imageKey,
28
30
  defaultImageDimensions,
@@ -34,8 +36,22 @@ const PlayerImageBackgroundComponent = ({
34
36
 
35
37
  const { playerAnimationState } = useModalAnimationContext();
36
38
 
39
+ const [lastNonNullAnimationState, setLastNonNullAnimationState] =
40
+ useState(playerAnimationState);
41
+
42
+ useEffect(() => {
43
+ if (playerAnimationState !== null) {
44
+ setLastNonNullAnimationState(playerAnimationState);
45
+ }
46
+ }, [playerAnimationState]);
47
+
37
48
  if (!source) return <>{children}</>;
38
49
 
50
+ const imageBackgroundStyle =
51
+ lastNonNullAnimationState !== PlayerAnimationStateEnum.minimize && !docked
52
+ ? defaultImageDimensions
53
+ : imageSize;
54
+
39
55
  return (
40
56
  <View
41
57
  style={
@@ -45,13 +61,17 @@ const PlayerImageBackgroundComponent = ({
45
61
  }
46
62
  >
47
63
  <AnimationComponent
48
- style={style}
64
+ style={
65
+ playerAnimationState === PlayerAnimationStateEnum.maximaze
66
+ ? defaultImageDimensions
67
+ : style
68
+ }
49
69
  animationType={ComponentAnimationType.player}
50
70
  additionalData={defaultImageDimensions}
51
71
  >
52
72
  <ImageBackground
53
73
  resizeMode="cover"
54
- style={imageSize}
74
+ style={imageBackgroundStyle}
55
75
  imageStyle={imageStyle}
56
76
  source={source}
57
77
  >
@@ -5,6 +5,7 @@ import {
5
5
  Animated,
6
6
  Easing,
7
7
  Dimensions,
8
+ StyleSheet,
8
9
  } from "react-native";
9
10
  import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
10
11
  import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
@@ -23,7 +24,7 @@ type Props = {
23
24
  configuration: Configuration;
24
25
  isTabletLandscape: boolean;
25
26
  isAudioPlayer?: boolean;
26
- isTablet: boolean;
27
+ isTablet?: boolean;
27
28
  };
28
29
 
29
30
  const containerStyle = ({
@@ -90,17 +91,19 @@ export const PlayerDetails = ({
90
91
  {
91
92
  // workaround for avoid wrong text-height after going back to portrait rotation
92
93
  // we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
93
- width: isTablet ? undefined : SCREEN_WIDTH,
94
+ width: isTablet
95
+ ? undefined
96
+ : (StyleSheet.flatten(style)?.width ?? SCREEN_WIDTH),
94
97
  },
95
98
  ]}
96
99
  >
97
- {screenData && (
100
+ {screenData ? (
98
101
  <ComponentsMap
99
102
  riverId={screenData.id}
100
103
  feed={screenData?.data?.source}
101
104
  riverComponents={screenData.ui_components}
102
105
  />
103
- )}
106
+ ) : null}
104
107
  </Animated.View>
105
108
  );
106
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.8",
3
+ "version": "12.0.9-alpha.3292285337",
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.8",
38
- "@applicaster/zapp-react-native-bridge": "12.0.8",
39
- "@applicaster/zapp-react-native-redux": "12.0.8",
40
- "@applicaster/zapp-react-native-utils": "12.0.8",
37
+ "@applicaster/applicaster-types": "12.0.9-alpha.3292285337",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.9-alpha.3292285337",
39
+ "@applicaster/zapp-react-native-redux": "12.0.9-alpha.3292285337",
40
+ "@applicaster/zapp-react-native-utils": "12.0.9-alpha.3292285337",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",