@applicaster/zapp-react-native-ui-components 13.0.9-alpha.1121932485 → 13.0.9-alpha.8722424302
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 +64 -91
- package/Components/Cell/CellWithFocusable.tsx +0 -3
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +3 -2
- package/Components/FeedLoader/FeedLoader.tsx +4 -14
- package/Components/FeedLoader/FeedLoaderHOC.tsx +19 -0
- package/Components/FeedLoader/index.js +2 -8
- package/Components/Focusable/Focusable.tsx +0 -8
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +5 -6
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +12 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +6 -26
- package/Components/MasterCell/utils/behaviorProvider.ts +82 -14
- package/Components/MasterCell/utils/index.ts +11 -5
- package/Components/River/RefreshControl.tsx +11 -17
- package/Components/River/__tests__/river.test.js +12 -26
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +0 -13
- package/Components/TextInputTv/index.tsx +0 -11
- package/Contexts/ScreenContext/index.tsx +46 -6
- 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 +22 -4
- package/Decorators/RiverFeedLoader/utils/index.ts +0 -18
- package/Decorators/ZappPipesDataConnector/__tests__/UrlFeedResolver.test.tsx +368 -0
- package/Decorators/ZappPipesDataConnector/index.tsx +20 -5
- package/Decorators/ZappPipesDataConnector/resolvers/UrlFeedResolver.tsx +266 -0
- package/Decorators/ZappPipesDataConnector/utils/mongoFilter.ts +738 -0
- package/Decorators/ZappPipesDataConnector/utils/useFilter.tsx +159 -0
- package/package.json +5 -5
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +0 -27
- package/Contexts/CellStateContext/index.tsx +0 -25
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -8,7 +8,6 @@ import { getItemType } from "@applicaster/zapp-react-native-utils/navigationUtil
|
|
|
8
8
|
import { SCREEN_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/itemTypes";
|
|
9
9
|
import { sendSelectCellEvent } from "@applicaster/zapp-react-native-utils/analyticsUtils";
|
|
10
10
|
import { noop } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
11
|
-
import { CellStateContextProvider } from "@applicaster/zapp-react-native-ui-components/Contexts/CellStateContext";
|
|
12
11
|
|
|
13
12
|
import { CellWithFocusable } from "./CellWithFocusable";
|
|
14
13
|
import { BaseFocusable } from "../BaseFocusable";
|
|
@@ -16,7 +15,6 @@ import { AccessibilityManager } from "@applicaster/zapp-react-native-utils/appUt
|
|
|
16
15
|
import { styles } from "./styles";
|
|
17
16
|
|
|
18
17
|
type Props = {
|
|
19
|
-
dataLength: number;
|
|
20
18
|
item: ZappEntry;
|
|
21
19
|
index: number;
|
|
22
20
|
shouldScrollHorizontally: (arg1: [any]) => boolean | null | undefined;
|
|
@@ -69,12 +67,9 @@ type Props = {
|
|
|
69
67
|
|
|
70
68
|
type State = {
|
|
71
69
|
hasFocusableInside: boolean;
|
|
72
|
-
cellFocused: boolean;
|
|
73
70
|
};
|
|
74
71
|
|
|
75
72
|
export class CellComponent extends React.Component<Props, State> {
|
|
76
|
-
accessibilityManager: AccessibilityManager;
|
|
77
|
-
|
|
78
73
|
constructor(props) {
|
|
79
74
|
super(props);
|
|
80
75
|
this.onPress = this.onPress.bind(this);
|
|
@@ -84,14 +79,10 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
84
79
|
this.hasReceivedFocus = this.hasReceivedFocus.bind(this);
|
|
85
80
|
this.scrollVertically = this.scrollVertically.bind(this);
|
|
86
81
|
this.scrollToIndex = this.scrollToIndex.bind(this);
|
|
87
|
-
this.handleAccessibilityFocus = this.handleAccessibilityFocus.bind(this);
|
|
88
82
|
|
|
89
83
|
this.state = {
|
|
90
84
|
hasFocusableInside: props.CellRenderer.hasFocusableInside?.(props.item),
|
|
91
|
-
cellFocused: false,
|
|
92
85
|
};
|
|
93
|
-
|
|
94
|
-
this.accessibilityManager = AccessibilityManager.getInstance();
|
|
95
86
|
}
|
|
96
87
|
|
|
97
88
|
setScreenLayout(componentAnchorPointY, screenLayout) {
|
|
@@ -139,8 +130,6 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
139
130
|
} = this.props;
|
|
140
131
|
|
|
141
132
|
if (isFocusable) {
|
|
142
|
-
this.setState({ cellFocused: true });
|
|
143
|
-
|
|
144
133
|
if (
|
|
145
134
|
shouldUpdate &&
|
|
146
135
|
shouldScrollVertically?.(mouse, focusable, id, title)
|
|
@@ -150,9 +139,7 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
150
139
|
}
|
|
151
140
|
}
|
|
152
141
|
|
|
153
|
-
onBlur() {
|
|
154
|
-
this.setState({ cellFocused: false });
|
|
155
|
-
}
|
|
142
|
+
onBlur() {}
|
|
156
143
|
|
|
157
144
|
willReceiveFocus() {}
|
|
158
145
|
|
|
@@ -196,25 +183,6 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
196
183
|
return !isFocusable ? false : focused || focusableFocused;
|
|
197
184
|
}
|
|
198
185
|
|
|
199
|
-
handleAccessibilityFocus(index, dataLength) {
|
|
200
|
-
// For loop scrolling, calculate the correct logical index
|
|
201
|
-
const logicalIndex = dataLength ? index % dataLength : index;
|
|
202
|
-
|
|
203
|
-
const positionLabel = dataLength
|
|
204
|
-
? `item ${logicalIndex + 1} of ${dataLength}`
|
|
205
|
-
: "";
|
|
206
|
-
|
|
207
|
-
if (this.state.hasFocusableInside) {
|
|
208
|
-
this.accessibilityManager.readText({
|
|
209
|
-
text: " ",
|
|
210
|
-
});
|
|
211
|
-
} else {
|
|
212
|
-
this.accessibilityManager.readText({
|
|
213
|
-
text: `${positionLabel}`,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
186
|
componentDidUpdate(prevProps: Readonly<Props>) {
|
|
219
187
|
if (prevProps.item !== this.props.item) {
|
|
220
188
|
this.setState({
|
|
@@ -223,8 +191,6 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
223
191
|
),
|
|
224
192
|
});
|
|
225
193
|
}
|
|
226
|
-
|
|
227
|
-
this.handleAccessibilityFocus(this.props.index, this.props.dataLength);
|
|
228
194
|
}
|
|
229
195
|
|
|
230
196
|
render() {
|
|
@@ -246,6 +212,7 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
246
212
|
} = this.props;
|
|
247
213
|
|
|
248
214
|
const { id } = item;
|
|
215
|
+
|
|
249
216
|
const focusableId = join("-", [component?.id, id, index]);
|
|
250
217
|
|
|
251
218
|
const handleFocus = (focusable, mouse) => {
|
|
@@ -256,67 +223,73 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
256
223
|
|
|
257
224
|
if (this.state.hasFocusableInside) {
|
|
258
225
|
return (
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
behavior={behavior}
|
|
272
|
-
/>
|
|
273
|
-
</CellStateContextProvider>
|
|
226
|
+
<CellWithFocusable
|
|
227
|
+
CellRenderer={CellRenderer}
|
|
228
|
+
item={item}
|
|
229
|
+
id={focusableId}
|
|
230
|
+
groupId={groupId || component?.id}
|
|
231
|
+
onFocus={handleFocus}
|
|
232
|
+
index={index}
|
|
233
|
+
scrollTo={this.scrollToIndex()}
|
|
234
|
+
isFocusable={isFocusable}
|
|
235
|
+
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
236
|
+
behavior={behavior}
|
|
237
|
+
/>
|
|
274
238
|
);
|
|
275
239
|
}
|
|
276
240
|
|
|
277
241
|
return (
|
|
278
|
-
<
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
242
|
+
<View
|
|
243
|
+
testID={`${component?.id}-${id}`}
|
|
244
|
+
accessible={false}
|
|
245
|
+
style={styles.touchableCell}
|
|
246
|
+
>
|
|
247
|
+
<Focusable
|
|
248
|
+
id={focusableId}
|
|
249
|
+
groupId={groupId || component?.id}
|
|
250
|
+
onFocus={handleFocus}
|
|
251
|
+
onBlur={onBlur || this.onBlur}
|
|
252
|
+
onPress={this.onPress}
|
|
253
|
+
willReceiveFocus={willReceiveFocus || this.willReceiveFocus}
|
|
254
|
+
hasReceivedFocus={hasReceivedFocus || this.hasReceivedFocus}
|
|
255
|
+
preferredFocus={preferredFocus}
|
|
256
|
+
offsetUpdater={offsetUpdater}
|
|
257
|
+
style={styles.baseCell}
|
|
258
|
+
isFocusable={isFocusable}
|
|
259
|
+
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
283
260
|
>
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}}
|
|
317
|
-
</Focusable>
|
|
318
|
-
</View>
|
|
319
|
-
</CellStateContextProvider>
|
|
261
|
+
{(focused, event) => {
|
|
262
|
+
const isFocused = this.isCellFocused(focused);
|
|
263
|
+
|
|
264
|
+
if (isFocused) {
|
|
265
|
+
const accessibilityManager = AccessibilityManager.getInstance();
|
|
266
|
+
|
|
267
|
+
const accessibilityTitle =
|
|
268
|
+
item?.extensions?.accessibility?.label || item?.title || "";
|
|
269
|
+
|
|
270
|
+
const accessibilityHint =
|
|
271
|
+
item?.extensions?.accessibility?.hint || "";
|
|
272
|
+
|
|
273
|
+
accessibilityManager.readText({
|
|
274
|
+
text: `${accessibilityTitle} ${accessibilityHint}`,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<FocusableCell
|
|
280
|
+
{...{
|
|
281
|
+
index,
|
|
282
|
+
CellRenderer,
|
|
283
|
+
item,
|
|
284
|
+
focused: isFocused,
|
|
285
|
+
scrollTo: this.scrollToIndex(event),
|
|
286
|
+
behavior,
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
}}
|
|
291
|
+
</Focusable>
|
|
292
|
+
</View>
|
|
320
293
|
);
|
|
321
294
|
}
|
|
322
295
|
}
|
|
@@ -14,7 +14,6 @@ type Props = {
|
|
|
14
14
|
id: string;
|
|
15
15
|
groupId: string;
|
|
16
16
|
onFocus: Function;
|
|
17
|
-
onBlur?: Function;
|
|
18
17
|
index: number;
|
|
19
18
|
scrollTo: Function;
|
|
20
19
|
preferredFocus?: boolean;
|
|
@@ -34,7 +33,6 @@ export function CellWithFocusable(props: Props) {
|
|
|
34
33
|
id,
|
|
35
34
|
groupId,
|
|
36
35
|
onFocus,
|
|
37
|
-
onBlur = noop,
|
|
38
36
|
scrollTo = noop,
|
|
39
37
|
preferredFocus,
|
|
40
38
|
skipFocusManagerRegistration,
|
|
@@ -80,7 +78,6 @@ export function CellWithFocusable(props: Props) {
|
|
|
80
78
|
const onGroupBlur = React.useCallback(() => {
|
|
81
79
|
if (!skipFocusManagerRegistration) {
|
|
82
80
|
setIsFocused(false);
|
|
83
|
-
onBlur?.();
|
|
84
81
|
}
|
|
85
82
|
}, [skipFocusManagerRegistration]);
|
|
86
83
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { View } from "react-native";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { act
|
|
3
|
+
import { act } from "@testing-library/react-native";
|
|
4
4
|
import { CellWithFocusable } from "../CellWithFocusable.tsx";
|
|
5
5
|
|
|
6
6
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
7
|
+
import { renderWithProviders } from "@applicaster/zapp-react-native-utils/testUtils/index.tsx";
|
|
7
8
|
|
|
8
9
|
const renderWith = (props) => {
|
|
9
|
-
return
|
|
10
|
+
return renderWithProviders(<CellWithFocusable {...props} />);
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
describe("CellWithFocusable", () => {
|
|
@@ -3,23 +3,13 @@ import * as R from "ramda";
|
|
|
3
3
|
|
|
4
4
|
type Props = {
|
|
5
5
|
zappPipes: ZappPipesData;
|
|
6
|
-
loadPipesData:
|
|
7
|
-
feed
|
|
8
|
-
|
|
9
|
-
clearCache: boolean;
|
|
10
|
-
meta: any;
|
|
11
|
-
loadLocalFavorites: boolean;
|
|
12
|
-
silentRefresh: boolean;
|
|
13
|
-
parentFeed: ZappFeed;
|
|
14
|
-
callback: () => void;
|
|
15
|
-
bodyParams: any;
|
|
16
|
-
riverId: string;
|
|
17
|
-
}>
|
|
18
|
-
) => void;
|
|
6
|
+
loadPipesData: ReturnType<
|
|
7
|
+
typeof import("@applicaster/zapp-react-native-utils/reactHooks/feed").useLoadPipesDataDispatch
|
|
8
|
+
>;
|
|
19
9
|
feedUrl: string;
|
|
20
10
|
children: (feed: ZappFeed) => React.ComponentType<any>;
|
|
21
11
|
onFeedLoaded: (feed: ZappFeed) => {};
|
|
22
|
-
onError: (
|
|
12
|
+
onError: (error: ZappPipesData["error"]) => {};
|
|
23
13
|
refreshing: boolean;
|
|
24
14
|
refreshCallback: () => void;
|
|
25
15
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks/feed";
|
|
4
|
+
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
|
+
|
|
6
|
+
export const FeedLoaderHOC = (_Component: any) => {
|
|
7
|
+
return function FeedLoaderHOC(props: any) {
|
|
8
|
+
const { zappPipes } = usePickFromState(["zappPipes"]);
|
|
9
|
+
const loadPipesData = useLoadPipesDataDispatch();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<_Component
|
|
13
|
+
{...props}
|
|
14
|
+
zappPipes={zappPipes}
|
|
15
|
+
loadPipesData={loadPipesData}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import * as R from "ramda";
|
|
2
|
-
|
|
3
|
-
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
4
|
-
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
5
|
-
|
|
6
1
|
import { FeedLoaderComponent } from "./FeedLoader";
|
|
2
|
+
import { FeedLoaderHOC } from "./FeedLoaderHOC";
|
|
7
3
|
|
|
8
|
-
export const FeedLoader =
|
|
9
|
-
loadPipesData,
|
|
10
|
-
})(FeedLoaderComponent);
|
|
4
|
+
export const FeedLoader = FeedLoaderHOC(FeedLoaderComponent);
|
|
@@ -5,7 +5,6 @@ import { BaseFocusable } from "../BaseFocusable";
|
|
|
5
5
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
6
6
|
import { LONG_KEY_PRESS_TIMEOUT } from "@applicaster/quick-brick-core/const";
|
|
7
7
|
import { withFocusableContext } from "../../Contexts/FocusableGroupContext/withFocusableContext";
|
|
8
|
-
import { AccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager";
|
|
9
8
|
|
|
10
9
|
type Props = {
|
|
11
10
|
initialFocus?: boolean;
|
|
@@ -29,7 +28,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
29
28
|
isGroup: boolean;
|
|
30
29
|
mouse: boolean;
|
|
31
30
|
longPressTimeout = null;
|
|
32
|
-
accessibilityManager: AccessibilityManager;
|
|
33
31
|
|
|
34
32
|
constructor(props) {
|
|
35
33
|
super(props);
|
|
@@ -44,8 +42,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
44
42
|
this.resetLongPressTimeout = this.resetLongPressTimeout.bind(this);
|
|
45
43
|
this.longPress = this.longPress.bind(this);
|
|
46
44
|
this.press = this.press.bind(this);
|
|
47
|
-
|
|
48
|
-
this.accessibilityManager = AccessibilityManager.getInstance();
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
/**
|
|
@@ -132,9 +128,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
132
128
|
const id = this.getId();
|
|
133
129
|
const focusableId = `focusable-${id}`;
|
|
134
130
|
|
|
135
|
-
const accessibilityProps =
|
|
136
|
-
this.accessibilityManager.getWebAccessibilityProps(this.props);
|
|
137
|
-
|
|
138
131
|
return (
|
|
139
132
|
<div
|
|
140
133
|
id={focusableId}
|
|
@@ -147,7 +140,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
147
140
|
data-testid={focusableId}
|
|
148
141
|
focused-teststate={focused ? "focused" : "default"}
|
|
149
142
|
style={style}
|
|
150
|
-
{...accessibilityProps}
|
|
151
143
|
>
|
|
152
144
|
{children(focused, { mouse: this.mouse })}
|
|
153
145
|
</div>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { all, equals, path, prop, isEmpty, pluck, values } from "ramda";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from "react";
|
|
4
|
-
import { useDispatch } from "react-redux";
|
|
5
4
|
|
|
6
5
|
import {
|
|
7
6
|
useLayoutPresets,
|
|
8
7
|
useZappPipesFeeds,
|
|
9
8
|
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
10
|
-
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
11
9
|
import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
12
10
|
import { Categories } from "./logger";
|
|
13
11
|
import { createLogger } from "@applicaster/zapp-react-native-utils/logger";
|
|
@@ -24,6 +22,7 @@ import {
|
|
|
24
22
|
} from "@applicaster/zapp-react-native-utils/reactHooks/feed/useInflatedUrl";
|
|
25
23
|
|
|
26
24
|
import { produce } from "immer";
|
|
25
|
+
import { useLoadPipesDataDispatch } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
27
26
|
// types reference
|
|
28
27
|
|
|
29
28
|
declare type CurationEntry = { preset_name: string; feed_url: string };
|
|
@@ -122,8 +121,6 @@ export const getFinalComponents = (
|
|
|
122
121
|
export const useCurationAPI = (
|
|
123
122
|
components: Array<ZappUIComponent>
|
|
124
123
|
): ZappUIComponent[] => {
|
|
125
|
-
const dispatch = useDispatch();
|
|
126
|
-
|
|
127
124
|
const smartComponents = useMemo(
|
|
128
125
|
() => components?.filter?.(isSmartComponent) ?? [],
|
|
129
126
|
[components]
|
|
@@ -159,17 +156,19 @@ export const useCurationAPI = (
|
|
|
159
156
|
|
|
160
157
|
const urls = useMemo<string[]>(() => Object.values(urlsMap), [urlsMap]);
|
|
161
158
|
|
|
159
|
+
const loadPipesDataDispatcher = useLoadPipesDataDispatch();
|
|
160
|
+
|
|
162
161
|
useEffect(() => {
|
|
163
162
|
urls.forEach((url, index) => {
|
|
164
163
|
if (url) {
|
|
165
|
-
|
|
164
|
+
loadPipesDataDispatcher(url, { clearCache: false });
|
|
166
165
|
} else {
|
|
167
166
|
logger.log_error("Curation url is empty", {
|
|
168
167
|
componentId: smartComponents?.[index]?.id,
|
|
169
168
|
});
|
|
170
169
|
}
|
|
171
170
|
});
|
|
172
|
-
}, [urls]);
|
|
171
|
+
}, [urls, loadPipesDataDispatcher]);
|
|
173
172
|
|
|
174
173
|
const feeds = useZappPipesFeeds(urls);
|
|
175
174
|
const layoutPresets = useLayoutPresets();
|
|
@@ -49,7 +49,9 @@ function getAssetValue(asset, flavour, fallbackAsset = null) {
|
|
|
49
49
|
return asset.src || fallbackAsset;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export
|
|
52
|
+
export const ActionButton = React.memo(function ActionButtonComponent(
|
|
53
|
+
props: Props
|
|
54
|
+
) {
|
|
53
55
|
const { item, action, asset, flavour = "flavour_1", cellUUID } = props;
|
|
54
56
|
const actionContext = useActions(action?.identifier);
|
|
55
57
|
|
|
@@ -120,4 +122,4 @@ export function ActionButton(props: Props) {
|
|
|
120
122
|
)}
|
|
121
123
|
</TouchableOpacity>
|
|
122
124
|
);
|
|
123
|
-
}
|
|
125
|
+
});
|
|
@@ -5,6 +5,7 @@ import { useActions } from "@applicaster/zapp-react-native-utils/reactHooks/acti
|
|
|
5
5
|
import * as R from "ramda";
|
|
6
6
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
7
7
|
import { toBooleanWithDefaultFalse } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
8
|
+
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
8
9
|
|
|
9
10
|
const { Logger } = getXray();
|
|
10
11
|
|
|
@@ -44,6 +45,11 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
44
45
|
|
|
45
46
|
const actionContext = useActions(pluginIdentifier);
|
|
46
47
|
|
|
48
|
+
const accessibilityManager = useAccessibilityManager({});
|
|
49
|
+
|
|
50
|
+
const { ttsLabel = "" } =
|
|
51
|
+
actionContext?.initialEntryState(item)?.getAccessibility?.(item) || {};
|
|
52
|
+
|
|
47
53
|
const onPress = (event) => {
|
|
48
54
|
event?.preventDefault?.();
|
|
49
55
|
|
|
@@ -88,6 +94,12 @@ export function FocusableView({ style, children, item, ...otherProps }: Props) {
|
|
|
88
94
|
mouse: focusable.mouse,
|
|
89
95
|
});
|
|
90
96
|
});
|
|
97
|
+
|
|
98
|
+
if (ttsLabel) {
|
|
99
|
+
accessibilityManager.readText({
|
|
100
|
+
text: ttsLabel,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
91
103
|
};
|
|
92
104
|
|
|
93
105
|
const handleBlur = (_focusable, _direction) => {
|
|
@@ -11,8 +11,6 @@ import { withScaledLineHeight } from "./utils";
|
|
|
11
11
|
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
12
12
|
import { MeasurementPortalContext } from "../../../MeasurmentsPortal";
|
|
13
13
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
14
|
-
import { CellStateContext } from "@applicaster/zapp-react-native-ui-components/Contexts/CellStateContext";
|
|
15
|
-
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
16
14
|
|
|
17
15
|
type Props = {
|
|
18
16
|
style: any;
|
|
@@ -37,9 +35,10 @@ const _Text = ({
|
|
|
37
35
|
}: Props) => {
|
|
38
36
|
const _label = useTextLabel({ label, entry });
|
|
39
37
|
const isMeasurement = React.useContext(MeasurementPortalContext);
|
|
40
|
-
const cellFocused = React.useContext(CellStateContext);
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
if (isNilOrEmpty(_label)) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
43
42
|
|
|
44
43
|
// set maximum possible height for the text in case of measurement
|
|
45
44
|
const height =
|
|
@@ -47,27 +46,6 @@ const _Text = ({
|
|
|
47
46
|
? toNumber(otherProps.numberOfLines) * toNumber(style.lineHeight)
|
|
48
47
|
: undefined;
|
|
49
48
|
|
|
50
|
-
const textLabel = dateTransformEnabled
|
|
51
|
-
? dateFormat(dateTransform, label)
|
|
52
|
-
: textTransform(transformText, _label);
|
|
53
|
-
|
|
54
|
-
React.useLayoutEffect(() => {
|
|
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
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, [cellFocused, otherProps.state, textLabel]);
|
|
66
|
-
|
|
67
|
-
if (isNilOrEmpty(_label)) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
49
|
return (
|
|
72
50
|
<Text
|
|
73
51
|
style={[
|
|
@@ -76,7 +54,9 @@ const _Text = ({
|
|
|
76
54
|
]}
|
|
77
55
|
{...withoutLabel(otherProps)}
|
|
78
56
|
>
|
|
79
|
-
{
|
|
57
|
+
{dateTransformEnabled
|
|
58
|
+
? dateFormat(dateTransform, label)
|
|
59
|
+
: textTransform(transformText, _label)}
|
|
80
60
|
</Text>
|
|
81
61
|
);
|
|
82
62
|
};
|