Skip to content

Commit 526a233

Browse files
authored
Adding accessibility support (#771)
1 parent 242968d commit 526a233

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/components/progressBar/index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,28 @@ export default class ProgressBar extends BaseComponent {
4040
progressBackgroundColor: Colors.dark10
4141
};
4242

43+
getAccessibilityProps() {
44+
const {progress} = this.props;
45+
46+
return {
47+
accessible: true,
48+
accessibilityLabel: `progress bar. ${Math.round(progress)}%`,
49+
...this.extractAccessibilityProps()
50+
};
51+
}
52+
4353
render() {
4454
const {height, backgroundColor, progressBackgroundColor, containerStyle, style} = this.props;
4555
const animatedScannerProps = AnimatedScanner.extractOwnProps(this.props);
4656
const modifiers = this.extractModifierProps();
4757

4858
return (
49-
<View height={height} {...modifiers} style={[{backgroundColor}, containerStyle]}>
59+
<View
60+
height={height}
61+
{...modifiers}
62+
style={[{backgroundColor}, containerStyle]}
63+
{...this.getAccessibilityProps()}
64+
>
5065
<AnimatedScanner
5166
{...animatedScannerProps}
5267
backgroundColor={progressBackgroundColor}

0 commit comments

Comments
 (0)