@applicaster/zapp-react-native-ui-components 12.0.14-alpha.6961417800 → 12.0.14-rc.0

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.
@@ -1,14 +1,14 @@
1
1
  import * as React from "react";
2
2
  import * as R from "ramda";
3
+ import { ViewStyle } from "react-native";
3
4
  import {
4
5
  findPluginByType,
5
6
  findPluginByIdentifier,
6
7
  } from "@applicaster/zapp-react-native-utils/pluginUtils";
8
+ import { useDimensions } from "@applicaster/zapp-react-native-utils/reactHooks/layout";
7
9
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
8
- import {
9
- useDimensions,
10
- useNavigation,
11
- } from "@applicaster/zapp-react-native-utils/reactHooks";
10
+ import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
11
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
12
12
 
13
13
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
14
  import { PlayerContainer } from "../PlayerContainer";
@@ -78,6 +78,12 @@ 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
+
81
87
  type PlayableComponent = {
82
88
  Component: React.ComponentType<any>;
83
89
  };
@@ -85,11 +91,16 @@ type PlayableComponent = {
85
91
  export function HandlePlayable({
86
92
  item,
87
93
  isModal,
94
+ modalHeight,
95
+ modalWidth,
88
96
  mode,
89
97
  groupId,
90
98
  }: Props): React.ReactElement | null {
91
99
  const state = usePickFromState();
92
100
 
101
+ const { width: screenWidth, height: screenHeight } =
102
+ useDimensions(dimensionsContext);
103
+
93
104
  const { closeVideoModal } = useNavigation();
94
105
 
95
106
  const [Player, playerModuleProperties] = getPlayer(item, state);
@@ -107,7 +118,9 @@ export function HandlePlayable({
107
118
  if (!isModal) {
108
119
  closeVideoModal();
109
120
  }
121
+ }, []);
110
122
 
123
+ React.useEffect(() => {
111
124
  const castStateHandler = async () => {
112
125
  const castState = await CastPlugin?.getCastState();
113
126
  setCasting(castState === "Connected");
@@ -129,23 +142,23 @@ export function HandlePlayable({
129
142
  }, []);
130
143
 
131
144
  React.useEffect(() => {
132
- setPlayable({
133
- Component: casting ? CastPlugin?.CastHandler : PlayerContainer,
134
- });
145
+ if (casting) {
146
+ setPlayable({ Component: CastPlugin?.CastHandler });
147
+ } else {
148
+ setPlayable({ Component: PlayerContainer });
149
+ }
135
150
  }, [casting]);
136
151
 
137
- const { width: screenWidth, height: screenHeight } = useDimensions("window");
152
+ const Component = playable?.Component;
138
153
 
139
154
  const style = React.useMemo(
140
155
  () => ({
141
- width: isModal ? "100%" : mode === "PIP" ? "100%" : screenWidth,
142
- height: isModal ? "100%" : mode === "PIP" ? "100%" : screenHeight,
156
+ width: isModal ? modalWidth : mode === "PIP" ? "100%" : screenWidth,
157
+ height: isModal ? modalHeight : mode === "PIP" ? "100%" : screenHeight,
143
158
  }),
144
- [screenWidth, screenHeight, isModal, mode]
159
+ [screenWidth, screenHeight, modalHeight, modalWidth, isModal, mode]
145
160
  );
146
161
 
147
- const Component = playable?.Component;
148
-
149
162
  if (Component) {
150
163
  return (
151
164
  <Component
@@ -161,5 +174,5 @@ export function HandlePlayable({
161
174
  );
162
175
  }
163
176
 
164
- return !isModal ? <BufferAnimation videoStyle={style} /> : null;
177
+ return !isModal ? <BufferAnimation videoStyle={style as ViewStyle} /> : null;
165
178
  }
@@ -137,14 +137,14 @@ const VideoModalComponent = () => {
137
137
  styles.container,
138
138
  {
139
139
  backgroundColor,
140
- width: modalSize.width,
141
- height: modalSize.height,
142
140
  },
143
141
  ]}
144
142
  >
145
143
  <HandlePlayable
146
144
  item={item}
147
145
  isModal={mode !== "PIP"}
146
+ modalHeight={modalSize.height}
147
+ modalWidth={modalSize.width}
148
148
  mode={mode}
149
149
  />
150
150
  </AnimatedPlayerModalWrapper>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.14-alpha.6961417800",
3
+ "version": "12.0.14-rc.0",
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.14-alpha.6961417800",
38
- "@applicaster/zapp-react-native-bridge": "12.0.14-alpha.6961417800",
39
- "@applicaster/zapp-react-native-redux": "12.0.14-alpha.6961417800",
40
- "@applicaster/zapp-react-native-utils": "12.0.14-alpha.6961417800",
37
+ "@applicaster/applicaster-types": "12.0.14-rc.0",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.14-rc.0",
39
+ "@applicaster/zapp-react-native-redux": "12.0.14-rc.0",
40
+ "@applicaster/zapp-react-native-utils": "12.0.14-rc.0",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",