@applicaster/zapp-react-native-ui-components 12.0.0-rc.48 → 12.0.0-rc.49

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,9 +4,7 @@ import { StyleSheet, View } from "react-native";
4
4
 
5
5
  import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
6
6
  import {
7
- MenuTypes,
8
7
  useNavigation,
9
- useNavigationType,
10
8
  useZappHooksForEntry,
11
9
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
10
  import { useIsInitialRender } from "@applicaster/zapp-react-native-utils/reactHooks/utils";
@@ -16,12 +14,12 @@ import {
16
14
  allowedOrientationsForScreen,
17
15
  ORIENTATIONS,
18
16
  } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
17
+ import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
19
18
 
20
19
  import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
21
20
  import { useModalSize } from "./hooks/useModalSize";
22
21
  import { useBackgroundColor } from "./hooks/useBackgroundColor";
23
22
  import { useInitialPlayerState } from "./hooks/useInitialPlayerState";
24
- import { usePosition } from "./hooks/usePosition";
25
23
  import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
26
24
  import { Spinner } from "../Spinner";
27
25
  import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
@@ -31,6 +29,8 @@ import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/con
31
29
  import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
32
30
  import { ScreenContextProvider } from "../../Contexts/ScreenContext";
33
31
 
32
+ import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
33
+
34
34
  const styles = StyleSheet.create({
35
35
  container: {
36
36
  top: 0,
@@ -59,22 +59,9 @@ const VideoModalComponent = () => {
59
59
  const onVideoModalHookSuccessAnalyticsEvent = useVideoModalAnalytics();
60
60
 
61
61
  const modalSize = useModalSize();
62
-
63
62
  const isFirstRender = useIsInitialRender();
64
-
65
63
  const backgroundColor = useBackgroundColor();
66
64
 
67
- const { top, height, bottom } = usePosition();
68
-
69
- const navType = useNavigationType();
70
- const isBottomBarsNavigation = navType === MenuTypes.bottomTabBar;
71
- const heightWithSafeArea = height ? height + bottom : null;
72
-
73
- const dockedHeight =
74
- isBottomBarsNavigation && height ? height : heightWithSafeArea;
75
-
76
- const dockedBottom = isBottomBarsNavigation ? bottom : 0;
77
-
78
65
  const {
79
66
  closeVideoModal,
80
67
  setVideoModalItem,
@@ -83,8 +70,6 @@ const VideoModalComponent = () => {
83
70
  maximiseVideoModal,
84
71
  } = useNavigation();
85
72
 
86
- const docked = mode === "MINIMIZED";
87
-
88
73
  const logTimestamp = useProfilerLogging();
89
74
 
90
75
  useInitialPlayerState(fullscreenVideoModal, maximiseVideoModal, item);
@@ -105,9 +90,10 @@ const VideoModalComponent = () => {
105
90
  }, [item?.id]);
106
91
 
107
92
  const isLandscape = modalSize.width > modalSize.height;
93
+ const isTablet = useIsTablet();
108
94
 
109
95
  React.useEffect(() => {
110
- if (isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
96
+ if (!isTablet && isLandscape && mode !== "FULLSCREEN" && mode !== "PIP") {
111
97
  fullscreenVideoModal();
112
98
  }
113
99
  }, [isLandscape]);
@@ -143,13 +129,10 @@ const VideoModalComponent = () => {
143
129
  const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
144
130
 
145
131
  return (
146
- <View
132
+ <AnimatedPlayerModalWrapper
147
133
  style={[
148
134
  styles.container,
149
135
  {
150
- top,
151
- height: dockedHeight,
152
- bottom: dockedBottom,
153
136
  backgroundColor,
154
137
  },
155
138
  ]}
@@ -160,7 +143,7 @@ const VideoModalComponent = () => {
160
143
  <HandlePlayable
161
144
  item={item}
162
145
  isModal={mode !== "PIP"}
163
- modalHeight={docked ? height : modalSize.height}
146
+ modalHeight={modalSize.height}
164
147
  modalWidth={modalSize.width}
165
148
  mode={mode}
166
149
  />
@@ -171,7 +154,7 @@ const VideoModalComponent = () => {
171
154
  )}
172
155
  </PathnameContext.Provider>
173
156
  </ScreenContextProvider>
174
- </View>
157
+ </AnimatedPlayerModalWrapper>
175
158
  );
176
159
  };
177
160
 
@@ -19,6 +19,10 @@ const props = {
19
19
 
20
20
  const useIsTablet = jest.fn();
21
21
 
22
+ jest.mock("react-native");
23
+
24
+ jest.mock("react-native-gesture-handler");
25
+
22
26
  jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
23
27
 
24
28
  jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
@@ -44,6 +48,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
44
48
  canGoBack: () => false,
45
49
  currentRoute: "/river/testId",
46
50
  data: { screen: { id: "testId" } },
51
+ videoModalState: { visible: false },
47
52
  })),
48
53
  }));
49
54
 
@@ -93,7 +98,7 @@ describe("PlayerWrapper", () => {
93
98
  useIsTablet.mockReturnValue(false);
94
99
 
95
100
  const children = jest.fn(() => {});
96
- const dimensions = { height: 50, width: props.style.width };
101
+ const dimensions = { height: undefined, width: props.style.width };
97
102
 
98
103
  const element = renderWithProviders(
99
104
  <PlayerWrapper
@@ -23,9 +23,6 @@ exports[`PlayerWrapper renders inline 1`] = `
23
23
  }
24
24
  style={
25
25
  Array [
26
- Object {
27
- "flexDirection": "column",
28
- },
29
26
  Object {
30
27
  "backgroundColor": "transparent",
31
28
  },
@@ -38,44 +35,45 @@ exports[`PlayerWrapper renders inline 1`] = `
38
35
  }
39
36
  >
40
37
  <View
41
- style={
42
- Array [
43
- Object {
44
- "alignSelf": "center",
45
- "position": "relative",
46
- "zIndex": 200,
47
- },
48
- Object {
49
- "aspectRatio": 1.7777777777777777,
50
- "height": undefined,
51
- "width": "100%",
52
- },
53
- Object {},
54
- Object {},
55
- ]
56
- }
57
- testID="test-player-container"
58
- />
59
- <View
60
- configuration={
38
+ additionalData={
61
39
  Object {
62
- "tablet_landscape_player_container_background_color": "red",
63
- "tablet_landscape_sidebar_width": "35%",
40
+ "saveArea": true,
64
41
  }
65
42
  }
66
- entry={
67
- Object {
68
- "id": "test",
69
- }
70
- }
71
- isTabletLandscape={false}
43
+ animationType="moveUpComponent"
72
44
  style={
73
45
  Object {
74
- "flex": 1,
75
- "paddingTop": 20,
46
+ "flexDirection": "column",
76
47
  }
77
48
  }
78
- />
49
+ >
50
+ <View
51
+ style={
52
+ Array [
53
+ Object {
54
+ "alignSelf": "center",
55
+ "position": "relative",
56
+ "zIndex": 200,
57
+ },
58
+ Object {
59
+ "aspectRatio": 1.7777777777777777,
60
+ "height": undefined,
61
+ "width": "100%",
62
+ },
63
+ Object {},
64
+ Object {},
65
+ ]
66
+ }
67
+ testID="test-player-container"
68
+ />
69
+ <View
70
+ style={
71
+ Object {
72
+ "flex": 1,
73
+ }
74
+ }
75
+ />
76
+ </View>
79
77
  </RNCSafeAreaView>
80
78
  </RNCSafeAreaProvider>
81
79
  `;
@@ -95,22 +93,19 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
95
93
  <RNCSafeAreaView
96
94
  edges={
97
95
  Object {
98
- "bottom": "additive",
96
+ "bottom": "off",
99
97
  "left": "off",
100
98
  "right": "off",
101
- "top": "off",
99
+ "top": "additive",
102
100
  }
103
101
  }
104
102
  style={
105
103
  Array [
106
- Object {
107
- "flexDirection": "column",
108
- },
109
104
  Object {
110
105
  "backgroundColor": "transparent",
111
106
  },
112
107
  Object {
113
- "height": 50,
108
+ "height": undefined,
114
109
  "width": 300,
115
110
  },
116
111
  Object {},
@@ -118,32 +113,45 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
118
113
  }
119
114
  >
120
115
  <View
121
- style={
122
- Array [
123
- Object {
124
- "alignSelf": "center",
125
- "position": "relative",
126
- "zIndex": 200,
127
- },
128
- Object {
129
- "aspectRatio": undefined,
130
- "height": 50,
131
- "width": "100%",
132
- },
133
- Object {},
134
- Object {},
135
- ]
116
+ additionalData={
117
+ Object {
118
+ "saveArea": true,
119
+ }
136
120
  }
137
- testID="test-player-container"
138
- />
139
- <View
121
+ animationType="moveUpComponent"
140
122
  style={
141
123
  Object {
142
- "flex": 1,
143
- "paddingTop": 20,
124
+ "flexDirection": "column",
144
125
  }
145
126
  }
146
- />
127
+ >
128
+ <View
129
+ style={
130
+ Array [
131
+ Object {
132
+ "alignSelf": "center",
133
+ "position": "relative",
134
+ "zIndex": 200,
135
+ },
136
+ Object {
137
+ "aspectRatio": undefined,
138
+ "height": undefined,
139
+ "width": "100%",
140
+ },
141
+ Object {},
142
+ Object {},
143
+ ]
144
+ }
145
+ testID="test-player-container"
146
+ />
147
+ <View
148
+ style={
149
+ Object {
150
+ "flex": 1,
151
+ }
152
+ }
153
+ />
154
+ </View>
147
155
  </RNCSafeAreaView>
148
156
  </RNCSafeAreaProvider>
149
157
  `;
@@ -171,9 +179,6 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
171
179
  }
172
180
  style={
173
181
  Array [
174
- Object {
175
- "flexDirection": "row",
176
- },
177
182
  Object {
178
183
  "backgroundColor": "red",
179
184
  },
@@ -186,44 +191,61 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
186
191
  }
187
192
  >
188
193
  <View
189
- style={
190
- Array [
191
- Object {
192
- "alignSelf": "center",
193
- "position": "relative",
194
- "zIndex": 200,
195
- },
196
- Object {
197
- "aspectRatio": 1.7777777777777777,
198
- "height": undefined,
199
- "width": 195,
200
- },
201
- Object {},
202
- Object {},
203
- ]
204
- }
205
- testID="test-player-container"
206
- />
207
- <View
208
- configuration={
209
- Object {
210
- "tablet_landscape_player_container_background_color": "red",
211
- "tablet_landscape_sidebar_width": "35%",
212
- }
213
- }
214
- entry={
194
+ additionalData={
215
195
  Object {
216
- "id": "test",
196
+ "saveArea": true,
217
197
  }
218
198
  }
219
- isTabletLandscape={true}
199
+ animationType="moveUpComponent"
220
200
  style={
221
201
  Object {
222
- "flex": 1,
223
- "paddingTop": 20,
202
+ "flexDirection": "row",
224
203
  }
225
204
  }
226
- />
205
+ >
206
+ <View
207
+ style={
208
+ Array [
209
+ Object {
210
+ "alignSelf": "center",
211
+ "position": "relative",
212
+ "zIndex": 200,
213
+ },
214
+ Object {
215
+ "aspectRatio": 1.7777777777777777,
216
+ "height": undefined,
217
+ "width": 195,
218
+ },
219
+ Object {},
220
+ Object {},
221
+ ]
222
+ }
223
+ testID="test-player-container"
224
+ >
225
+ <View
226
+ additionalData={
227
+ Object {
228
+ "disableAnimatedComponent": false,
229
+ "resetAnimationValue": undefined,
230
+ "useLayoutMeasure": true,
231
+ }
232
+ }
233
+ animationType="moveUpComponent"
234
+ style={
235
+ Object {
236
+ "flex": 1,
237
+ }
238
+ }
239
+ />
240
+ </View>
241
+ <View
242
+ style={
243
+ Object {
244
+ "flex": 1,
245
+ }
246
+ }
247
+ />
248
+ </View>
227
249
  </RNCSafeAreaView>
228
250
  </RNCSafeAreaProvider>
229
251
  `;
@@ -251,9 +273,6 @@ exports[`PlayerWrapper renders properly 1`] = `
251
273
  }
252
274
  style={
253
275
  Array [
254
- Object {
255
- "flexDirection": "column",
256
- },
257
276
  Object {
258
277
  "backgroundColor": "transparent",
259
278
  },
@@ -266,32 +285,45 @@ exports[`PlayerWrapper renders properly 1`] = `
266
285
  }
267
286
  >
268
287
  <View
269
- style={
270
- Array [
271
- Object {
272
- "alignSelf": "center",
273
- "position": "relative",
274
- "zIndex": 200,
275
- },
276
- Object {
277
- "aspectRatio": 1.7786666666666666,
278
- "height": undefined,
279
- "width": "100%",
280
- },
281
- Object {},
282
- Object {},
283
- ]
288
+ additionalData={
289
+ Object {
290
+ "saveArea": true,
291
+ }
284
292
  }
285
- testID="test-player-container"
286
- />
287
- <View
293
+ animationType="moveUpComponent"
288
294
  style={
289
295
  Object {
290
- "flex": 1,
291
- "paddingTop": 20,
296
+ "flexDirection": "column",
292
297
  }
293
298
  }
294
- />
299
+ >
300
+ <View
301
+ style={
302
+ Array [
303
+ Object {
304
+ "alignSelf": "center",
305
+ "position": "relative",
306
+ "zIndex": 200,
307
+ },
308
+ Object {
309
+ "aspectRatio": 1.7786666666666666,
310
+ "height": undefined,
311
+ "width": "100%",
312
+ },
313
+ Object {},
314
+ Object {},
315
+ ]
316
+ }
317
+ testID="test-player-container"
318
+ />
319
+ <View
320
+ style={
321
+ Object {
322
+ "flex": 1,
323
+ }
324
+ }
325
+ />
326
+ </View>
295
327
  </RNCSafeAreaView>
296
328
  </RNCSafeAreaProvider>
297
329
  `;
@@ -23,13 +23,13 @@ export const useConfiguration = () => {
23
23
  const targetScreenConfiguration = rivers?.[targetScreenId];
24
24
 
25
25
  const pluginConfiguration =
26
- pluginConfigurations[targetScreenConfiguration.type].configuration_json;
26
+ pluginConfigurations[targetScreenConfiguration?.type]?.configuration_json;
27
27
 
28
28
  const playerPluginConfig = playerManager.getPluginConfiguration();
29
29
 
30
30
  const config = R.mergeRight(playerPluginConfig, {
31
- ...targetScreenConfiguration.general,
32
- ...targetScreenConfiguration.styles,
31
+ ...targetScreenConfiguration?.general,
32
+ ...targetScreenConfiguration?.styles,
33
33
  ...pluginConfiguration,
34
34
  });
35
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "12.0.0-rc.48",
3
+ "version": "12.0.0-rc.49",
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-rc.48",
38
- "@applicaster/zapp-react-native-bridge": "12.0.0-rc.48",
39
- "@applicaster/zapp-react-native-redux": "12.0.0-rc.48",
40
- "@applicaster/zapp-react-native-utils": "12.0.0-rc.48",
37
+ "@applicaster/applicaster-types": "12.0.0-rc.49",
38
+ "@applicaster/zapp-react-native-bridge": "12.0.0-rc.49",
39
+ "@applicaster/zapp-react-native-redux": "12.0.0-rc.49",
40
+ "@applicaster/zapp-react-native-utils": "12.0.0-rc.49",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",
@@ -1,50 +0,0 @@
1
- import {
2
- useNavigation,
3
- useNavigationType,
4
- MenuTypes,
5
- useGetBottomTabBarHeight,
6
- } from "@applicaster/zapp-react-native-utils/reactHooks";
7
- import { useSafeAreaInsets } from "react-native-safe-area-context";
8
- import { isMenuVisible } from "@applicaster/zapp-react-native-ui-components/Components/Screen/navigationHandler";
9
-
10
- import { useConfiguration } from "../utils";
11
-
12
- type Option<T> = T | undefined;
13
-
14
- type Return = {
15
- top: Option<number>;
16
- height: Option<number>;
17
- bottom: Option<number>;
18
- };
19
-
20
- export const usePosition = (): Return => {
21
- const { minimised_height: minimisedHeight } = useConfiguration();
22
- const insets = useSafeAreaInsets();
23
- const bottomTabBarHeight = useGetBottomTabBarHeight();
24
-
25
- const {
26
- videoModalState: { mode },
27
- currentRoute,
28
- screenData,
29
- } = useNavigation();
30
-
31
- const docked = mode === "MINIMIZED";
32
-
33
- const navType = useNavigationType();
34
- const isBottomBarNavigation = navType === MenuTypes.bottomTabBar;
35
-
36
- const minimisedMarginBottom =
37
- isMenuVisible(currentRoute, screenData) && isBottomBarNavigation
38
- ? bottomTabBarHeight
39
- : insets.bottom;
40
-
41
- if (docked) {
42
- return {
43
- top: undefined,
44
- height: minimisedHeight,
45
- bottom: minimisedMarginBottom,
46
- };
47
- }
48
-
49
- return { top: 0, height: undefined, bottom: 0 };
50
- };