@applicaster/zapp-react-native-ui-components 12.0.0-rc.74 → 12.0.0-rc.76
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.
|
@@ -9,6 +9,7 @@ import { usePlayer } from "@applicaster/zapp-react-native-utils/appUtils/playerM
|
|
|
9
9
|
import { PushTopicManager } from "@applicaster/zapp-react-native-bridge/PushNotifications/PushTopicManager";
|
|
10
10
|
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
11
11
|
import { getCellState } from "../../Cell/utils";
|
|
12
|
+
import { getColorFromData } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
12
13
|
|
|
13
14
|
const hasElementSpecificViewType = (viewType) => (element) => {
|
|
14
15
|
if (R.isNil(element)) {
|
|
@@ -47,44 +48,26 @@ export const hasElementsSpecificViewType = (viewType) => (elements) => {
|
|
|
47
48
|
return R.any(hasElementSpecificViewType(viewType))(elements);
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
const isColorOrEmpty = (value) =>
|
|
51
|
-
value === null ||
|
|
52
|
-
value === undefined ||
|
|
53
|
-
value === "" ||
|
|
54
|
-
value.startsWith("#") ||
|
|
55
|
-
value.startsWith("rgba") ||
|
|
56
|
-
value === "transparent";
|
|
57
|
-
|
|
58
51
|
function resolveColorForProp(entry, style, colorProp) {
|
|
59
|
-
const
|
|
52
|
+
const colorFromProp = style[colorProp];
|
|
53
|
+
const nestedEntryValue = R.path(colorFromProp.split("."), entry);
|
|
60
54
|
|
|
61
|
-
if (
|
|
62
|
-
|
|
55
|
+
if (nestedEntryValue === undefined) {
|
|
56
|
+
logWarning(colorFromProp, style, entry, nestedEntryValue);
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (nestedEntryValue === null || typeof nestedEntryValue !== "object") {
|
|
70
|
-
logWarning(colorValue, style, entry, nestedEntryValue);
|
|
71
|
-
|
|
72
|
-
return style;
|
|
73
|
-
}
|
|
59
|
+
const colorValue = getColorFromData({
|
|
60
|
+
data: entry,
|
|
61
|
+
valueFromLayout: colorFromProp,
|
|
62
|
+
});
|
|
74
63
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (nestedEntryValue === undefined) {
|
|
79
|
-
logWarning(colorValue, style, entry, nestedEntryValue);
|
|
64
|
+
if (!colorValue) {
|
|
65
|
+
logWarning(colorProp, style, entry, colorValue);
|
|
80
66
|
|
|
81
67
|
return style;
|
|
82
68
|
}
|
|
83
69
|
|
|
84
|
-
|
|
85
|
-
style[colorProp] = nestedEntryValue;
|
|
86
|
-
|
|
87
|
-
return style;
|
|
70
|
+
return { ...style, [colorProp]: colorValue };
|
|
88
71
|
}
|
|
89
72
|
|
|
90
73
|
export function resolveColor(entry, style) {
|
|
@@ -252,6 +252,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
showNavBar(true);
|
|
255
|
+
|
|
256
|
+
// Hack to close player screen on mobile only (tv handles that in InteractionManager)
|
|
257
|
+
if (!isTV()) {
|
|
258
|
+
navigator.goBack();
|
|
259
|
+
}
|
|
255
260
|
}, [isModal, navigator.goBack, showNavBar]);
|
|
256
261
|
|
|
257
262
|
const playEntry = (entry) => navigator.replaceTop(entry, { mode });
|
|
@@ -10,6 +10,8 @@ const mock_navBarVisibleFlag = true;
|
|
|
10
10
|
|
|
11
11
|
const mockIsNavBarVisible = jest.fn(() => mock_navBarVisibleFlag);
|
|
12
12
|
|
|
13
|
+
const mockIsOrientationCompatible = jest.fn(() => true);
|
|
14
|
+
|
|
13
15
|
jest.mock("react-native-safe-area-context", () => ({
|
|
14
16
|
useSafeAreaInsets: () => ({ top: 44 }),
|
|
15
17
|
}));
|
|
@@ -21,6 +23,7 @@ jest.mock("../../RouteManager", () => ({
|
|
|
21
23
|
jest.mock(
|
|
22
24
|
"@applicaster/zapp-react-native-utils/appUtils/orientationHelper",
|
|
23
25
|
() => ({
|
|
26
|
+
isOrientationCompatible: mockIsOrientationCompatible,
|
|
24
27
|
allowedOrientationsForScreen: jest.fn(),
|
|
25
28
|
getOrientation: jest.fn(),
|
|
26
29
|
getScreenOrientation: jest.fn(),
|
|
@@ -3,6 +3,10 @@ import React from "react";
|
|
|
3
3
|
import * as R from "ramda";
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
6
|
+
import {
|
|
7
|
+
isOrientationCompatible,
|
|
8
|
+
useGetScreenOrientation,
|
|
9
|
+
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
6
10
|
|
|
7
11
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
8
12
|
import { getComponentModule } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
@@ -69,7 +73,11 @@ export function Screen(_props: Props) {
|
|
|
69
73
|
const { backgroundColor } = useScreenConfiguration(currentScreenData.id);
|
|
70
74
|
const insets = useSafeAreaInsets();
|
|
71
75
|
|
|
72
|
-
const {
|
|
76
|
+
const {
|
|
77
|
+
width: screenWidth,
|
|
78
|
+
height,
|
|
79
|
+
deviceInfo,
|
|
80
|
+
} = useDimensions("screen", {
|
|
73
81
|
fullDimensions: true,
|
|
74
82
|
});
|
|
75
83
|
|
|
@@ -81,6 +89,13 @@ export function Screen(_props: Props) {
|
|
|
81
89
|
|
|
82
90
|
const { title } = useNavbarState();
|
|
83
91
|
|
|
92
|
+
const isTablet = deviceInfo?.isTablet;
|
|
93
|
+
|
|
94
|
+
const { appData } = usePickFromState(["appData"]);
|
|
95
|
+
const isTabletPortrait = appData?.isTabletPortrait;
|
|
96
|
+
|
|
97
|
+
const layoutData = { isTablet, isTabletPortrait, width: screenWidth, height };
|
|
98
|
+
|
|
84
99
|
const hasMenu =
|
|
85
100
|
resolveNavigationPlugin({
|
|
86
101
|
category: "menu",
|
|
@@ -143,6 +158,19 @@ export function Screen(_props: Props) {
|
|
|
143
158
|
|
|
144
159
|
useScreenOrientationHandler({ screenData: targetScreenData });
|
|
145
160
|
|
|
161
|
+
const orientation = useGetScreenOrientation(targetScreenData);
|
|
162
|
+
|
|
163
|
+
// We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
|
|
164
|
+
// This saves unnecessary re-renders and user will not see distorted aspect screen.
|
|
165
|
+
if (
|
|
166
|
+
!isOrientationCompatible({
|
|
167
|
+
orientation,
|
|
168
|
+
layoutData,
|
|
169
|
+
})
|
|
170
|
+
) {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
146
174
|
return (
|
|
147
175
|
<ScreenContextProvider pathname={pathname}>
|
|
148
176
|
<View style={style}>
|
|
@@ -4,10 +4,7 @@ import * as R from "ramda";
|
|
|
4
4
|
|
|
5
5
|
import { AnimationManager } from "./AnimationManager";
|
|
6
6
|
import { Scene } from "./Scene";
|
|
7
|
-
|
|
8
|
-
getScreenOrientation,
|
|
9
|
-
isOrientationCompatible,
|
|
10
|
-
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
7
|
+
|
|
11
8
|
import {
|
|
12
9
|
getSceneByRoute,
|
|
13
10
|
shouldSkipAnimationForPreviousWebViewScene,
|
|
@@ -277,36 +274,25 @@ export class TransitionerComponent extends React.PureComponent<Props, State> {
|
|
|
277
274
|
// so only a single scene should be rendered,
|
|
278
275
|
// instead of dangerous nulls or duplicates.
|
|
279
276
|
renderSingleScene({ scenes, to }) {
|
|
280
|
-
const { contentStyle
|
|
277
|
+
const { contentStyle } = this.props;
|
|
281
278
|
const screenData = this.props.children.props.screenData;
|
|
282
279
|
const pathname = scenes[to.index].key;
|
|
283
280
|
|
|
284
|
-
const orientation = getScreenOrientation({
|
|
285
|
-
screenData,
|
|
286
|
-
layoutData,
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
// We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
|
|
290
|
-
// This saves unnecessary re-renders and user will not see distorted aspect screen.
|
|
291
281
|
return (
|
|
292
282
|
<View style={styles.container}>
|
|
293
|
-
{scenes[to.index] &&
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
>
|
|
307
|
-
{scenes[to.index].children}
|
|
308
|
-
</Scene>
|
|
309
|
-
)}
|
|
283
|
+
{scenes[to.index] && (
|
|
284
|
+
<Scene
|
|
285
|
+
{...{ style: to.style }}
|
|
286
|
+
pathname={pathname}
|
|
287
|
+
isActive={pathname === this.props.navigator.currentRoute}
|
|
288
|
+
contentStyle={contentStyle}
|
|
289
|
+
key={scenes[to.index].key}
|
|
290
|
+
screenUniqueId={scenes[to.index].screenUniqueId}
|
|
291
|
+
screenData={screenData}
|
|
292
|
+
>
|
|
293
|
+
{scenes[to.index].children}
|
|
294
|
+
</Scene>
|
|
295
|
+
)}
|
|
310
296
|
</View>
|
|
311
297
|
);
|
|
312
298
|
}
|
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.
|
|
3
|
+
"version": "12.0.0-rc.76",
|
|
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.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-rc.76",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.76",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.76",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.76",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|