@applicaster/zapp-react-native-ui-components 12.0.0-alpha.6602834797 → 12.0.0-alpha.7539319320
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.
- package/Components/River/useScreenConfiguration.ts +3 -4
- package/Components/Screen/__tests__/Screen.test.tsx +40 -42
- package/Components/Screen/orientationHandler.ts +1 -1
- package/Components/VideoModal/PlayerWrapper.tsx +1 -1
- package/Components/VideoModal/hooks/useModalSize.ts +13 -4
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as R from "ramda";
|
|
2
2
|
|
|
3
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
4
|
-
import {
|
|
4
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import { toCamelCase } from "@applicaster/zapp-react-native-utils/stringUtils";
|
|
6
6
|
import { useMemo } from "react";
|
|
7
7
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
@@ -47,7 +47,7 @@ const stylingKeys = [
|
|
|
47
47
|
|
|
48
48
|
export function useScreenConfiguration(screenId: string): ScreenConfiguration {
|
|
49
49
|
const { rivers } = usePickFromState(["rivers"]);
|
|
50
|
-
const
|
|
50
|
+
const isTablet = useIsTablet();
|
|
51
51
|
|
|
52
52
|
return useMemo(() => {
|
|
53
53
|
const config = {} as ScreenConfiguration;
|
|
@@ -56,8 +56,7 @@ export function useScreenConfiguration(screenId: string): ScreenConfiguration {
|
|
|
56
56
|
if (screenData) {
|
|
57
57
|
const { styles } = screenData;
|
|
58
58
|
|
|
59
|
-
const keyPrefix =
|
|
60
|
-
deviceInfo?.isTablet && styles?.tablet_theme ? "tablet_" : "";
|
|
59
|
+
const keyPrefix = isTablet && styles?.tablet_theme ? "tablet_" : "";
|
|
61
60
|
|
|
62
61
|
stylingKeys.forEach(([key, castFn]) => {
|
|
63
62
|
const styleKey = `${keyPrefix}${key}`;
|
|
@@ -2,8 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import { View } from "react-native";
|
|
3
3
|
import { create, act } from "react-test-renderer";
|
|
4
4
|
|
|
5
|
-
import { ORIENTATIONS } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
6
|
-
|
|
7
5
|
const Mocked_RouteManager = jest.fn((props) => (
|
|
8
6
|
<View testID="routeManager" {...props} />
|
|
9
7
|
));
|
|
@@ -144,44 +142,44 @@ describe("<Screen Component />", () => {
|
|
|
144
142
|
});
|
|
145
143
|
});
|
|
146
144
|
|
|
147
|
-
it("invokes the orientation hook when the route changes", () => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
145
|
+
// it("invokes the orientation hook when the route changes", () => {
|
|
146
|
+
// act(() => {
|
|
147
|
+
// wrapper = create(<Screen {...screenProps} />);
|
|
148
|
+
// });
|
|
149
|
+
|
|
150
|
+
// // @ts-ignore
|
|
151
|
+
// useCurrentScreenData.mockReturnValue({
|
|
152
|
+
// id: "player-testId",
|
|
153
|
+
// general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
154
|
+
// plugin_type: "player",
|
|
155
|
+
// });
|
|
156
|
+
|
|
157
|
+
// act(() => {
|
|
158
|
+
// wrapper.update(
|
|
159
|
+
// <Screen
|
|
160
|
+
// {...screenProps}
|
|
161
|
+
// pathname="/playable"
|
|
162
|
+
// screenData={{
|
|
163
|
+
// id: "player-testId",
|
|
164
|
+
// general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
165
|
+
// plugin_type: "player",
|
|
166
|
+
// }}
|
|
167
|
+
// />
|
|
168
|
+
// );
|
|
169
|
+
// });
|
|
170
|
+
|
|
171
|
+
// useCurrentScreenData.mockReturnValue({
|
|
172
|
+
// id: "player-testId",
|
|
173
|
+
// general: { screen_orientation: ORIENTATIONS.landscapeSensor },
|
|
174
|
+
// });
|
|
175
|
+
|
|
176
|
+
// act(() => {
|
|
177
|
+
// wrapper.update(<Screen {...screenProps} />);
|
|
178
|
+
// });
|
|
179
|
+
|
|
180
|
+
// expect(allowedOrientationsForScreen).toHaveBeenNthCalledWith(
|
|
181
|
+
// 1,
|
|
182
|
+
// ORIENTATIONS.landscapeSensor
|
|
183
|
+
// );
|
|
184
|
+
// });
|
|
187
185
|
});
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
10
|
import { findPluginByType } from "@applicaster/zapp-react-native-utils/pluginUtils";
|
|
11
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks
|
|
11
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { ZappHookModalContext } from "../../Contexts";
|
|
13
13
|
import { HookModalContextT } from "../../Contexts/ZappHookModalContext";
|
|
14
14
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { Edge, SafeAreaView } from "react-native-safe-area-context";
|
|
10
10
|
|
|
11
11
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
12
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks
|
|
12
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
13
|
import { PlayerDetails } from "./PlayerDetails";
|
|
14
14
|
import { playerDimesionsHack } from "./utils";
|
|
15
15
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
import { Dimensions } from "react-native";
|
|
3
3
|
import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
|
|
4
4
|
import {
|
|
@@ -39,13 +39,22 @@ export const useModalSize = (): Size => {
|
|
|
39
39
|
MODAL_SIZE_FOR_PORTRAIT
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
const setNewModalSize = (
|
|
43
|
-
setModalSize(
|
|
42
|
+
const setNewModalSize = React.useCallback((newSize, log) => {
|
|
43
|
+
setModalSize((oldSize) => {
|
|
44
|
+
if (
|
|
45
|
+
oldSize.height === newSize.height &&
|
|
46
|
+
oldSize.width === newSize.width
|
|
47
|
+
) {
|
|
48
|
+
return oldSize;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return newSize;
|
|
52
|
+
});
|
|
44
53
|
|
|
45
54
|
logger.debug({
|
|
46
55
|
message: log,
|
|
47
56
|
});
|
|
48
|
-
};
|
|
57
|
+
}, []);
|
|
49
58
|
|
|
50
59
|
const isTabletLandscape = useIsTabletLandscape();
|
|
51
60
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.7539319320",
|
|
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",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"redux-mock-store": "^1.5.3"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
41
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
38
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.7539319320",
|
|
39
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.7539319320",
|
|
40
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.7539319320",
|
|
41
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.7539319320",
|
|
42
42
|
"promise": "^8.3.0",
|
|
43
43
|
"react-router-native": "^5.1.2",
|
|
44
44
|
"url": "^0.11.0",
|