@applicaster/quick-brick-core 14.0.0-alpha.3038031102 → 14.0.0-alpha.3065652724
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/App/ActionSetters/index.ts +0 -1
- package/App/ActionsProvider/__tests__/__snapshots__/ActionsProvider.test.js.snap +2 -2
- package/App/AppStateDecorator/index.tsx +7 -2
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +4 -12
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/usePresentSchemeHandler.test.tsx +27 -30
- package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useUrlSchemeHandler.test.tsx +1 -1
- package/App/ErrorBoundary/index.tsx +4 -0
- package/App/ModalProvider/ModalBottomSheet/DraggableBottomSheet/index.tsx +2 -2
- package/App/ModalProvider/ModalBottomSheet/ModalBottomSheetFrame.tsx +1 -1
- package/App/ModalProvider/ModalChildrenWrapper/index.tsx +2 -7
- package/App/ModalProvider/ModalPresenter.tsx +2 -1
- package/App/NavigationProvider/NavigationProvider.tsx +29 -9
- package/App/NavigationProvider/navigator/__tests__/__snapshots__/reducer.test.ts.snap +0 -177
- package/App/NavigationProvider/navigator/__tests__/reducer.test.ts +2 -70
- package/App/NavigationProvider/navigator/reducer.ts +30 -101
- package/App/NetworkStatusProvider/__tests__/NetworkStatusProvider.test.tsx +11 -15
- package/App/RouterDecorator/__tests__/routerDecorator.test.js +3 -3
- package/App/StoreConnector/__tests__/storeConnector.test.js +6 -9
- package/App/ThemeManager/index.tsx +9 -1
- package/App/__tests__/createQuickBrickApp.test.js +7 -7
- package/App/appLifeCycleManager/__tests__/appLifeCycleManager.test.tsx +9 -0
- package/App/components/ZappAppWrapper.ts +3 -0
- package/App/components/ZappAppWrapper.web.ts +3 -0
- package/App/index.tsx +28 -22
- package/const/index.ts +6 -0
- package/createZappApp/__tests__/createZappApp.test.js +11 -0
- package/index.d.ts +0 -1
- package/package.json +9 -19
- package/renderZappApp/index.js +2 -1
|
@@ -12,18 +12,18 @@ exports[`Actions Provider renders children 1`] = `
|
|
|
12
12
|
"$$typeof": Symbol(react.context),
|
|
13
13
|
"Consumer": {
|
|
14
14
|
"$$typeof": Symbol(react.context),
|
|
15
|
-
"_calculateChangedBits": null,
|
|
16
15
|
"_context": [Circular],
|
|
17
16
|
},
|
|
18
17
|
"Provider": {
|
|
19
18
|
"$$typeof": Symbol(react.provider),
|
|
20
19
|
"_context": [Circular],
|
|
21
20
|
},
|
|
22
|
-
"_calculateChangedBits": null,
|
|
23
21
|
"_currentRenderer": null,
|
|
24
22
|
"_currentRenderer2": {},
|
|
25
23
|
"_currentValue": null,
|
|
26
24
|
"_currentValue2": null,
|
|
25
|
+
"_defaultValue": null,
|
|
26
|
+
"_globalName": null,
|
|
27
27
|
"_threadCount": 0,
|
|
28
28
|
},
|
|
29
29
|
"contextProvider": [Function],
|
|
@@ -19,6 +19,7 @@ function withAppManagerDecorator(
|
|
|
19
19
|
currentState: AppStateStatus;
|
|
20
20
|
isAvailable: boolean;
|
|
21
21
|
plugins: QuickBrickPlugin[];
|
|
22
|
+
appStateListener: ReturnType<typeof AppState.addEventListener>;
|
|
22
23
|
|
|
23
24
|
constructor(props: Props) {
|
|
24
25
|
super(props);
|
|
@@ -30,11 +31,15 @@ function withAppManagerDecorator(
|
|
|
30
31
|
|
|
31
32
|
componentDidMount() {
|
|
32
33
|
this.plugins = this.getAppStatePlugins();
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
this.appStateListener = AppState.addEventListener(
|
|
36
|
+
"change",
|
|
37
|
+
this.onChange
|
|
38
|
+
);
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
componentWillUnmount() {
|
|
37
|
-
|
|
42
|
+
this.appStateListener.remove();
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
dispatchAction(nextState: AppStateStatus, eventType) {
|
package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "../useOpenSchemeHandler/const";
|
|
17
17
|
import { withInitialPlayerState } from "../useOpenSchemeHandler/utils";
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import { log_warning } from "../../../logger";
|
|
20
20
|
|
|
21
21
|
const rivers: Record<string, Partial<ZappRiver>> = {
|
|
22
22
|
A1234: {
|
|
@@ -53,13 +53,10 @@ const navigator = {
|
|
|
53
53
|
replace: jest.fn(),
|
|
54
54
|
push: jest.fn(),
|
|
55
55
|
goHome: jest.fn(),
|
|
56
|
-
};
|
|
56
|
+
} as any;
|
|
57
57
|
|
|
58
58
|
const mockStore = configureStore();
|
|
59
|
-
|
|
60
|
-
jest
|
|
61
|
-
.spyOn(useNavigationHooks, "useNavigation")
|
|
62
|
-
.mockImplementation(() => navigator);
|
|
59
|
+
jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
|
|
63
60
|
|
|
64
61
|
const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
|
|
65
62
|
const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
|
|
@@ -72,7 +69,7 @@ jest.doMock("@applicaster/zapp-react-native-ui-components/Contexts", () => ({
|
|
|
72
69
|
},
|
|
73
70
|
}));
|
|
74
71
|
|
|
75
|
-
jest.
|
|
72
|
+
jest.mock("../../../logger", () => ({
|
|
76
73
|
log_info: jest.fn(),
|
|
77
74
|
log_error: jest.fn(),
|
|
78
75
|
log_warning: jest.fn(),
|
|
@@ -80,10 +77,6 @@ jest.doMock("../../../logger", () => ({
|
|
|
80
77
|
log_debug: jest.fn(),
|
|
81
78
|
}));
|
|
82
79
|
|
|
83
|
-
jest.useFakeTimers({
|
|
84
|
-
legacyFakeTimers: true,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
80
|
// to use import instead of require it's required to use jest.mock above
|
|
88
81
|
const { useOpenSchemeHandler } = require("../useOpenSchemeHandler");
|
|
89
82
|
|
|
@@ -192,7 +185,6 @@ describe("useOpenSchemeHandler", () => {
|
|
|
192
185
|
it("doesn't log a warning", async () => {
|
|
193
186
|
const tests = () => {
|
|
194
187
|
expect(log_warning).not.toHaveBeenCalled();
|
|
195
|
-
expect.assertions(1);
|
|
196
188
|
};
|
|
197
189
|
|
|
198
190
|
await testHook({ url, query, tests });
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import * as R from "ramda";
|
|
3
2
|
import axios from "axios";
|
|
4
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
5
4
|
import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
|
|
6
|
-
|
|
7
5
|
import * as helpers from "../../../helpers";
|
|
8
6
|
import * as feedLoader from "@applicaster/zapp-react-native-utils/reactHooks/feed/useFeedLoader";
|
|
7
|
+
import { WrappedWithProviders } from "@applicaster/zapp-react-native-utils/testUtils";
|
|
8
|
+
import { usePresentSchemeHandler } from "../usePresentSchemeHandler";
|
|
9
9
|
|
|
10
|
-
import { Provider } from "react-redux";
|
|
11
10
|
import configureStore from "redux-mock-store";
|
|
12
11
|
|
|
13
12
|
const rivers = {
|
|
@@ -19,7 +18,8 @@ const rivers = {
|
|
|
19
18
|
const mock_navigator = {
|
|
20
19
|
currentRoute: "/river/A1234",
|
|
21
20
|
replace: jest.fn(),
|
|
22
|
-
|
|
21
|
+
goHome: jest.fn(),
|
|
22
|
+
} as any;
|
|
23
23
|
|
|
24
24
|
jest.mock(
|
|
25
25
|
"@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation",
|
|
@@ -32,16 +32,13 @@ const mockStore = configureStore();
|
|
|
32
32
|
|
|
33
33
|
const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
|
|
34
34
|
const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
|
|
35
|
-
const storageSpy = jest.spyOn(sessionStorage, "getAllItems");
|
|
36
|
-
const axiosGetSpy = jest.spyOn(axios, "get");
|
|
37
|
-
|
|
38
|
-
const { usePresentSchemeHandler } = require("../usePresentSchemeHandler");
|
|
39
35
|
|
|
40
36
|
const onFinish = jest.fn((cb) => {
|
|
41
37
|
cb();
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
const navigator = mock_navigator;
|
|
41
|
+
jest.useFakeTimers();
|
|
45
42
|
|
|
46
43
|
describe("usePresentSchemeHandler", () => {
|
|
47
44
|
beforeEach(() => {
|
|
@@ -50,11 +47,7 @@ describe("usePresentSchemeHandler", () => {
|
|
|
50
47
|
navigator.replace.mockClear();
|
|
51
48
|
});
|
|
52
49
|
|
|
53
|
-
const store =
|
|
54
|
-
|
|
55
|
-
const wrapper: React.FC<any> = ({ children }) => (
|
|
56
|
-
<Provider store={store}>{children}</Provider>
|
|
57
|
-
);
|
|
50
|
+
const store = { test: "test", rivers };
|
|
58
51
|
|
|
59
52
|
describe("loading link url", () => {
|
|
60
53
|
const query = { link_url: "http://applicaster.com" };
|
|
@@ -65,10 +58,11 @@ describe("usePresentSchemeHandler", () => {
|
|
|
65
58
|
|
|
66
59
|
it("opens the link entry", () => {
|
|
67
60
|
renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
|
|
68
|
-
wrapper,
|
|
61
|
+
wrapper: WrappedWithProviders,
|
|
62
|
+
initialProps: { store },
|
|
69
63
|
});
|
|
70
64
|
|
|
71
|
-
expect(onFinish).
|
|
65
|
+
expect(onFinish).toHaveBeenCalled();
|
|
72
66
|
|
|
73
67
|
expect(helperSpy).toBeCalledWith(
|
|
74
68
|
expect.objectContaining({
|
|
@@ -102,7 +96,8 @@ describe("usePresentSchemeHandler", () => {
|
|
|
102
96
|
onFinish,
|
|
103
97
|
}),
|
|
104
98
|
{
|
|
105
|
-
wrapper,
|
|
99
|
+
wrapper: WrappedWithProviders,
|
|
100
|
+
initialProps: { store },
|
|
106
101
|
}
|
|
107
102
|
);
|
|
108
103
|
|
|
@@ -129,7 +124,8 @@ describe("usePresentSchemeHandler", () => {
|
|
|
129
124
|
)}&show_nav_bar=true`;
|
|
130
125
|
|
|
131
126
|
renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
|
|
132
|
-
wrapper,
|
|
127
|
+
wrapper: WrappedWithProviders,
|
|
128
|
+
initialProps: { store },
|
|
133
129
|
});
|
|
134
130
|
|
|
135
131
|
expect(onFinish).toBeCalled();
|
|
@@ -161,22 +157,22 @@ describe("usePresentSchemeHandler", () => {
|
|
|
161
157
|
)}&screen_id=${screen_id}`;
|
|
162
158
|
|
|
163
159
|
renderHook(() => usePresentSchemeHandler({ query, url, onFinish }), {
|
|
164
|
-
wrapper,
|
|
160
|
+
wrapper: WrappedWithProviders,
|
|
161
|
+
initialProps: { store },
|
|
165
162
|
});
|
|
166
163
|
|
|
167
164
|
expect(onFinish).toBeCalled();
|
|
168
165
|
|
|
169
|
-
expect(helperSpy).
|
|
166
|
+
expect(helperSpy).toHaveBeenCalledWith(
|
|
170
167
|
expect.objectContaining({
|
|
171
168
|
data: {
|
|
172
169
|
id: "url_scheme_entry",
|
|
173
170
|
type: { value: "link" },
|
|
174
|
-
screen_type: screen_id,
|
|
175
171
|
link: { href: query.link_url, type: "text/html" },
|
|
176
172
|
extensions: { showNavBar: false },
|
|
177
173
|
},
|
|
178
|
-
navigator,
|
|
179
|
-
pushScreen:
|
|
174
|
+
navigator: expect.anything(),
|
|
175
|
+
pushScreen: "http://applicaster.com",
|
|
180
176
|
})
|
|
181
177
|
);
|
|
182
178
|
});
|
|
@@ -186,14 +182,15 @@ describe("usePresentSchemeHandler", () => {
|
|
|
186
182
|
it("Re-sets app ready state and calls loadAppContextData with new river and cellStyles data", async () => {
|
|
187
183
|
const store = mockStore({ test: "test" });
|
|
188
184
|
|
|
189
|
-
const wrapper
|
|
190
|
-
<Provider store={store}>{children}</Provider>
|
|
191
|
-
);
|
|
185
|
+
const wrapper = WrappedWithProviders;
|
|
192
186
|
|
|
193
187
|
const query = {
|
|
194
188
|
rivers_configuration_id: "test",
|
|
195
189
|
};
|
|
196
190
|
|
|
191
|
+
const storageSpy = jest.spyOn(sessionStorage, "getAllItems");
|
|
192
|
+
const axiosGetSpy = jest.spyOn(axios, "get");
|
|
193
|
+
|
|
197
194
|
const getAllItems = jest.fn().mockResolvedValue({
|
|
198
195
|
accountsAccountId: "accountsAccountId",
|
|
199
196
|
bundleIdentifier: "bundleIdentifier",
|
|
@@ -257,7 +254,7 @@ describe("usePresentSchemeHandler", () => {
|
|
|
257
254
|
},
|
|
258
255
|
}),
|
|
259
256
|
{
|
|
260
|
-
wrapper,
|
|
257
|
+
wrapper: WrappedWithProviders,
|
|
261
258
|
}
|
|
262
259
|
);
|
|
263
260
|
|
|
@@ -289,7 +286,7 @@ describe("usePresentSchemeHandler", () => {
|
|
|
289
286
|
},
|
|
290
287
|
}),
|
|
291
288
|
{
|
|
292
|
-
wrapper,
|
|
289
|
+
wrapper: WrappedWithProviders,
|
|
293
290
|
}
|
|
294
291
|
);
|
|
295
292
|
|
|
@@ -321,7 +318,7 @@ describe("usePresentSchemeHandler", () => {
|
|
|
321
318
|
},
|
|
322
319
|
}),
|
|
323
320
|
{
|
|
324
|
-
wrapper,
|
|
321
|
+
wrapper: WrappedWithProviders,
|
|
325
322
|
}
|
|
326
323
|
);
|
|
327
324
|
|
|
@@ -353,7 +350,7 @@ describe("usePresentSchemeHandler", () => {
|
|
|
353
350
|
},
|
|
354
351
|
}),
|
|
355
352
|
{
|
|
356
|
-
wrapper,
|
|
353
|
+
wrapper: WrappedWithProviders,
|
|
357
354
|
}
|
|
358
355
|
);
|
|
359
356
|
|
package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useUrlSchemeHandler.test.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import * as URLHandlersMap from "..";
|
|
|
5
5
|
import { Provider } from "react-redux";
|
|
6
6
|
import configureStore from "redux-mock-store";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import { log_warning } from "../../../logger";
|
|
9
9
|
|
|
10
10
|
const mockStore = configureStore();
|
|
11
11
|
|
|
@@ -60,6 +60,10 @@ export class ErrorBoundary extends React.Component<Props> {
|
|
|
60
60
|
useErrorStore.getState().setError(error, info, recoverable);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
static getDerivedStateFromError(_error) {
|
|
64
|
+
return { hasError: true };
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
render() {
|
|
64
68
|
return <ErrorBoundaryContent>{this.props.children}</ErrorBoundaryContent>;
|
|
65
69
|
}
|
|
@@ -52,9 +52,9 @@ export class DraggableBottomSheet extends Component<Props, ComponentState> {
|
|
|
52
52
|
_lastScrollYValue: number;
|
|
53
53
|
_lastScrollY: Animated.Value;
|
|
54
54
|
_dragY: Animated.Value;
|
|
55
|
-
_reverseLastScrollY: Animated.
|
|
55
|
+
_reverseLastScrollY: Animated.AnimatedInterpolation<number>;
|
|
56
56
|
_translateYOffset: Animated.Value;
|
|
57
|
-
_translateY: Animated.
|
|
57
|
+
_translateY: Animated.AnimatedInterpolation<number>;
|
|
58
58
|
_snapPoints: SnapPoints;
|
|
59
59
|
_prevContentHeight = 0;
|
|
60
60
|
|
|
@@ -47,7 +47,7 @@ const getSheetHeight = ({ height, bottomOffset, maxHeight }) => {
|
|
|
47
47
|
ios: height - bottomOffset,
|
|
48
48
|
default:
|
|
49
49
|
(height || maxHeight) -
|
|
50
|
-
(
|
|
50
|
+
(isAndroidPlatform() && !isAndroidVersionAtLeast(35) ? bottomOffset : 0),
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import React, { ReactChild } from "react";
|
|
2
|
-
import { StyleSheet, ViewProps } from "react-native";
|
|
3
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
2
|
+
import { View, StyleSheet, ViewProps } from "react-native";
|
|
4
3
|
|
|
5
4
|
type Props = ViewProps & { children: ReactChild };
|
|
6
5
|
|
|
7
6
|
export function ModalChildrenWrapper({ children }: Props) {
|
|
8
|
-
return
|
|
9
|
-
<GestureHandlerRootView style={StyleSheet.absoluteFill}>
|
|
10
|
-
{children}
|
|
11
|
-
</GestureHandlerRootView>
|
|
12
|
-
);
|
|
7
|
+
return <View style={StyleSheet.absoluteFill}>{children}</View>;
|
|
13
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Modal, ModalProps } from "react-native";
|
|
3
|
+
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
3
4
|
|
|
4
5
|
type Props = ModalProps & {
|
|
5
6
|
children: React.ReactChild;
|
|
@@ -13,7 +14,7 @@ export function ModalPresenter(props: Props) {
|
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
16
|
<Presenter visible={visible} {...presenterOptions}>
|
|
16
|
-
{children}
|
|
17
|
+
<GestureHandlerRootView>{children}</GestureHandlerRootView>
|
|
17
18
|
</Presenter>
|
|
18
19
|
);
|
|
19
20
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getTargetRoute,
|
|
8
8
|
usesVideoModal,
|
|
9
9
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
10
|
+
import { last } from "@applicaster/zapp-react-native-utils/utils";
|
|
10
11
|
import {
|
|
11
12
|
allowedOrientationsForScreen,
|
|
12
13
|
useGetScreenOrientation,
|
|
@@ -121,8 +122,20 @@ export function NavigationProvider({ children }: Props) {
|
|
|
121
122
|
NavigationReducerState
|
|
122
123
|
>(reducer, initialState, (x) => x);
|
|
123
124
|
|
|
125
|
+
const topStackRoute = last(state?.stack?.mainStack);
|
|
126
|
+
|
|
127
|
+
/** TODO: temporary variable, before we remove need for a "current".
|
|
128
|
+
There is no current as we are using stack navigator. Route data should be contextualised per screen
|
|
129
|
+
There are some cases to use a route data from top of the stack but it should be separate method.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
const currentLocation = {
|
|
133
|
+
...topStackRoute,
|
|
134
|
+
route: topStackRoute?.route || "/", // Fallback for initial state.
|
|
135
|
+
};
|
|
136
|
+
|
|
124
137
|
const stateRef = React.useRef<NavigationReducerState>(state);
|
|
125
|
-
const pathname =
|
|
138
|
+
const pathname = currentLocation?.route; // TODO: remove. Pathname is part of the route, not a global.
|
|
126
139
|
const pathnameRef = React.useRef(pathname);
|
|
127
140
|
|
|
128
141
|
const { context } = React.useContext(ZappPipesEntryContext.Context);
|
|
@@ -146,6 +159,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
146
159
|
}
|
|
147
160
|
}, [pathname]);
|
|
148
161
|
|
|
162
|
+
// TODO remove.
|
|
163
|
+
// There is no concept of active river. Multiple rivers can be rendered at the same time.
|
|
149
164
|
const activeRiver = React.useMemo(
|
|
150
165
|
() => activeRiverSelector({ pathname, rivers }),
|
|
151
166
|
[pathname, rivers]
|
|
@@ -186,6 +201,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
186
201
|
// TODO: Move in proper place
|
|
187
202
|
const modalPresenterScreenOrientation = useGetScreenOrientation(activeRiver);
|
|
188
203
|
|
|
204
|
+
// TODO: Move modal state to separate store
|
|
189
205
|
const closeVideoModal = () => {
|
|
190
206
|
if (navigator.modalData) {
|
|
191
207
|
allowedOrientationsForScreen(modalPresenterScreenOrientation);
|
|
@@ -213,13 +229,15 @@ export function NavigationProvider({ children }: Props) {
|
|
|
213
229
|
const isVideoModalDocked = () =>
|
|
214
230
|
state?.options.videoModal.mode === "MINIMIZED";
|
|
215
231
|
|
|
232
|
+
// TODO: Remove as it's using a concept of "current" route.
|
|
233
|
+
// Route is contextualised and shouldn't be used this way.
|
|
216
234
|
const routeData = () => {
|
|
217
235
|
// eslint-disable-next-line no-console
|
|
218
236
|
console.warn(`you are retrieving screen data from navigator.routeData()
|
|
219
237
|
This function will be removed in a later version of quick brick.
|
|
220
238
|
You can retrieve this data from navigator.screenData`);
|
|
221
239
|
|
|
222
|
-
return legacyScreenData(
|
|
240
|
+
return legacyScreenData(currentLocation?.state as NavigationScreenData);
|
|
223
241
|
};
|
|
224
242
|
|
|
225
243
|
// TODO: remove it by refactoring back buttons handlers
|
|
@@ -262,7 +280,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
262
280
|
if (
|
|
263
281
|
targetRoute !== pathnameRef.current ||
|
|
264
282
|
item?.id !==
|
|
265
|
-
legacyScreenData(
|
|
283
|
+
legacyScreenData(currentLocation?.state as NavigationScreenData)?.id
|
|
266
284
|
) {
|
|
267
285
|
replaceEvent();
|
|
268
286
|
navigateTo(item, ACTIONS.REPLACE, options);
|
|
@@ -688,7 +706,8 @@ export function NavigationProvider({ children }: Props) {
|
|
|
688
706
|
}
|
|
689
707
|
}, [state?.options?.videoModal?.previousMode]);
|
|
690
708
|
|
|
691
|
-
|
|
709
|
+
// TODO: remove. This shouldn't be part of navigator
|
|
710
|
+
const getNestedEntry = () => currentLocation?.state?.nested?.entry ?? null;
|
|
692
711
|
|
|
693
712
|
// It will only work for the regular stack and pathname, It won't work for modals
|
|
694
713
|
// TODO: integrate video/hook and regular modal into stack.
|
|
@@ -706,7 +725,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
706
725
|
() => ({
|
|
707
726
|
activeRiver,
|
|
708
727
|
getPathname: () => pathnameRef.current, // hack use to fix issue causing broken navigation as currentRoute is unreliable
|
|
709
|
-
currentRoute: pathname,
|
|
728
|
+
currentRoute: pathname, // TODO: remove. Current route shouldn't be needed
|
|
710
729
|
previousAction: lastEntrySelector(state)
|
|
711
730
|
?.action as QuickBrickNavigationActionType,
|
|
712
731
|
push: pushItem,
|
|
@@ -716,14 +735,15 @@ export function NavigationProvider({ children }: Props) {
|
|
|
716
735
|
goHome,
|
|
717
736
|
canGoBack,
|
|
718
737
|
goBack,
|
|
719
|
-
routeData,
|
|
738
|
+
routeData, // TODO: remove
|
|
720
739
|
screenData: legacyScreenData(
|
|
721
|
-
|
|
740
|
+
// TODO: remove
|
|
741
|
+
currentLocation?.state as NavigationScreenData,
|
|
722
742
|
plugins
|
|
723
743
|
),
|
|
724
|
-
data:
|
|
744
|
+
data: currentLocation?.state as NavigationScreenData,
|
|
725
745
|
getNestedEntry,
|
|
726
|
-
key:
|
|
746
|
+
key: currentLocation?.key, // TODO: remove
|
|
727
747
|
modalData: state.stack.modal?.state ?? null,
|
|
728
748
|
openModal,
|
|
729
749
|
dismissModal,
|