@applicaster/quick-brick-core 13.0.0-rc.91 → 13.0.0-rc.93
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/ModalProvider/ModalBottomSheet/Overlay.tsx +5 -7
- package/App/NavigationProvider/NavigationProvider.tsx +9 -36
- package/App/NavigationProvider/__tests__/navigationProvider.test.tsx +0 -44
- package/package.json +8 -8
- package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +0 -68
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleSheet, TouchableOpacity, Easing, View } from "react-native";
|
|
3
3
|
|
|
4
4
|
import { AnimatedInOut } from "@applicaster/zapp-react-native-ui-components/Components/AnimatedInOut";
|
|
5
|
-
import {
|
|
5
|
+
import { dismissModal } from "@applicaster/zapp-react-native-utils/modalState";
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
8
|
overlayColor: string;
|
|
@@ -35,21 +35,19 @@ const fadeInAnimation = {
|
|
|
35
35
|
delay,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
const animationConfig =
|
|
38
|
+
const animationConfig = {
|
|
39
39
|
in: fadeInAnimation,
|
|
40
40
|
out: {
|
|
41
41
|
...fadeInAnimation,
|
|
42
|
-
onAnimationEnd,
|
|
42
|
+
onAnimationEnd: dismissModal,
|
|
43
43
|
},
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
45
|
|
|
46
46
|
export function Overlay(props: Props) {
|
|
47
|
-
const navigator = useNavigation();
|
|
48
|
-
|
|
49
47
|
return (
|
|
50
48
|
<AnimatedInOut
|
|
51
49
|
visible={props.visible}
|
|
52
|
-
animationConfig={animationConfig
|
|
50
|
+
animationConfig={animationConfig}
|
|
53
51
|
staticStyles={styles.container}
|
|
54
52
|
>
|
|
55
53
|
<TouchableOpacity
|
|
@@ -67,7 +67,11 @@ import { findParent } from "@applicaster/zapp-react-native-ui-components/Context
|
|
|
67
67
|
import { ZappPipesEntryContext } from "@applicaster/zapp-react-native-ui-components/Contexts";
|
|
68
68
|
import { PlayNextState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/OverlaysObserver";
|
|
69
69
|
import { inflateUrl } from "@applicaster/zapp-react-native-ui-components/Components/LinkHandler/LinkHandler";
|
|
70
|
-
import {
|
|
70
|
+
import {
|
|
71
|
+
dismissModal,
|
|
72
|
+
openModal,
|
|
73
|
+
useModalStore,
|
|
74
|
+
} from "@applicaster/zapp-react-native-utils/modalState";
|
|
71
75
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
72
76
|
import { QBUIComponentEvents } from "@applicaster/zapp-react-native-ui-components/events";
|
|
73
77
|
import { Hook } from "@applicaster/zapp-react-native-utils/appUtils/HooksManager/Hook";
|
|
@@ -123,8 +127,6 @@ export function NavigationProvider({ children }: Props) {
|
|
|
123
127
|
|
|
124
128
|
const { context } = React.useContext(ZappPipesEntryContext.Context);
|
|
125
129
|
|
|
126
|
-
const { openModal, dismissModal } = useModalStore();
|
|
127
|
-
|
|
128
130
|
const playNextOverlayState = React.useRef();
|
|
129
131
|
|
|
130
132
|
const online = useConnectionInfo(true);
|
|
@@ -394,7 +396,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
394
396
|
}
|
|
395
397
|
|
|
396
398
|
if (hookPlugin.isModalHook()) {
|
|
397
|
-
|
|
399
|
+
openModal({
|
|
398
400
|
item: payload,
|
|
399
401
|
props: { screenType: "hooks" },
|
|
400
402
|
options: { ModalContainer: hookPlugin.getModalContainer() },
|
|
@@ -414,7 +416,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
414
416
|
}
|
|
415
417
|
|
|
416
418
|
if (hookPlugin.isModalHook()) {
|
|
417
|
-
|
|
419
|
+
dismissModal();
|
|
418
420
|
} else {
|
|
419
421
|
goBack(true, true);
|
|
420
422
|
}
|
|
@@ -436,7 +438,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
436
438
|
|
|
437
439
|
if (!abort) {
|
|
438
440
|
if (hookPlugin.isModalHook()) {
|
|
439
|
-
|
|
441
|
+
dismissModal();
|
|
440
442
|
} else {
|
|
441
443
|
goBack(true, true);
|
|
442
444
|
}
|
|
@@ -449,7 +451,7 @@ export function NavigationProvider({ children }: Props) {
|
|
|
449
451
|
callback?.();
|
|
450
452
|
|
|
451
453
|
if (hookPlugin.isModalHook()) {
|
|
452
|
-
|
|
454
|
+
dismissModal();
|
|
453
455
|
}
|
|
454
456
|
};
|
|
455
457
|
|
|
@@ -686,33 +688,6 @@ export function NavigationProvider({ children }: Props) {
|
|
|
686
688
|
}
|
|
687
689
|
}, [state?.options?.videoModal?.previousMode]);
|
|
688
690
|
|
|
689
|
-
const openModalBottomSheet = React.useCallback(
|
|
690
|
-
({
|
|
691
|
-
ModalBottomSheetContent,
|
|
692
|
-
modalBottomSheetContentProps,
|
|
693
|
-
props = {},
|
|
694
|
-
options = {},
|
|
695
|
-
}) => {
|
|
696
|
-
openModal({
|
|
697
|
-
item: {
|
|
698
|
-
ModalBottomSheetContent,
|
|
699
|
-
modalBottomSheetContentProps,
|
|
700
|
-
},
|
|
701
|
-
props,
|
|
702
|
-
options: {
|
|
703
|
-
animationType: "none",
|
|
704
|
-
animated: false,
|
|
705
|
-
...options,
|
|
706
|
-
},
|
|
707
|
-
});
|
|
708
|
-
},
|
|
709
|
-
[openModal]
|
|
710
|
-
);
|
|
711
|
-
|
|
712
|
-
const closeModalBottomSheet = React.useCallback(() => {
|
|
713
|
-
dismissModal();
|
|
714
|
-
}, [dismissModal]);
|
|
715
|
-
|
|
716
691
|
const getNestedEntry = () => state?.location?.state?.nested?.entry ?? null;
|
|
717
692
|
|
|
718
693
|
// It will only work for the regular stack and pathname, It won't work for modals
|
|
@@ -753,8 +728,6 @@ export function NavigationProvider({ children }: Props) {
|
|
|
753
728
|
openModal,
|
|
754
729
|
dismissModal,
|
|
755
730
|
getModalState,
|
|
756
|
-
openModalBottomSheet,
|
|
757
|
-
closeModalBottomSheet,
|
|
758
731
|
videoModalState: state.options.videoModal,
|
|
759
732
|
openVideoModal,
|
|
760
733
|
closeVideoModal,
|
|
@@ -461,48 +461,4 @@ describe("<NavigationProvider />", () => {
|
|
|
461
461
|
});
|
|
462
462
|
});
|
|
463
463
|
});
|
|
464
|
-
|
|
465
|
-
describe("modal feature", () => {
|
|
466
|
-
it("sets the modalState when opening a modal", () => {
|
|
467
|
-
act(() => {
|
|
468
|
-
wrapper = renderContextConsumer();
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
const view = getByTestId(wrapper, "WrapperView");
|
|
472
|
-
act(() => view.props.navigator.openModal({ item: rivers.A1234 }));
|
|
473
|
-
expect(view.props.navigator.get).toMatchSnapshot();
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
it("removes the visible flag when dismissing a modal", () => {
|
|
477
|
-
act(() => {
|
|
478
|
-
wrapper = renderContextConsumer();
|
|
479
|
-
});
|
|
480
|
-
|
|
481
|
-
const view = getByTestId(wrapper, "WrapperView");
|
|
482
|
-
act(() => view.props.navigator.openModal({ item: rivers.A1234 }));
|
|
483
|
-
expect(view.props.navigator.getModalState()).toMatchSnapshot();
|
|
484
|
-
act(() => view.props.navigator.dismissModal());
|
|
485
|
-
expect(view.props.navigator.getModalState().visible).toBeFalsy();
|
|
486
|
-
expect(view.props.navigator.getModalState()).toMatchSnapshot();
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
it("should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet", () => {
|
|
490
|
-
act(() => {
|
|
491
|
-
wrapper = renderContextConsumer();
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
const view = getByTestId(wrapper, "WrapperView");
|
|
495
|
-
|
|
496
|
-
act(() =>
|
|
497
|
-
view.props.navigator.openModalBottomSheet({
|
|
498
|
-
ModalBottomSheetContent: rivers.A1234,
|
|
499
|
-
modalBottomSheetContentProps: { some: "props" },
|
|
500
|
-
})
|
|
501
|
-
);
|
|
502
|
-
|
|
503
|
-
expect(view.props.navigator.getModalState()).toMatchSnapshot();
|
|
504
|
-
act(() => view.props.navigator.closeModalBottomSheet());
|
|
505
|
-
expect(view.props.navigator.getModalState()).toMatchSnapshot();
|
|
506
|
-
});
|
|
507
|
-
});
|
|
508
464
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "13.0.0-rc.
|
|
3
|
+
"version": "13.0.0-rc.93",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "13.0.0-rc.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "13.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "13.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-rc.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "13.0.0-rc.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "13.0.0-rc.93",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "13.0.0-rc.93",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "13.0.0-rc.93",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-rc.93",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-rc.93",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-rc.93",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-rc.93",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 1`] = `
|
|
4
|
-
{
|
|
5
|
-
"options": {
|
|
6
|
-
"animated": true,
|
|
7
|
-
"animationType": "slide",
|
|
8
|
-
"onDismiss": [Function],
|
|
9
|
-
"onRequestClose": [Function],
|
|
10
|
-
"onShow": [Function],
|
|
11
|
-
"presentationStyle": "overFullScreen",
|
|
12
|
-
"transparent": true,
|
|
13
|
-
},
|
|
14
|
-
"props": undefined,
|
|
15
|
-
"screen": {
|
|
16
|
-
"id": "A1234",
|
|
17
|
-
"navigations": [],
|
|
18
|
-
"ui_components": [],
|
|
19
|
-
},
|
|
20
|
-
"visible": true,
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
exports[`<NavigationProvider /> modal feature removes the visible flag when dismissing a modal 2`] = `
|
|
25
|
-
{
|
|
26
|
-
"options": {},
|
|
27
|
-
"props": {},
|
|
28
|
-
"screen": null,
|
|
29
|
-
"visible": false,
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`<NavigationProvider /> modal feature sets the modalState when opening a modal 1`] = `undefined`;
|
|
34
|
-
|
|
35
|
-
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 1`] = `
|
|
36
|
-
{
|
|
37
|
-
"options": {
|
|
38
|
-
"animated": false,
|
|
39
|
-
"animationType": "none",
|
|
40
|
-
"onDismiss": [Function],
|
|
41
|
-
"onRequestClose": [Function],
|
|
42
|
-
"onShow": [Function],
|
|
43
|
-
"presentationStyle": "overFullScreen",
|
|
44
|
-
"transparent": true,
|
|
45
|
-
},
|
|
46
|
-
"props": {},
|
|
47
|
-
"screen": {
|
|
48
|
-
"ModalBottomSheetContent": {
|
|
49
|
-
"id": "A1234",
|
|
50
|
-
"navigations": [],
|
|
51
|
-
"ui_components": [],
|
|
52
|
-
},
|
|
53
|
-
"modalBottomSheetContentProps": {
|
|
54
|
-
"some": "props",
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
"visible": true,
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
exports[`<NavigationProvider /> modal feature should reset state to initial when dismissing a modal ( closeModalBottomSheet ) opened by openModalBottomSheet 2`] = `
|
|
62
|
-
{
|
|
63
|
-
"options": {},
|
|
64
|
-
"props": {},
|
|
65
|
-
"screen": null,
|
|
66
|
-
"visible": false,
|
|
67
|
-
}
|
|
68
|
-
`;
|