@applicaster/zapp-react-native-ui-components 14.0.0-alpha.5974411329 → 14.0.0-alpha.6000342231
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/AnimatedInOut/index.tsx +69 -26
- package/Components/BaseFocusable/index.tsx +23 -12
- package/Components/Cell/Cell.tsx +91 -64
- package/Components/Cell/CellWithFocusable.tsx +3 -0
- package/Components/Cell/FocusableWrapper.tsx +44 -0
- package/Components/Cell/TvOSCellComponent.tsx +80 -14
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
- package/Components/FeedLoader/FeedLoader.tsx +7 -16
- package/Components/FeedLoader/FeedLoaderHOC.tsx +21 -0
- package/Components/FeedLoader/index.js +2 -8
- package/Components/Focusable/Focusable.tsx +10 -3
- package/Components/Focusable/FocusableTvOS.tsx +2 -2
- package/Components/Focusable/Touchable.tsx +5 -3
- package/Components/Focusable/index.android.tsx +8 -4
- package/Components/FocusableGroup/FocusableTvOS.tsx +1 -1
- package/Components/FocusableList/FocusableItem.tsx +4 -3
- package/Components/FocusableList/FocusableListItemWrapper.tsx +2 -1
- package/Components/FocusableList/hooks/useCellState.android.ts +13 -3
- package/Components/FocusableList/index.tsx +16 -9
- package/Components/FreezeWithCallback/__tests__/index.test.tsx +67 -43
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +14 -17
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -65
- package/Components/HandlePlayable/const.ts +3 -0
- package/Components/HandlePlayable/utils.ts +74 -0
- package/Components/Layout/TV/__tests__/index.test.tsx +0 -1
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +6 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +0 -12
- package/Components/MasterCell/DefaultComponents/SecondaryImage/Image.tsx +65 -17
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/Image.test.tsx +21 -3
- package/Components/MasterCell/DefaultComponents/SecondaryImage/__tests__/__snapshots__/Image.test.tsx.snap +6 -3
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +26 -6
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +10 -10
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +18 -18
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/__tests__/index.test.tsx +10 -10
- package/Components/MasterCell/utils/behaviorProvider.ts +2 -2
- package/Components/MasterCell/utils/index.ts +1 -19
- package/Components/OfflineHandler/__tests__/index.test.tsx +6 -13
- package/Components/PlayerContainer/PlayerContainer.tsx +5 -17
- package/Components/PlayerImageBackground/index.tsx +3 -22
- package/Components/River/ComponentsMap/ComponentsMap.tsx +49 -42
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapHeightContext.ts +8 -0
- package/Components/River/ComponentsMap/ContextProviders/ComponentsMapRefContext.ts +8 -0
- package/Components/River/ComponentsMap/hooks/__tests__/useLoadingState.test.ts +0 -1
- package/Components/River/RefreshControl.tsx +11 -19
- package/Components/River/__tests__/river.test.js +12 -26
- package/Components/Screen/TV/hooks/useInitialFocus.ts +14 -4
- package/Components/Screen/__tests__/Screen.test.tsx +5 -17
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -0
- package/Components/Screen/__tests__/navigationHandler.test.ts +133 -22
- package/Components/Screen/index.tsx +22 -5
- package/Components/Screen/navigationHandler.ts +20 -2
- package/Components/ScreenRevealManager/__tests__/ScreenRevealManager.test.ts +2 -2
- package/Components/ScreenRevealManager/utils/index.ts +23 -0
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +54 -24
- package/Components/Tabs/TV/Tabs.android.tsx +1 -1
- package/Components/Tabs/Tabs.tsx +2 -3
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +13 -0
- package/Components/TextInputTv/index.tsx +11 -0
- package/Components/Touchable/__tests__/touchable.test.tsx +12 -17
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +117 -157
- package/Components/VideoModal/ModalAnimation/index.ts +2 -13
- package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
- package/Components/VideoModal/PlayerDetails.tsx +5 -5
- package/Components/VideoModal/PlayerWrapper.tsx +14 -88
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +5 -5
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +9 -1
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +40 -15
- package/Components/VideoModal/hooks/useModalSize.ts +10 -5
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +2 -2
- package/Components/VideoModal/hooks/utils/index.ts +4 -0
- package/Components/VideoModal/playerWrapperStyle.ts +70 -0
- package/Components/VideoModal/playerWrapperUtils.ts +91 -0
- package/Contexts/CellFocusedStateContext/index.tsx +27 -0
- package/Contexts/ConfigutaionContext/__tests__/ConfigurationProvider.test.tsx +3 -3
- package/Contexts/ScreenContext/index.tsx +28 -32
- package/Decorators/ConfigurationWrapper/__tests__/withConfigurationProvider.test.tsx +3 -3
- package/Decorators/RiverFeedLoader/__tests__/__snapshots__/riverFeedLoader.test.tsx.snap +221 -209
- package/Decorators/RiverFeedLoader/__tests__/riverFeedLoader.test.tsx +14 -16
- package/Decorators/RiverFeedLoader/__tests__/utils.test.ts +0 -20
- package/Decorators/RiverFeedLoader/index.tsx +21 -13
- package/Decorators/RiverFeedLoader/utils/getDatasourceUrl.ts +6 -10
- package/Decorators/RiverFeedLoader/utils/index.ts +0 -35
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +27 -27
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +3 -5
- package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +68 -76
- package/events/index.ts +3 -0
- package/package.json +5 -5
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -421
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
|
@@ -3,61 +3,172 @@ import { isMenuVisible } from "../navigationHandler";
|
|
|
3
3
|
describe("NavigationHandler", () => {
|
|
4
4
|
describe("isMenuVisible", () => {
|
|
5
5
|
it("returns false when the route is a player route", () => {
|
|
6
|
-
const menuVisible = isMenuVisible("/playable/some_vod_item", {}
|
|
6
|
+
const menuVisible = isMenuVisible("/playable/some_vod_item", {}, [
|
|
7
|
+
{
|
|
8
|
+
identifier: "quick-brick-bottom-tabs",
|
|
9
|
+
category: "menu",
|
|
10
|
+
name: "Bottom Tabs",
|
|
11
|
+
},
|
|
12
|
+
]);
|
|
13
|
+
|
|
7
14
|
expect(menuVisible).toBe(false);
|
|
8
15
|
});
|
|
9
16
|
|
|
10
17
|
describe("when screen is a hook", () => {
|
|
11
18
|
it("returns true if the `showNavBar` flag is set to true", () => {
|
|
12
|
-
const menuVisible = isMenuVisible(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
const menuVisible = isMenuVisible(
|
|
20
|
+
"",
|
|
21
|
+
{
|
|
22
|
+
hookPlugin: {
|
|
23
|
+
module: {
|
|
24
|
+
showNavBar: true,
|
|
25
|
+
},
|
|
16
26
|
},
|
|
27
|
+
navigations: [
|
|
28
|
+
{
|
|
29
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
30
|
+
identifier: "quick-brick-bottom-tabs",
|
|
31
|
+
category: "menu",
|
|
32
|
+
name: "Bottom Tabs",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
17
35
|
},
|
|
18
|
-
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
identifier: "quick-brick-bottom-tabs",
|
|
39
|
+
category: "menu",
|
|
40
|
+
name: "Bottom Tabs",
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
);
|
|
19
44
|
|
|
20
45
|
expect(menuVisible).toBe(true);
|
|
21
46
|
});
|
|
22
47
|
|
|
23
48
|
it("returns true if presentFullScreen flag is set to false", () => {
|
|
24
|
-
const menuVisible = isMenuVisible(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
49
|
+
const menuVisible = isMenuVisible(
|
|
50
|
+
"",
|
|
51
|
+
{
|
|
52
|
+
hookPlugin: {
|
|
53
|
+
module: {
|
|
54
|
+
presentFullScreen: false,
|
|
55
|
+
},
|
|
28
56
|
},
|
|
57
|
+
navigations: [
|
|
58
|
+
{
|
|
59
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
60
|
+
identifier: "quick-brick-bottom-tabs",
|
|
61
|
+
category: "menu",
|
|
62
|
+
name: "Bottom Tabs",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
29
65
|
},
|
|
30
|
-
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
identifier: "quick-brick-bottom-tabs",
|
|
69
|
+
category: "menu",
|
|
70
|
+
name: "Bottom Tabs",
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
);
|
|
31
74
|
|
|
32
75
|
expect(menuVisible).toBe(true);
|
|
33
76
|
});
|
|
34
77
|
|
|
35
78
|
it("returns false if presentFullScreen flag is set to true", () => {
|
|
36
|
-
const menuVisible = isMenuVisible(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
const menuVisible = isMenuVisible(
|
|
80
|
+
"",
|
|
81
|
+
{
|
|
82
|
+
hookPlugin: {
|
|
83
|
+
module: {
|
|
84
|
+
presentFullScreen: true,
|
|
85
|
+
},
|
|
40
86
|
},
|
|
87
|
+
navigations: [
|
|
88
|
+
{
|
|
89
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
90
|
+
identifier: "quick-brick-bottom-tabs",
|
|
91
|
+
category: "menu",
|
|
92
|
+
name: "Bottom Tabs",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
41
95
|
},
|
|
42
|
-
|
|
96
|
+
[
|
|
97
|
+
{
|
|
98
|
+
identifier: "quick-brick-bottom-tabs",
|
|
99
|
+
category: "menu",
|
|
100
|
+
name: "Bottom Tabs",
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
);
|
|
43
104
|
|
|
44
105
|
expect(menuVisible).toBe(false);
|
|
45
106
|
});
|
|
46
107
|
});
|
|
47
108
|
|
|
48
109
|
it("returns false if the screen's general settings allow screen presentation", () => {
|
|
49
|
-
const menuVisible = isMenuVisible(
|
|
50
|
-
|
|
51
|
-
|
|
110
|
+
const menuVisible = isMenuVisible(
|
|
111
|
+
"",
|
|
112
|
+
{
|
|
113
|
+
general: {
|
|
114
|
+
allow_screen_plugin_presentation: true,
|
|
115
|
+
},
|
|
116
|
+
navigations: [
|
|
117
|
+
{
|
|
118
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
119
|
+
identifier: "quick-brick-bottom-tabs",
|
|
120
|
+
category: "menu",
|
|
121
|
+
name: "Bottom Tabs",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
52
124
|
},
|
|
53
|
-
|
|
125
|
+
[
|
|
126
|
+
{
|
|
127
|
+
identifier: "quick-brick-bottom-tabs",
|
|
128
|
+
category: "menu",
|
|
129
|
+
name: "Bottom Tabs",
|
|
130
|
+
},
|
|
131
|
+
]
|
|
132
|
+
);
|
|
54
133
|
|
|
55
134
|
expect(menuVisible).toBe(false);
|
|
56
135
|
});
|
|
57
136
|
|
|
58
|
-
it("returns
|
|
59
|
-
const menuVisible = isMenuVisible(
|
|
137
|
+
it("returns false otherwise", () => {
|
|
138
|
+
const menuVisible = isMenuVisible(
|
|
139
|
+
"any",
|
|
140
|
+
{
|
|
141
|
+
navigations: [
|
|
142
|
+
{
|
|
143
|
+
navigation_type: "quick-brick-bottom-tabs",
|
|
144
|
+
identifier: "quick-brick-bottom-tabs",
|
|
145
|
+
category: "menu",
|
|
146
|
+
name: "Bottom Tabs",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
identifier: "quick-brick-bottom-tabs",
|
|
153
|
+
category: "menu",
|
|
154
|
+
name: "Bottom Tabs",
|
|
155
|
+
},
|
|
156
|
+
]
|
|
157
|
+
);
|
|
158
|
+
|
|
60
159
|
expect(menuVisible).toBe(true);
|
|
61
160
|
});
|
|
161
|
+
|
|
162
|
+
it("returns false otherwise", () => {
|
|
163
|
+
const menuVisible = isMenuVisible("", {}, [
|
|
164
|
+
{
|
|
165
|
+
identifier: "quick-brick-bottom-tabs",
|
|
166
|
+
category: "menu",
|
|
167
|
+
name: "Bottom Tabs",
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
expect(menuVisible).toBe(false);
|
|
172
|
+
});
|
|
62
173
|
});
|
|
63
174
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@applicaster/applicaster-types" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { View } from "react-native";
|
|
3
|
+
import { AccessibilityInfo, findNodeHandle, View } from "react-native";
|
|
4
4
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
5
|
|
|
6
6
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
13
13
|
import {
|
|
14
14
|
useCurrentScreenData,
|
|
15
|
+
useIsScreenActive,
|
|
15
16
|
useNavbarState,
|
|
16
17
|
useNavigation,
|
|
17
18
|
useRoute,
|
|
@@ -57,8 +58,8 @@ export function Screen(_props: Props) {
|
|
|
57
58
|
const hasMenu = shouldNavBarDisplayMenu(currentRiver, plugins);
|
|
58
59
|
|
|
59
60
|
const navBarProps = React.useMemo<MobileNavBarPluginProps | null>(
|
|
60
|
-
getNavBarProps(currentRiver, pathname, title),
|
|
61
|
-
[currentRiver, pathname]
|
|
61
|
+
() => getNavBarProps(currentRiver, pathname, title),
|
|
62
|
+
[currentRiver, pathname, title]
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
const NavBar = React.useMemo(
|
|
@@ -89,13 +90,29 @@ export function Screen(_props: Props) {
|
|
|
89
90
|
[theme.app_background_color, backgroundColor]
|
|
90
91
|
);
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
const isActive = useIsScreenActive();
|
|
94
|
+
|
|
95
|
+
const ref = React.useRef(null);
|
|
93
96
|
const isReady = useWaitForValidOrientation();
|
|
94
97
|
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (ref.current && isActive && isReady) {
|
|
100
|
+
const nodeHandle = findNodeHandle(ref.current);
|
|
101
|
+
|
|
102
|
+
if (nodeHandle != null) {
|
|
103
|
+
AccessibilityInfo.setAccessibilityFocus(nodeHandle);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, [isActive, isReady]);
|
|
107
|
+
|
|
95
108
|
// We prevent rendering of the screen until UI is actually rotated to screen desired orientation.
|
|
96
109
|
// This saves unnecessary re-renders and user will not see distorted aspect screen.
|
|
97
110
|
return (
|
|
98
|
-
<View
|
|
111
|
+
<View
|
|
112
|
+
ref={ref}
|
|
113
|
+
style={style}
|
|
114
|
+
importantForAccessibility={!isActive ? "no-hide-descendants" : "yes"}
|
|
115
|
+
>
|
|
99
116
|
{isReady ? (
|
|
100
117
|
<>
|
|
101
118
|
{navBarProps ? <NavBar {...navBarProps} hasMenu={hasMenu} /> : null}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolveNavigationPlugin } from "@applicaster/zapp-react-native-utils/navigationUtils";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* This function helps to decide wether the menu should be presented on the screen
|
|
3
5
|
* based on route and / or screen Data
|
|
@@ -14,12 +16,28 @@
|
|
|
14
16
|
* @param {Object} screenData payload associated with the currently presented screen
|
|
15
17
|
* @returns {Boolean}
|
|
16
18
|
*/
|
|
17
|
-
export function isMenuVisible(route, screenData) {
|
|
19
|
+
export function isMenuVisible(route, screenData, plugins) {
|
|
20
|
+
const plugin = resolveNavigationPlugin({
|
|
21
|
+
category: "menu",
|
|
22
|
+
navigations:
|
|
23
|
+
screenData?.navigations || screenData?.targetScreen?.navigations,
|
|
24
|
+
plugins,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const isBottomTabsPlugin = plugin?.identifier === "quick-brick-bottom-tabs";
|
|
28
|
+
|
|
29
|
+
if (!isBottomTabsPlugin) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
if (route.includes("playable")) {
|
|
19
34
|
return false;
|
|
20
35
|
}
|
|
21
36
|
|
|
22
|
-
if (
|
|
37
|
+
if (
|
|
38
|
+
screenData.type === "qb_search_screen" ||
|
|
39
|
+
screenData?.targetScreen?.type === "qb_search_screen"
|
|
40
|
+
) {
|
|
23
41
|
return false;
|
|
24
42
|
}
|
|
25
43
|
|
|
@@ -19,9 +19,9 @@ describe("ScreenRevealManager", () => {
|
|
|
19
19
|
|
|
20
20
|
const manager = new ScreenRevealManager(componentsToRender, mockCallback);
|
|
21
21
|
|
|
22
|
-
expect(manager
|
|
22
|
+
expect(manager.numberOfComponentsWaitToLoadBeforePresent).toBe(3);
|
|
23
23
|
|
|
24
|
-
expect(manager
|
|
24
|
+
expect(manager.renderingState).toEqual([
|
|
25
25
|
COMPONENT_LOADING_STATE.UNKNOWN,
|
|
26
26
|
COMPONENT_LOADING_STATE.UNKNOWN,
|
|
27
27
|
COMPONENT_LOADING_STATE.UNKNOWN,
|
|
@@ -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
|
+
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Animated } from "react-native";
|
|
2
|
+
import { Animated, StyleSheet } from "react-native";
|
|
3
3
|
import { isFirstComponentScreenPicker } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
4
|
import { useRefWithInitialValue } from "@applicaster/zapp-react-native-utils/reactHooks/state/useRefWithInitialValue";
|
|
5
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
6
6
|
|
|
7
7
|
import { ScreenRevealManager } from "./ScreenRevealManager";
|
|
8
|
+
import {
|
|
9
|
+
emitScreenRevealManagerIsReadyToShow,
|
|
10
|
+
emitScreenRevealManagerIsNotReadyToShow,
|
|
11
|
+
} from "./utils";
|
|
8
12
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
lg_tv: undefined,
|
|
15
|
-
default: undefined,
|
|
13
|
+
const styles = StyleSheet.create({
|
|
14
|
+
container: {
|
|
15
|
+
...StyleSheet.absoluteFillObject,
|
|
16
|
+
position: "absolute",
|
|
17
|
+
},
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
export const TIMEOUT =
|
|
20
|
+
export const TIMEOUT = 300; // 300 ms
|
|
19
21
|
|
|
20
22
|
const HIDDEN = 0; // opacity = 0
|
|
21
23
|
|
|
@@ -29,29 +31,48 @@ export const withScreenRevealManager = (Component) => {
|
|
|
29
31
|
return function WithScreenRevealManager(props: Props) {
|
|
30
32
|
const { componentsToRender } = props;
|
|
31
33
|
|
|
32
|
-
const [
|
|
34
|
+
const [isContentReadyToBeShown, setIsContentReadyToBeShown] =
|
|
35
|
+
React.useState(false);
|
|
33
36
|
|
|
34
|
-
const
|
|
35
|
-
|
|
37
|
+
const [isShowOverlay, setIsShowOverlay] = React.useState(true);
|
|
38
|
+
|
|
39
|
+
const theme = useTheme<BaseThemePropertiesTV>();
|
|
40
|
+
|
|
41
|
+
const handleSetIsContentReadyToBeShown = React.useCallback(() => {
|
|
42
|
+
setIsContentReadyToBeShown(true);
|
|
36
43
|
}, []);
|
|
37
44
|
|
|
38
45
|
const managerRef = useRefWithInitialValue<ScreenRevealManager>(
|
|
39
|
-
() =>
|
|
46
|
+
() =>
|
|
47
|
+
new ScreenRevealManager(
|
|
48
|
+
componentsToRender,
|
|
49
|
+
handleSetIsContentReadyToBeShown
|
|
50
|
+
)
|
|
40
51
|
);
|
|
41
52
|
|
|
42
53
|
const opacityRef = useRefWithInitialValue<Animated.Value>(
|
|
43
|
-
() => new Animated.Value(
|
|
54
|
+
() => new Animated.Value(SHOWN)
|
|
44
55
|
);
|
|
45
56
|
|
|
46
57
|
React.useEffect(() => {
|
|
47
|
-
if (
|
|
58
|
+
if (!isContentReadyToBeShown) {
|
|
59
|
+
emitScreenRevealManagerIsNotReadyToShow();
|
|
60
|
+
} else {
|
|
61
|
+
emitScreenRevealManagerIsReadyToShow();
|
|
62
|
+
}
|
|
63
|
+
}, [isContentReadyToBeShown]);
|
|
64
|
+
|
|
65
|
+
React.useEffect(() => {
|
|
66
|
+
if (isContentReadyToBeShown) {
|
|
48
67
|
Animated.timing(opacityRef.current, {
|
|
49
|
-
toValue:
|
|
68
|
+
toValue: HIDDEN,
|
|
50
69
|
duration: TIMEOUT,
|
|
51
70
|
useNativeDriver: true,
|
|
52
|
-
}).start()
|
|
71
|
+
}).start(() => {
|
|
72
|
+
setIsShowOverlay(false);
|
|
73
|
+
});
|
|
53
74
|
}
|
|
54
|
-
}, [
|
|
75
|
+
}, [isContentReadyToBeShown]);
|
|
55
76
|
|
|
56
77
|
if (isFirstComponentScreenPicker(componentsToRender)) {
|
|
57
78
|
// for screen-picker with have additional internal ComponentsMap, no need to add this wrapper
|
|
@@ -59,10 +80,7 @@ export const withScreenRevealManager = (Component) => {
|
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
return (
|
|
62
|
-
|
|
63
|
-
style={{ opacity: opacityRef.current, flex }}
|
|
64
|
-
testID="animated-component"
|
|
65
|
-
>
|
|
83
|
+
<>
|
|
66
84
|
<Component
|
|
67
85
|
{...props}
|
|
68
86
|
initialNumberToLoad={
|
|
@@ -73,7 +91,19 @@ export const withScreenRevealManager = (Component) => {
|
|
|
73
91
|
}
|
|
74
92
|
onLoadFailedFromScreenRevealManager={managerRef.current.onLoadFailed}
|
|
75
93
|
/>
|
|
76
|
-
|
|
94
|
+
{isShowOverlay ? (
|
|
95
|
+
<Animated.View
|
|
96
|
+
style={[
|
|
97
|
+
styles.container,
|
|
98
|
+
{
|
|
99
|
+
opacity: opacityRef.current,
|
|
100
|
+
backgroundColor: theme.app_background_color,
|
|
101
|
+
},
|
|
102
|
+
]}
|
|
103
|
+
testID="animated-component"
|
|
104
|
+
/>
|
|
105
|
+
) : null}
|
|
106
|
+
</>
|
|
77
107
|
);
|
|
78
108
|
};
|
|
79
109
|
};
|
|
@@ -62,7 +62,7 @@ const TabsComponent = ({
|
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const renderItem = useCallback(
|
|
65
|
-
({ item, index, focused }) => {
|
|
65
|
+
({ item, index, focused }: { item: any; index: any; focused?: any }) => {
|
|
66
66
|
const itemId = generateFocusableId(getId(item));
|
|
67
67
|
|
|
68
68
|
const isSelected = R.equals(index, selectedEntryIndex);
|
package/Components/Tabs/Tabs.tsx
CHANGED
|
@@ -158,12 +158,11 @@ const TabsComponent = ({
|
|
|
158
158
|
|
|
159
159
|
const renderItem = React.useCallback(
|
|
160
160
|
({ item, index, item: { id } }: RenderItemProps) => (
|
|
161
|
-
|
|
161
|
+
<React.Fragment key={id}>
|
|
162
162
|
<Tab
|
|
163
163
|
ref={(ref) => {
|
|
164
164
|
tabRefs.current[index] = ref;
|
|
165
165
|
}}
|
|
166
|
-
key={id}
|
|
167
166
|
{...{
|
|
168
167
|
title: getTitle(item),
|
|
169
168
|
id,
|
|
@@ -177,7 +176,7 @@ const TabsComponent = ({
|
|
|
177
176
|
{display_mode === "fractional" &&
|
|
178
177
|
index !== tabs?.length - 1 &&
|
|
179
178
|
renderGutter()}
|
|
180
|
-
|
|
179
|
+
</React.Fragment>
|
|
181
180
|
),
|
|
182
181
|
[tabs, display_mode, configuration, onTabPress, getTitle, getSelectedItem]
|
|
183
182
|
);
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<TextInputTv /> renders 1`] = `
|
|
4
4
|
<input
|
|
5
|
+
accessibilityProps={
|
|
6
|
+
{
|
|
7
|
+
"accessibilityHint": "Enter text into Search",
|
|
8
|
+
"accessibilityLabel": "Search",
|
|
9
|
+
"accessibilityRole": "searchbox",
|
|
10
|
+
"accessible": true,
|
|
11
|
+
"aria-description": "Enter text into Search",
|
|
12
|
+
"aria-label": "Search",
|
|
13
|
+
"aria-role": "searchbox",
|
|
14
|
+
"role": "searchbox",
|
|
15
|
+
"tabindex": 0,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
5
18
|
testID="TextInput-tv"
|
|
6
19
|
/>
|
|
7
20
|
`;
|
|
@@ -4,6 +4,7 @@ import { Appearance, Platform, StyleSheet, TextInput } from "react-native";
|
|
|
4
4
|
import { isFunction } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
5
5
|
import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
6
6
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
7
|
+
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
7
8
|
|
|
8
9
|
type Props = Partial<{
|
|
9
10
|
style: any;
|
|
@@ -42,6 +43,8 @@ function TextInputTV(props: Props, ref) {
|
|
|
42
43
|
const [colorScheme, setColorScheme] = useState(getInitialColorScheme());
|
|
43
44
|
const isRTL = useIsRTL();
|
|
44
45
|
|
|
46
|
+
const accessibilityManager = useAccessibilityManager({});
|
|
47
|
+
|
|
45
48
|
const onColorChange = useCallback(
|
|
46
49
|
({ colorScheme: color }) => {
|
|
47
50
|
if (color !== colorScheme) {
|
|
@@ -153,6 +156,13 @@ function TextInputTV(props: Props, ref) {
|
|
|
153
156
|
])
|
|
154
157
|
)(props);
|
|
155
158
|
|
|
159
|
+
const getAccessibilityProps = () => {
|
|
160
|
+
return {
|
|
161
|
+
accessibilityProps:
|
|
162
|
+
accessibilityManager.getInputAccessibilityProps("Search"),
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
|
|
156
166
|
const inputProps = {
|
|
157
167
|
...getProps(),
|
|
158
168
|
...getStyle(),
|
|
@@ -161,6 +171,7 @@ function TextInputTV(props: Props, ref) {
|
|
|
161
171
|
...getSecureTextEntry(),
|
|
162
172
|
...getOnEndEditing(),
|
|
163
173
|
...getOnPress(),
|
|
174
|
+
...getAccessibilityProps(),
|
|
164
175
|
};
|
|
165
176
|
|
|
166
177
|
if (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { View, TouchableOpacity } from "react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { render } from "@testing-library/react-native";
|
|
4
4
|
|
|
5
5
|
import { Touchable } from "..";
|
|
6
6
|
|
|
@@ -23,38 +23,31 @@ describe("<Touchable />", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("has accessible flag set to false", () => {
|
|
26
|
-
|
|
26
|
+
const { toJSON, UNSAFE_getByType } = render(<Touchable {...props} />);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
|
|
33
|
-
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
28
|
+
const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
|
|
29
|
+
expect(toJSON()).toMatchSnapshot();
|
|
34
30
|
expect(touchableWrapper.props).toHaveProperty("accessible", false);
|
|
35
31
|
});
|
|
36
32
|
});
|
|
37
33
|
|
|
38
34
|
describe("when not running in automated tests environment", () => {
|
|
39
|
-
let wrapper;
|
|
40
|
-
|
|
41
|
-
act(() => {
|
|
42
|
-
wrapper = create(<Touchable {...props} />);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const touchableWrapper = wrapper.root.findByType(TouchableOpacity);
|
|
46
|
-
|
|
47
35
|
beforeEach(props.onPress.mockClear);
|
|
48
36
|
|
|
49
37
|
it("renders correctly", () => {
|
|
50
|
-
|
|
38
|
+
const { toJSON } = render(<Touchable {...props} />);
|
|
39
|
+
expect(toJSON()).toMatchSnapshot();
|
|
51
40
|
});
|
|
52
41
|
|
|
53
42
|
it("has accessible flag set to true", () => {
|
|
43
|
+
const { UNSAFE_getByType } = render(<Touchable {...props} />);
|
|
44
|
+
const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
|
|
54
45
|
expect(touchableWrapper.props).toHaveProperty("accessible", true);
|
|
55
46
|
});
|
|
56
47
|
|
|
57
48
|
it("assigns testID and accessibilityLabel props correctly", () => {
|
|
49
|
+
const { UNSAFE_getByType } = render(<Touchable {...props} />);
|
|
50
|
+
const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
|
|
58
51
|
expect(touchableWrapper.props).toHaveProperty("testID", props.testID);
|
|
59
52
|
|
|
60
53
|
expect(touchableWrapper.props).toHaveProperty(
|
|
@@ -64,6 +57,8 @@ describe("<Touchable />", () => {
|
|
|
64
57
|
});
|
|
65
58
|
|
|
66
59
|
it("calls the onPress event when it is pressed", () => {
|
|
60
|
+
const { UNSAFE_getByType } = render(<Touchable {...props} />);
|
|
61
|
+
const touchableWrapper = UNSAFE_getByType(TouchableOpacity);
|
|
67
62
|
touchableWrapper.props.onPress();
|
|
68
63
|
expect(props.onPress).toHaveBeenCalledTimes(1);
|
|
69
64
|
});
|