@applicaster/zapp-react-native-ui-components 15.0.0-rc.8 → 15.0.0-rc.9
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.
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
setFocusOnMenu,
|
|
11
11
|
} from "@applicaster/zapp-react-native-utils/appUtils/focusManagerAux";
|
|
12
12
|
|
|
13
|
+
import { waitUntilScreenRevealManagerIsReady } from "@applicaster/zapp-react-native-ui-components/Components/ScreenRevealManager/utils";
|
|
14
|
+
|
|
13
15
|
type Return =
|
|
14
16
|
| {
|
|
15
17
|
onContent: true;
|
|
@@ -57,14 +59,22 @@ export const useInitialFocus = (): void => {
|
|
|
57
59
|
React.useEffect(() => {
|
|
58
60
|
const initialFocus = getInitialFocus(focusOnContent, isNavBarVisible);
|
|
59
61
|
|
|
60
|
-
if (initialFocus.
|
|
61
|
-
|
|
62
|
+
if (initialFocus.onMenu) {
|
|
63
|
+
setFocusOnMenu(currentRoute);
|
|
62
64
|
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
if (initialFocus.
|
|
67
|
-
|
|
68
|
+
if (initialFocus.onContent) {
|
|
69
|
+
const subscription = waitUntilScreenRevealManagerIsReady().subscribe(
|
|
70
|
+
() => {
|
|
71
|
+
setFocusOnContent(currentRoute);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return () => {
|
|
76
|
+
subscription.unsubscribe();
|
|
77
|
+
};
|
|
68
78
|
}
|
|
69
79
|
}, []);
|
|
70
80
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReplaySubject } from "rxjs";
|
|
2
|
+
import { pairwise, filter, first } from "rxjs/operators";
|
|
3
|
+
|
|
4
|
+
// we are interested in last 2 events, because we wait transition from <false> to <true>
|
|
5
|
+
const screenRevealManagerSubject$ = new ReplaySubject<boolean>(2);
|
|
6
|
+
|
|
7
|
+
export const emitScreenRevealManagerIsReadyToShow = () => {
|
|
8
|
+
screenRevealManagerSubject$.next(true);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const emitScreenRevealManagerIsNotReadyToShow = () => {
|
|
12
|
+
screenRevealManagerSubject$.next(false);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const waitUntilScreenRevealManagerIsReady = () => {
|
|
16
|
+
return screenRevealManagerSubject$.pipe(
|
|
17
|
+
pairwise(), // emit consecutive pairs: [prev, curr]
|
|
18
|
+
filter(
|
|
19
|
+
([previousIsReady, currentIsReady]) => !previousIsReady && currentIsReady
|
|
20
|
+
), // detect transition from not_ready to ready
|
|
21
|
+
first()
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -5,6 +5,10 @@ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils"
|
|
|
5
5
|
import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
|
|
6
6
|
|
|
7
7
|
import { ScreenRevealManager } from "./ScreenRevealManager";
|
|
8
|
+
import {
|
|
9
|
+
emitScreenRevealManagerIsReadyToShow,
|
|
10
|
+
emitScreenRevealManagerIsNotReadyToShow,
|
|
11
|
+
} from "./utils";
|
|
8
12
|
|
|
9
13
|
const flex = platformSelect({
|
|
10
14
|
tvos: 1,
|
|
@@ -43,6 +47,14 @@ export const withScreenRevealManager = (Component) => {
|
|
|
43
47
|
() => new Animated.Value(HIDDEN)
|
|
44
48
|
);
|
|
45
49
|
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
if (!isReadyToShow) {
|
|
52
|
+
emitScreenRevealManagerIsNotReadyToShow();
|
|
53
|
+
} else {
|
|
54
|
+
emitScreenRevealManagerIsReadyToShow();
|
|
55
|
+
}
|
|
56
|
+
}, [isReadyToShow]);
|
|
57
|
+
|
|
46
58
|
React.useEffect(() => {
|
|
47
59
|
if (isReadyToShow) {
|
|
48
60
|
Animated.timing(opacityRef.current, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.9",
|
|
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": "15.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-rc.9",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.9",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-rc.9",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-rc.9",
|
|
35
35
|
"promise": "^8.3.0",
|
|
36
36
|
"url": "^0.11.0",
|
|
37
37
|
"uuid": "^3.3.2"
|