@applicaster/zapp-react-native-ui-components 14.0.18-alpha.5740764222 → 14.0.18-rc.0
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/GeneralContentScreen/GeneralContentScreen.tsx +3 -8
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +1 -1
- package/Components/River/__tests__/componentsMap.test.js +1 -2
- package/Components/Screen/__tests__/Screen.test.tsx +3 -12
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/Screen/hooks.ts +1 -1
- package/Components/Transitioner/Scene.tsx +7 -60
- package/Components/Transitioner/__tests__/Scene.test.js +0 -17
- package/package.json +5 -5
|
@@ -13,7 +13,7 @@ import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/he
|
|
|
13
13
|
import { ScreenTrackedViewPositionsContext } from "@applicaster/zapp-react-native-ui-components/Contexts/ScreenTrackedViewPositionsContext";
|
|
14
14
|
import { useEventAlerts } from "./utils/useEventAlerts";
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const { log_debug } = createLogger({
|
|
17
17
|
category: "ScreenContainer",
|
|
18
18
|
subsystem: "General",
|
|
19
19
|
});
|
|
@@ -54,20 +54,15 @@ export const GeneralContentScreen = ({
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (!riverActionProvidersReady) {
|
|
56
56
|
if (actionsInitialStateSetters.length > 0) {
|
|
57
|
-
log_info(
|
|
58
|
-
"ScreenContainer: starting to check river action providers to initialize",
|
|
59
|
-
{ actionsInitialStateSetters }
|
|
60
|
-
);
|
|
61
|
-
|
|
62
57
|
allSettled(actionsInitialStateSetters).finally(() => {
|
|
63
|
-
|
|
58
|
+
log_debug(
|
|
64
59
|
"ScreenContainer: action provider ready, completed. Starting to present screen"
|
|
65
60
|
);
|
|
66
61
|
|
|
67
62
|
setRiverActionProvidersReady(true);
|
|
68
63
|
});
|
|
69
64
|
} else {
|
|
70
|
-
|
|
65
|
+
log_debug(
|
|
71
66
|
"ScreenContainer: no action provider to check, completed. Starting to present screen"
|
|
72
67
|
);
|
|
73
68
|
|
|
@@ -13,7 +13,6 @@ jest.mock(
|
|
|
13
13
|
|
|
14
14
|
jest.mock("react-native-safe-area-context", () => ({
|
|
15
15
|
useSafeAreaInsets: () => ({ top: 50 }),
|
|
16
|
-
useSafeAreaFrame: () => ({ x: 0, y: 0, width: 375, height: 812 }),
|
|
17
16
|
}));
|
|
18
17
|
|
|
19
18
|
jest.mock("react-native", () => {
|
|
@@ -178,7 +177,7 @@ describe("componentsMap", () => {
|
|
|
178
177
|
cleanup();
|
|
179
178
|
});
|
|
180
179
|
|
|
181
|
-
it("renders components map correctly", () => {
|
|
180
|
+
it("renders renders components map correctly", () => {
|
|
182
181
|
themeSpy = jest
|
|
183
182
|
.spyOn(themeUtils, "useTheme")
|
|
184
183
|
.mockImplementation(() => () => theme);
|
|
@@ -99,14 +99,9 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
|
99
99
|
useCurrentScreenData: jest.fn(() => ({
|
|
100
100
|
id: "testId",
|
|
101
101
|
})),
|
|
102
|
-
useIsScreenActive: jest.fn(() => true),
|
|
103
102
|
useNavbarState: jest.fn(() => ({
|
|
104
103
|
title: "Test Title",
|
|
105
104
|
})),
|
|
106
|
-
useRoute: jest.fn(() => ({
|
|
107
|
-
pathname: "/river/testId",
|
|
108
|
-
screenData: { id: "testId" },
|
|
109
|
-
})),
|
|
110
105
|
useScreenData: jest.fn(() => ({
|
|
111
106
|
id: "testId",
|
|
112
107
|
navigations: [{ id: "testId", category: "nav_bar" }],
|
|
@@ -130,11 +125,7 @@ jest.mock("@applicaster/zapp-react-native-redux/hooks", () => {
|
|
|
130
125
|
identifier: "offline-experience",
|
|
131
126
|
type: "general",
|
|
132
127
|
module: {
|
|
133
|
-
OfflineFallbackScreen: ({
|
|
134
|
-
children,
|
|
135
|
-
}: {
|
|
136
|
-
children: React.ReactNode;
|
|
137
|
-
}) => <View>{children}</View>, // eslint-disable-line
|
|
128
|
+
OfflineFallbackScreen: ({ children }) => <View>{children}</View>, // eslint-disable-line
|
|
138
129
|
},
|
|
139
130
|
},
|
|
140
131
|
],
|
|
@@ -169,14 +160,14 @@ describe("<Screen Component />", () => {
|
|
|
169
160
|
});
|
|
170
161
|
|
|
171
162
|
describe("when the navbar should show", () => {
|
|
172
|
-
it("renders correctly
|
|
163
|
+
it("renders correctly", () => {
|
|
173
164
|
const { toJSON } = render(<Screen {...screenProps} />);
|
|
174
165
|
expect(toJSON()).toMatchSnapshot();
|
|
175
166
|
});
|
|
176
167
|
});
|
|
177
168
|
|
|
178
169
|
describe("when the navbar should be hidden", () => {
|
|
179
|
-
it("renders correctly
|
|
170
|
+
it("renders correctly", () => {
|
|
180
171
|
const { toJSON } = render(<Screen {...screenProps} />);
|
|
181
172
|
expect(toJSON()).toMatchSnapshot();
|
|
182
173
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`<Screen Component /> when the navbar should be hidden renders correctly
|
|
3
|
+
exports[`<Screen Component /> when the navbar should be hidden renders correctly 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
importantForAccessibility="yes"
|
|
6
6
|
style={
|
|
@@ -33,7 +33,7 @@ exports[`<Screen Component /> when the navbar should be hidden renders correctly
|
|
|
33
33
|
</View>
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
|
-
exports[`<Screen Component /> when the navbar should show renders correctly
|
|
36
|
+
exports[`<Screen Component /> when the navbar should show renders correctly 1`] = `
|
|
37
37
|
<View
|
|
38
38
|
importantForAccessibility="yes"
|
|
39
39
|
style={
|
|
@@ -117,7 +117,7 @@ export const useWaitForValidOrientation = () => {
|
|
|
117
117
|
if (isReadyForDisplay && !readyState) {
|
|
118
118
|
setReadyState(true);
|
|
119
119
|
}
|
|
120
|
-
}, [readyState, orientation, layoutData
|
|
120
|
+
}, [readyState, orientation, layoutData]);
|
|
121
121
|
|
|
122
122
|
return readyState;
|
|
123
123
|
};
|
|
@@ -4,13 +4,6 @@ import { Animated, ViewProps, ViewStyle } from "react-native";
|
|
|
4
4
|
|
|
5
5
|
import { useScreenOrientationHandler } from "@applicaster/zapp-react-native-ui-components/Components/Screen/orientationHandler";
|
|
6
6
|
import { useMemoizedSafeAreaFrameWithActiveState } from "@applicaster/zapp-react-native-ui-components/Components/Screen/hooks";
|
|
7
|
-
import {
|
|
8
|
-
getScreenOrientation,
|
|
9
|
-
isOrientationCompatible,
|
|
10
|
-
} from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";
|
|
11
|
-
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
|
-
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
13
|
-
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
14
7
|
|
|
15
8
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
16
9
|
import { ScreenDataContext } from "../../Contexts/ScreenDataContext";
|
|
@@ -21,55 +14,6 @@ const fullWidthDimensions = {
|
|
|
21
14
|
width: "100%",
|
|
22
15
|
};
|
|
23
16
|
|
|
24
|
-
function useSceneDimensions({
|
|
25
|
-
screenData,
|
|
26
|
-
isActive,
|
|
27
|
-
animating,
|
|
28
|
-
overlayStyle,
|
|
29
|
-
}: {
|
|
30
|
-
screenData: NavigationScreenData;
|
|
31
|
-
isActive: boolean;
|
|
32
|
-
animating: boolean;
|
|
33
|
-
overlayStyle: ViewStyle;
|
|
34
|
-
}) {
|
|
35
|
-
const rawFrame = useSafeAreaFrame();
|
|
36
|
-
const isTablet = useIsTablet();
|
|
37
|
-
const { appData } = usePickFromState(["appData"]);
|
|
38
|
-
const isTabletPortrait = appData?.isTabletPortrait;
|
|
39
|
-
|
|
40
|
-
const orientation = getScreenOrientation({
|
|
41
|
-
screenData,
|
|
42
|
-
layoutData: { isTablet, isTabletPortrait },
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const isFrameOrientationValid = isOrientationCompatible({
|
|
46
|
-
orientation,
|
|
47
|
-
layoutData: {
|
|
48
|
-
isTablet,
|
|
49
|
-
isTabletPortrait,
|
|
50
|
-
width: rawFrame.width,
|
|
51
|
-
height: rawFrame.height,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const memoFrame = useMemoizedSafeAreaFrameWithActiveState({
|
|
56
|
-
updateForInactiveScreens: false,
|
|
57
|
-
isActive: isActive && isFrameOrientationValid,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const isAnimating = animating && overlayStyle;
|
|
61
|
-
|
|
62
|
-
// When orientation is in transition (frame doesn't match target orientation),
|
|
63
|
-
// use fullWidthDimensions so the scene fills its container rather than
|
|
64
|
-
// rendering with stale dimensions (e.g. portrait dims on a landscape player)
|
|
65
|
-
const isOrientationTransitioning = isActive && !isFrameOrientationValid;
|
|
66
|
-
|
|
67
|
-
const dimensions =
|
|
68
|
-
isAnimating || isOrientationTransitioning ? fullWidthDimensions : memoFrame;
|
|
69
|
-
|
|
70
|
-
return dimensions;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
17
|
type Props = {
|
|
74
18
|
children: any;
|
|
75
19
|
style: any;
|
|
@@ -150,15 +94,18 @@ function SceneComponent({
|
|
|
150
94
|
isActive,
|
|
151
95
|
});
|
|
152
96
|
|
|
153
|
-
|
|
154
|
-
|
|
97
|
+
// Use shared memoized frame hook - synchronized with useWaitForValidOrientation
|
|
98
|
+
// to prevent race conditions during orientation changes
|
|
99
|
+
// Pass isActive from props since Scene knows its active state from Transitioner
|
|
100
|
+
const memoFrame = useMemoizedSafeAreaFrameWithActiveState({
|
|
101
|
+
updateForInactiveScreens: false,
|
|
155
102
|
isActive,
|
|
156
|
-
animating,
|
|
157
|
-
overlayStyle,
|
|
158
103
|
});
|
|
159
104
|
|
|
160
105
|
const isAnimating = animating && overlayStyle;
|
|
161
106
|
|
|
107
|
+
const dimensions = isAnimating ? fullWidthDimensions : memoFrame;
|
|
108
|
+
|
|
162
109
|
return (
|
|
163
110
|
<Animated.View
|
|
164
111
|
pointerEvents={pointerEvents}
|
|
@@ -24,23 +24,6 @@ jest.mock(
|
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
jest.mock(
|
|
28
|
-
"@applicaster/zapp-react-native-utils/appUtils/orientationHelper",
|
|
29
|
-
() => ({
|
|
30
|
-
getScreenOrientation: jest.fn(() => 1),
|
|
31
|
-
isOrientationCompatible: jest.fn(() => true),
|
|
32
|
-
})
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
jest.mock("@applicaster/zapp-react-native-utils/reactHooks", () => ({
|
|
36
|
-
useIsTablet: jest.fn(() => false),
|
|
37
|
-
useRoute: jest.fn(() => ({ screenData: {} })),
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
jest.mock("@applicaster/zapp-react-native-redux/hooks", () => ({
|
|
41
|
-
usePickFromState: jest.fn(() => ({ appData: {} })),
|
|
42
|
-
}));
|
|
43
|
-
|
|
44
27
|
jest.mock("../../../Contexts/PathnameContext", () => ({
|
|
45
28
|
PathnameContext: jest.requireActual("react").createContext({ pathname: "" }),
|
|
46
29
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "14.0.18-
|
|
3
|
+
"version": "14.0.18-rc.0",
|
|
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",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "14.0.18-
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "14.0.18-
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "14.0.18-
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "14.0.18-
|
|
31
|
+
"@applicaster/applicaster-types": "14.0.18-rc.0",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "14.0.18-rc.0",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "14.0.18-rc.0",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "14.0.18-rc.0",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|