@applicaster/zapp-react-native-ui-components 13.0.0-rc.87 → 13.0.0-rc.89

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.
@@ -12,6 +12,7 @@ import {
12
12
 
13
13
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
14
  import { PlayerContainer } from "../PlayerContainer";
15
+ import { useModalSize } from "../VideoModal/hooks";
15
16
 
16
17
  type Props = {
17
18
  item: ZappEntry;
@@ -136,12 +137,18 @@ export function HandlePlayable({
136
137
 
137
138
  const { width: screenWidth, height: screenHeight } = useDimensions("window");
138
139
 
140
+ const modalSize = useModalSize();
141
+
139
142
  const style = React.useMemo(
140
143
  () => ({
141
- width: isModal ? "100%" : mode === "PIP" ? "100%" : screenWidth,
142
- height: isModal ? "100%" : mode === "PIP" ? "100%" : screenHeight,
144
+ width: isModal ? modalSize.width : mode === "PIP" ? "100%" : screenWidth,
145
+ height: isModal
146
+ ? modalSize.height
147
+ : mode === "PIP"
148
+ ? "100%"
149
+ : screenHeight,
143
150
  }),
144
- [screenWidth, screenHeight, isModal, mode]
151
+ [screenWidth, screenHeight, modalSize, isModal, mode]
145
152
  );
146
153
 
147
154
  const Component = playable?.Component;
@@ -100,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
100
100
  return ["top"];
101
101
  };
102
102
 
103
+ const isPercentage = (value: string | number): boolean => {
104
+ if (typeof value === "string") {
105
+ return value.includes("%");
106
+ }
107
+
108
+ return false;
109
+ };
110
+
111
+ const getPercentageOf = (percent: string, value: number) => {
112
+ const percentageValue = parseFloat(percent.replace("%", ""));
113
+
114
+ if (isNaN(percentageValue)) {
115
+ return value;
116
+ }
117
+
118
+ return (value * percentageValue) / 100;
119
+ };
120
+
103
121
  const getTabletWidth = (
104
122
  configuration: Configuration,
105
123
  dimensions: DimensionsT
@@ -108,18 +126,23 @@ const getTabletWidth = (
108
126
  configuration?.tablet_landscape_sidebar_width;
109
127
 
110
128
  const { width } = dimensions;
129
+ let widthValue = Number(width);
130
+
131
+ if (isPercentage(width)) {
132
+ widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
133
+ }
111
134
 
112
135
  const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
113
136
 
114
137
  if (tablet_landscape_sidebar_width?.includes("%")) {
115
- return Number(width) * (1 - sidebarWidth / 100);
138
+ return widthValue * (1 - sidebarWidth / 100);
116
139
  }
117
140
 
118
141
  if (Number.isNaN(sidebarWidth)) {
119
- return Number(width) * 0.65;
142
+ return widthValue * 0.65;
120
143
  }
121
144
 
122
- return Number(width) - sidebarWidth;
145
+ return widthValue - sidebarWidth;
123
146
  };
124
147
 
125
148
  const PlayerWrapperComponent = (props: Props) => {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { equals } from "ramda";
3
- import { StyleSheet, StatusBar } from "react-native";
3
+ import { StyleSheet, StatusBar, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
30
30
  import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
31
31
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
32
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
+ import { Spinner } from "../Spinner";
33
34
  import { OpaqueLayer } from "./OpaqueLayer";
34
35
 
35
36
  import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
36
37
 
38
+ const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
39
+
37
40
  const styles = StyleSheet.create({
38
41
  container: {
39
42
  top: 0,
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
42
45
  bottom: 0,
43
46
  position: "absolute",
44
47
  },
48
+ loaderContainer: {
49
+ top: 0,
50
+ left: 0,
51
+ right: 0,
52
+ bottom: 0,
53
+ position: "absolute",
54
+ alignItems: "center",
55
+ justifyContent: "center",
56
+ backgroundColor: LOADER_BACKGROUND_COLOR,
57
+ },
45
58
  });
46
59
 
47
60
  const VideoModalComponent = () => {
@@ -131,14 +144,12 @@ const VideoModalComponent = () => {
131
144
  {/* Hide content underneath when we switch to next video in fullscreen mode */}
132
145
  {mode === "FULLSCREEN" && <OpaqueLayer />}
133
146
 
134
- {itemIdHooksFinished === item?.id && (
147
+ {itemIdHooksFinished === item?.id ? (
135
148
  <AnimatedPlayerModalWrapper
136
149
  style={[
137
150
  styles.container,
138
151
  {
139
152
  backgroundColor,
140
- width: modalSize.width,
141
- height: modalSize.height,
142
153
  },
143
154
  ]}
144
155
  >
@@ -148,6 +159,10 @@ const VideoModalComponent = () => {
148
159
  mode={mode}
149
160
  />
150
161
  </AnimatedPlayerModalWrapper>
162
+ ) : (
163
+ <View style={styles.loaderContainer}>
164
+ <Spinner />
165
+ </View>
151
166
  )}
152
167
  </ScreenContextProvider>
153
168
  </PathnameContext.Provider>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-rc.87",
3
+ "version": "13.0.0-rc.89",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.0-rc.87",
35
- "@applicaster/zapp-react-native-bridge": "13.0.0-rc.87",
36
- "@applicaster/zapp-react-native-redux": "13.0.0-rc.87",
37
- "@applicaster/zapp-react-native-utils": "13.0.0-rc.87",
34
+ "@applicaster/applicaster-types": "13.0.0-rc.89",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.0-rc.89",
36
+ "@applicaster/zapp-react-native-redux": "13.0.0-rc.89",
37
+ "@applicaster/zapp-react-native-utils": "13.0.0-rc.89",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",