@applicaster/zapp-react-native-ui-components 15.0.0-alpha.7877002324 → 15.0.0-alpha.8526950782
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/Cell/Cell.tsx +3 -8
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +1 -16
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +2 -30
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
- package/Components/MasterCell/index.tsx +0 -2
- package/Components/Tabs/TV/Tabs.tsx +3 -20
- package/index.d.ts +0 -7
- package/package.json +5 -5
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -208,14 +208,14 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
208
208
|
this.accessibilityManager.readText({
|
|
209
209
|
text: " ",
|
|
210
210
|
});
|
|
211
|
-
} else
|
|
211
|
+
} else {
|
|
212
212
|
this.accessibilityManager.readText({
|
|
213
213
|
text: `${positionLabel}`,
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
componentDidUpdate(prevProps: Readonly<Props
|
|
218
|
+
componentDidUpdate(prevProps: Readonly<Props>) {
|
|
219
219
|
if (prevProps.item !== this.props.item) {
|
|
220
220
|
this.setState({
|
|
221
221
|
hasFocusableInside: this.props.CellRenderer.hasFocusableInside?.(
|
|
@@ -224,12 +224,7 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
prevState.cellFocused !== this.state.cellFocused ||
|
|
229
|
-
this.state.hasFocusableInside
|
|
230
|
-
) {
|
|
231
|
-
this.handleAccessibilityFocus(this.props.index, this.props.dataLength);
|
|
232
|
-
}
|
|
227
|
+
this.handleAccessibilityFocus(this.props.index, this.props.dataLength);
|
|
233
228
|
}
|
|
234
229
|
|
|
235
230
|
render() {
|
package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import {
|
|
3
2
|
BorderContainerView,
|
|
4
3
|
getBorderPadding, // Export for testing (using a double underscore prefix is a common convention)
|
|
5
4
|
} from "../index";
|
|
5
|
+
import * as React from "react";
|
|
6
6
|
import { render } from "@testing-library/react-native";
|
|
7
7
|
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
8
8
|
import { View } from "react-native";
|
|
@@ -11,15 +11,6 @@ jest.mock("@applicaster/zapp-react-native-utils/numberUtils", () => ({
|
|
|
11
11
|
toNumberWithDefaultZero: jest.fn((value) => Number(value) || 0),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
|
-
jest.mock(
|
|
15
|
-
"@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks",
|
|
16
|
-
() => ({
|
|
17
|
-
useAccessibilityManager: jest.fn(() => ({
|
|
18
|
-
addHeading: jest.fn(),
|
|
19
|
-
})),
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
|
|
23
14
|
describe("BorderContainerView", () => {
|
|
24
15
|
describe("getBorderPadding", () => {
|
|
25
16
|
it("returns 0 for inside", () => {
|
|
@@ -51,8 +42,6 @@ describe("BorderContainerView", () => {
|
|
|
51
42
|
};
|
|
52
43
|
|
|
53
44
|
const borderPosition = null;
|
|
54
|
-
const mockEntry = { id: "test-entry" } as ZappEntry;
|
|
55
|
-
const mockHasFocusableInside = jest.fn(() => false);
|
|
56
45
|
|
|
57
46
|
const { queryByTestId } = render(
|
|
58
47
|
<BorderContainerView
|
|
@@ -63,10 +52,6 @@ describe("BorderContainerView", () => {
|
|
|
63
52
|
borderPaddingRight={toNumberWithDefaultZero(padding.paddingRight)}
|
|
64
53
|
borderPaddingBottom={toNumberWithDefaultZero(padding.paddingBottom)}
|
|
65
54
|
borderPaddingLeft={toNumberWithDefaultZero(padding.paddingLeft)}
|
|
66
|
-
hasFocusableInside={mockHasFocusableInside}
|
|
67
|
-
entry={mockEntry}
|
|
68
|
-
state="focused"
|
|
69
|
-
hasTextLabels={false}
|
|
70
55
|
>
|
|
71
56
|
<View testID="child" />
|
|
72
57
|
</BorderContainerView>
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import React, { useMemo, useContext, useEffect } from "react";
|
|
2
|
-
import { ImageStyle, StyleSheet, View, ViewStyle } from "react-native";
|
|
3
|
-
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
4
1
|
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
5
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ImageStyle, StyleSheet, View, ViewStyle } from "react-native";
|
|
6
4
|
|
|
7
5
|
type BorderPosition = "inside" | "outside" | "center";
|
|
8
6
|
|
|
9
7
|
interface Props {
|
|
10
|
-
hasFocusableInside: (entry: ZappEntry) => boolean;
|
|
11
|
-
entry: ZappEntry;
|
|
12
|
-
state: CellState;
|
|
13
|
-
hasTextLabels: boolean;
|
|
14
8
|
style: ImageStyle | ViewStyle;
|
|
15
9
|
borderPosition: BorderPosition;
|
|
16
10
|
borderPaddingTop: number;
|
|
@@ -124,30 +118,8 @@ export const BorderContainerView = (props: Props) => {
|
|
|
124
118
|
borderPaddingLeft,
|
|
125
119
|
style,
|
|
126
120
|
children,
|
|
127
|
-
hasFocusableInside,
|
|
128
|
-
entry,
|
|
129
|
-
state,
|
|
130
|
-
hasTextLabels,
|
|
131
121
|
} = props;
|
|
132
122
|
|
|
133
|
-
const accessibilityManager = useAccessibilityManager();
|
|
134
|
-
const isMeasurement = useContext(MeasurementPortalContext);
|
|
135
|
-
|
|
136
|
-
const isImageOnlyCell = useMemo(
|
|
137
|
-
() =>
|
|
138
|
-
!hasFocusableInside(entry) &&
|
|
139
|
-
!hasTextLabels &&
|
|
140
|
-
state === "focused" &&
|
|
141
|
-
!isMeasurement,
|
|
142
|
-
[hasFocusableInside, entry, hasTextLabels, state, isMeasurement]
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
useEffect(() => {
|
|
146
|
-
if (isImageOnlyCell && entry?.title) {
|
|
147
|
-
accessibilityManager.addHeading(String(entry.title));
|
|
148
|
-
}
|
|
149
|
-
}, [isImageOnlyCell, entry?.title]);
|
|
150
|
-
|
|
151
123
|
const padding =
|
|
152
124
|
borderPosition === "outside"
|
|
153
125
|
? {
|
|
@@ -52,14 +52,14 @@ const _Text = ({
|
|
|
52
52
|
: textTransform(transformText, _label);
|
|
53
53
|
|
|
54
54
|
React.useLayoutEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
// For FocusableCells with action buttons
|
|
56
|
+
if (otherProps.state) {
|
|
57
|
+
if (otherProps.state === "focused" && cellFocused === true) {
|
|
58
|
+
accessibilityManager.addHeading(textLabel);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (cellFocused === true) {
|
|
62
|
+
accessibilityManager.addHeading(textLabel);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}, [cellFocused, otherProps.state, textLabel]);
|
|
@@ -8,7 +8,6 @@ import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
|
8
8
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
9
9
|
import { FocusableGroup } from "@applicaster/zapp-react-native-ui-components/Components/FocusableGroup";
|
|
10
10
|
import { Focusable } from "@applicaster/zapp-react-native-ui-components/Components/Focusable";
|
|
11
|
-
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
12
11
|
import { Gutter } from "../Gutter";
|
|
13
12
|
import Tab from "./Tab";
|
|
14
13
|
import { getStyles } from "./styles";
|
|
@@ -29,14 +28,11 @@ const TabsComponent = ({
|
|
|
29
28
|
style,
|
|
30
29
|
selectedEntryIndex,
|
|
31
30
|
setSelectedEntry,
|
|
32
|
-
accessibility,
|
|
33
31
|
}: TabsProps & Partial<TabsSelectionContextType>) => {
|
|
34
32
|
const configuration = useConfiguration();
|
|
35
33
|
const config = applyFontConfig(configuration);
|
|
36
34
|
const styles = useMemo(() => getStyles(config), [config]);
|
|
37
35
|
|
|
38
|
-
const accessibilityManager = useAccessibilityManager({});
|
|
39
|
-
|
|
40
36
|
const {
|
|
41
37
|
tab_bar_gutter: horizontalGutter,
|
|
42
38
|
tab_bar_background_image: bgImage,
|
|
@@ -64,20 +60,10 @@ const TabsComponent = ({
|
|
|
64
60
|
);
|
|
65
61
|
|
|
66
62
|
const onListElementFocus = useCallback(
|
|
67
|
-
(index
|
|
68
|
-
if (isSelected) {
|
|
69
|
-
accessibilityManager.readText({
|
|
70
|
-
text: `${accessibility?.selectedHint} ${item.title}`,
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
accessibilityManager.readText({
|
|
74
|
-
text: `${accessibility?.hint} ${item.title}`,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
63
|
+
(index) => {
|
|
78
64
|
scrollToSelectedIndex(index, VIEW_POSITION);
|
|
79
65
|
},
|
|
80
|
-
[scrollToSelectedIndex
|
|
66
|
+
[scrollToSelectedIndex]
|
|
81
67
|
);
|
|
82
68
|
|
|
83
69
|
const renderItem = useCallback(
|
|
@@ -108,7 +94,7 @@ const TabsComponent = ({
|
|
|
108
94
|
id={itemId}
|
|
109
95
|
testID={itemId}
|
|
110
96
|
preferredFocus={isSelected}
|
|
111
|
-
onFocus={() => onListElementFocus(index
|
|
97
|
+
onFocus={() => onListElementFocus(index)}
|
|
112
98
|
onPress={() => setSelectedEntry && setSelectedEntry(item)}
|
|
113
99
|
style={style}
|
|
114
100
|
>
|
|
@@ -163,9 +149,6 @@ const TabsComponent = ({
|
|
|
163
149
|
shouldUsePreferredFocus
|
|
164
150
|
isWithMemory={false}
|
|
165
151
|
nextFocusDown={parentFocus?.nextFocusDown}
|
|
166
|
-
onFocus={() => {
|
|
167
|
-
accessibilityManager.addHeading(accessibility?.announcement);
|
|
168
|
-
}}
|
|
169
152
|
>
|
|
170
153
|
<View style={tabs}>
|
|
171
154
|
<ImageBackground
|
package/index.d.ts
CHANGED
|
@@ -228,12 +228,6 @@ declare type TabsSelectionContextType = {
|
|
|
228
228
|
selectedEntryIndex: number;
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
declare type TabsAccessibility = {
|
|
232
|
-
announcement?: string;
|
|
233
|
-
selectedHint?: string;
|
|
234
|
-
hint?: string;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
231
|
declare type TabsProps = {
|
|
238
232
|
entry: ZappEntry[];
|
|
239
233
|
groupId: string;
|
|
@@ -241,7 +235,6 @@ declare type TabsProps = {
|
|
|
241
235
|
focused?: boolean;
|
|
242
236
|
parentFocus?: ParentFocus;
|
|
243
237
|
style?: ReactViewStyle;
|
|
244
|
-
accessibility?: TabsAccessibility;
|
|
245
238
|
};
|
|
246
239
|
|
|
247
240
|
declare type TabContentProps = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.8526950782",
|
|
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-alpha.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.8526950782",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-alpha.8526950782",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-alpha.8526950782",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-alpha.8526950782",
|
|
35
35
|
"promise": "^8.3.0",
|
|
36
36
|
"url": "^0.11.0",
|
|
37
37
|
"uuid": "^3.3.2"
|