@applicaster/zapp-react-native-ui-components 14.0.0-alpha.9119252693 → 14.0.0-alpha.9256258513

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.
@@ -6,9 +6,7 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
6
6
  style={
7
7
  {
8
8
  "backgroundColor": "transparent",
9
- "height": "100%",
10
9
  "overflow": "hidden",
11
- "width": "100%",
12
10
  }
13
11
  }
14
12
  >
@@ -17,10 +15,8 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
17
15
  style={
18
16
  {
19
17
  "backgroundColor": "transparent",
20
- "height": "100%",
21
18
  "opacity": 0,
22
19
  "overflow": "hidden",
23
- "width": "100%",
24
20
  }
25
21
  }
26
22
  >
@@ -60,9 +56,7 @@ exports[`<AudioPlayerMobileLayout /> renders correctly 1`] = `
60
56
  style={
61
57
  {
62
58
  "backgroundColor": "transparent",
63
- "height": "100%",
64
59
  "overflow": "hidden",
65
- "width": "100%",
66
60
  }
67
61
  }
68
62
  />
@@ -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
  }
@@ -5,6 +5,7 @@ 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 { StyleSheet, ViewStyle } from "react-native";
8
9
 
9
10
  type Props = {
10
11
  initialFocus?: boolean;
@@ -21,7 +22,7 @@ type Props = {
21
22
  handleFocus?: ({ mouse }: { mouse: boolean }) => void;
22
23
  children: (boolean, string) => React.ComponentType<any>;
23
24
  selected?: boolean;
24
- style?: React.CSSProperties;
25
+ style?: ViewStyle[] | ViewStyle;
25
26
  };
26
27
 
27
28
  class Focusable extends BaseFocusable<Props> {
@@ -122,7 +123,7 @@ class Focusable extends BaseFocusable<Props> {
122
123
  }
123
124
 
124
125
  render() {
125
- const { children, style } = this.props;
126
+ const { children, style, ...otherProps } = this.props;
126
127
  const { focused } = this.state;
127
128
 
128
129
  const id = this.getId();
@@ -139,7 +140,8 @@ class Focusable extends BaseFocusable<Props> {
139
140
  onMouseUp={this.pressOut}
140
141
  data-testid={focusableId}
141
142
  focused-teststate={focused ? "focused" : "default"}
142
- style={style}
143
+ style={StyleSheet.flatten(style) as any as React.CSSProperties}
144
+ {...otherProps}
143
145
  >
144
146
  {children(focused, { mouse: this.mouse })}
145
147
  </div>
@@ -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 (
@@ -14,6 +14,7 @@ import {
14
14
  isAndroidVersionAtLeast,
15
15
  } from "@applicaster/zapp-react-native-utils/reactUtils";
16
16
  import { StatusBar } from "react-native";
17
+ import { isAndroidTablet } from "@applicaster/zapp-react-native-utils/reactHooks/layout/isTablet";
17
18
 
18
19
  const { Logger } = getXray();
19
20
 
@@ -32,7 +33,8 @@ const MODAL_SIZE_FOR_LANDSCAPE: Size = {
32
33
  height: "100%",
33
34
  };
34
35
 
35
- const isOldAndroidDevice = !isAndroidVersionAtLeast(35) && isAndroidPlatform();
36
+ const isOldAndroidDevice =
37
+ isAndroidPlatform() && !isAndroidVersionAtLeast(35) && !isAndroidTablet();
36
38
 
37
39
  export const useModalSize = (): Size => {
38
40
  const frame = useSafeAreaFrame();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "14.0.0-alpha.9119252693",
3
+ "version": "14.0.0-alpha.9256258513",
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": "14.0.0-alpha.9119252693",
32
- "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.9119252693",
33
- "@applicaster/zapp-react-native-redux": "14.0.0-alpha.9119252693",
34
- "@applicaster/zapp-react-native-utils": "14.0.0-alpha.9119252693",
31
+ "@applicaster/applicaster-types": "14.0.0-alpha.9256258513",
32
+ "@applicaster/zapp-react-native-bridge": "14.0.0-alpha.9256258513",
33
+ "@applicaster/zapp-react-native-redux": "14.0.0-alpha.9256258513",
34
+ "@applicaster/zapp-react-native-utils": "14.0.0-alpha.9256258513",
35
35
  "promise": "^8.3.0",
36
36
  "url": "^0.11.0",
37
37
  "uuid": "^3.3.2"
@@ -1,202 +0,0 @@
1
- import React, { useRef } from "react";
2
- import { View, ImageBackground, Animated } from "react-native";
3
-
4
- import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
5
-
6
- import { Artwork } from "./Artwork";
7
- import { directionStyles } from "./helpers";
8
-
9
- type Props = {
10
- artwork?: string;
11
- config: {
12
- titleColor: string;
13
- summaryColor: string;
14
- backgroundColor: string;
15
- backgroundImage: string;
16
- isRTL: boolean;
17
- artworkBorderRadius: Option<number>;
18
- };
19
- children: React.ReactNode;
20
- };
21
-
22
- export function AudioPlayerLayout({ artwork, config, children }: Props) {
23
- const fadeAnimation = useRef(new Animated.Value(0)).current;
24
-
25
- const fadeAudioPlayerIn = () => {
26
- Animated.timing(fadeAnimation, {
27
- toValue: 1,
28
- duration: 3000,
29
- useNativeDriver: true,
30
- }).start();
31
- };
32
-
33
- const { isRTL, backgroundColor, backgroundImage } = config;
34
-
35
- const backgroundImageSource = { uri: backgroundImage || artwork };
36
-
37
- const backgroundColorStyle = backgroundImageSource.uri
38
- ? "transparent"
39
- : backgroundColor;
40
-
41
- const mainContainerStyles = platformSelect({
42
- tvos: {
43
- width: "100%",
44
- height: "100%",
45
- alignItems: "center",
46
- justifyContent: "center",
47
- flexDirection: directionStyles(isRTL).flexDirection,
48
- backgroundColor: backgroundColorStyle,
49
- },
50
- android_tv: {
51
- width: "100%",
52
- height: "100%",
53
- alignItems: "center",
54
- justifyContent: "center",
55
- flexDirection: directionStyles(isRTL).flexDirection,
56
- backgroundColor: backgroundColorStyle,
57
- },
58
- web: {
59
- width: 1920,
60
- height: 1080,
61
- alignItems: "center",
62
- justifyContent: "center",
63
- flexDirection: directionStyles(isRTL).flexDirection,
64
- backgroundColor: backgroundColorStyle,
65
- },
66
- native: {
67
- backgroundColor: backgroundColorStyle,
68
- overflow: "hidden",
69
- width: "100%",
70
- height: "100%",
71
- },
72
- samsung_tv: {
73
- position: "absolute",
74
- margin: "auto",
75
- display: "flex",
76
- flexWrap: "wrap",
77
- width: "100vw",
78
- flex: 1,
79
- alignItems: "center",
80
- justifyContent: "center",
81
- flexDirection: directionStyles(isRTL).flexDirection,
82
- backgroundColor: backgroundColorStyle,
83
- },
84
- lg_tv: {
85
- position: "absolute",
86
- margin: "auto",
87
- display: "flex",
88
- flexWrap: "wrap",
89
- width: "100vw",
90
- flex: 1,
91
- alignItems: "center",
92
- justifyContent: "center",
93
- flexDirection: directionStyles(isRTL).flexDirection,
94
- backgroundColor: backgroundColorStyle,
95
- },
96
- });
97
-
98
- const backgroundImgStyles = platformSelect({
99
- tvos: {
100
- width: "100%",
101
- height: "100%",
102
- alignItems: "center",
103
- justifyContent: "center",
104
- },
105
- android_tv: {
106
- width: "100%",
107
- height: "100%",
108
- alignItems: "center",
109
- justifyContent: "center",
110
- },
111
- web: {
112
- position: "absolute",
113
- margin: "auto",
114
- display: "flex",
115
- flexWrap: "wrap",
116
- width: "100%",
117
- height: "100%",
118
- flex: 1,
119
- alignItems: "center",
120
- justifyContent: "center",
121
- },
122
- native: {
123
- flex: 1,
124
- },
125
- });
126
-
127
- const textContainerStyles = platformSelect({
128
- tvos: {
129
- width: 600,
130
- height: 362,
131
- marginHorizontal: 24,
132
- alignItems: directionStyles(isRTL).justifyContent,
133
- },
134
- android_tv: {
135
- width: 600,
136
- height: 362,
137
- marginHorizontal: 24,
138
- alignItems: directionStyles(isRTL).justifyContent,
139
- },
140
- web: {
141
- margin: 10,
142
- height: "100vh",
143
- alignItems: directionStyles(isRTL).justifyContent,
144
- justifyContent: "center",
145
- },
146
- });
147
-
148
- const audioPlayerLayoutTV = backgroundImageSource?.uri ? (
149
- <ImageBackground
150
- source={backgroundImageSource}
151
- style={backgroundImgStyles}
152
- resizeMode="cover"
153
- >
154
- <View style={mainContainerStyles}>
155
- {!!artwork && <Artwork srcImage={artwork} config={config} />}
156
- <View style={textContainerStyles}>{children}</View>
157
- </View>
158
- </ImageBackground>
159
- ) : (
160
- <View style={mainContainerStyles}>
161
- {!!artwork && <Artwork srcImage={artwork} config={config} />}
162
- <View style={textContainerStyles}>{children}</View>
163
- </View>
164
- );
165
-
166
- const audioPlayerLayoutMobile = () => {
167
- fadeAudioPlayerIn();
168
-
169
- return (
170
- <View style={mainContainerStyles} pointerEvents="none">
171
- <Animated.View
172
- style={[
173
- mainContainerStyles,
174
- {
175
- opacity: fadeAnimation,
176
- },
177
- ]}
178
- >
179
- <ImageBackground
180
- source={backgroundImageSource}
181
- style={backgroundImgStyles}
182
- resizeMode="cover"
183
- >
184
- <View style={mainContainerStyles} />
185
- </ImageBackground>
186
- </Animated.View>
187
- </View>
188
- );
189
- };
190
-
191
- const audioPlayerLayout = platformSelect({
192
- tvos: audioPlayerLayoutTV,
193
- android_tv: audioPlayerLayoutTV,
194
- web: audioPlayerLayoutTV,
195
- samsung_tv: audioPlayerLayoutTV,
196
- lg_tv: audioPlayerLayoutTV,
197
- ios: audioPlayerLayoutMobile(),
198
- android: audioPlayerLayoutMobile(),
199
- });
200
-
201
- return audioPlayerLayout;
202
- }