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

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