@applicaster/zapp-react-native-ui-components 13.0.2 → 13.0.3

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.
@@ -70,6 +70,8 @@ type State = {
70
70
  };
71
71
 
72
72
  export class CellComponent extends React.Component<Props, State> {
73
+ accessibilityManager: AccessibilityManager;
74
+
73
75
  constructor(props) {
74
76
  super(props);
75
77
  this.onPress = this.onPress.bind(this);
@@ -83,6 +85,8 @@ export class CellComponent extends React.Component<Props, State> {
83
85
  this.state = {
84
86
  hasFocusableInside: props.CellRenderer.hasFocusableInside?.(props.item),
85
87
  };
88
+
89
+ this.accessibilityManager = AccessibilityManager.getInstance();
86
90
  }
87
91
 
88
92
  setScreenLayout(componentAnchorPointY, screenLayout) {
@@ -257,20 +261,21 @@ export class CellComponent extends React.Component<Props, State> {
257
261
  style={styles.baseCell}
258
262
  isFocusable={isFocusable}
259
263
  skipFocusManagerRegistration={skipFocusManagerRegistration}
264
+ {...this.accessibilityManager.getButtonAccessibilityProps(
265
+ item?.extensions?.accessibility?.label || item?.title
266
+ )}
260
267
  >
261
268
  {(focused, event) => {
262
269
  const isFocused = this.isCellFocused(focused);
263
270
 
264
271
  if (isFocused) {
265
- const accessibilityManager = AccessibilityManager.getInstance();
266
-
267
272
  const accessibilityTitle =
268
273
  item?.extensions?.accessibility?.label || item?.title || "";
269
274
 
270
275
  const accessibilityHint =
271
276
  item?.extensions?.accessibility?.hint || "";
272
277
 
273
- accessibilityManager.readText({
278
+ this.accessibilityManager.readText({
274
279
  text: `${accessibilityTitle} ${accessibilityHint}`,
275
280
  });
276
281
  }
@@ -122,7 +122,7 @@ class Focusable extends BaseFocusable<Props> {
122
122
  }
123
123
 
124
124
  render() {
125
- const { children, style } = this.props;
125
+ const { children, style, ...otherProps } = this.props;
126
126
  const { focused } = this.state;
127
127
 
128
128
  const id = this.getId();
@@ -140,6 +140,7 @@ class Focusable extends BaseFocusable<Props> {
140
140
  data-testid={focusableId}
141
141
  focused-teststate={focused ? "focused" : "default"}
142
142
  style={style}
143
+ {...otherProps}
143
144
  >
144
145
  {children(focused, { mouse: this.mouse })}
145
146
  </div>
@@ -7,12 +7,14 @@ import {
7
7
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
8
8
  import {
9
9
  useDimensions,
10
+ useIsTablet as isTablet,
10
11
  useNavigation,
11
12
  } from "@applicaster/zapp-react-native-utils/reactHooks";
12
13
 
13
14
  import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
14
15
  import { PlayerContainer } from "../PlayerContainer";
15
16
  import { useModalSize } from "../VideoModal/hooks";
17
+ import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
16
18
 
17
19
  type Props = {
18
20
  item: ZappEntry;
@@ -83,6 +85,13 @@ type PlayableComponent = {
83
85
  Component: React.ComponentType<any>;
84
86
  };
85
87
 
88
+ const dimensionsContext: "window" | "screen" = platformSelect({
89
+ android_tv: "window",
90
+ amazon: "window",
91
+ // eslint-disable-next-line react-hooks/rules-of-hooks
92
+ default: isTablet() ? "window" : "screen", // on tablet, window represents correct values, on phone it's not as the screen could be rotated
93
+ });
94
+
86
95
  export function HandlePlayable({
87
96
  item,
88
97
  isModal,
@@ -135,7 +144,8 @@ export function HandlePlayable({
135
144
  });
136
145
  }, [casting]);
137
146
 
138
- const { width: screenWidth, height: screenHeight } = useDimensions("window");
147
+ const { width: screenWidth, height: screenHeight } =
148
+ useDimensions(dimensionsContext);
139
149
 
140
150
  const modalSize = useModalSize();
141
151
 
@@ -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": "textbox",
10
+ "accessible": true,
11
+ "aria-description": "Enter text into Search",
12
+ "aria-label": "Search",
13
+ "aria-role": "textbox",
14
+ "role": "textbox",
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 (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.2",
3
+ "version": "13.0.3",
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",
@@ -31,10 +31,10 @@
31
31
  "redux-mock-store": "^1.5.3"
32
32
  },
33
33
  "dependencies": {
34
- "@applicaster/applicaster-types": "13.0.2",
35
- "@applicaster/zapp-react-native-bridge": "13.0.2",
36
- "@applicaster/zapp-react-native-redux": "13.0.2",
37
- "@applicaster/zapp-react-native-utils": "13.0.2",
34
+ "@applicaster/applicaster-types": "13.0.3",
35
+ "@applicaster/zapp-react-native-bridge": "13.0.3",
36
+ "@applicaster/zapp-react-native-redux": "13.0.3",
37
+ "@applicaster/zapp-react-native-utils": "13.0.3",
38
38
  "promise": "^8.3.0",
39
39
  "react-router-native": "^5.1.2",
40
40
  "url": "^0.11.0",