Skip to content

Commit ec33b62

Browse files
authored
Picker title accessibility props (#2805)
* Added accesibilityRole to the picker title * Added title accessibility props
1 parent 77a7d09 commit ec33b62

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/components/modal/TopBar.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
3-
import {StyleSheet, StyleProp, TextStyle, ImageSourcePropType} from 'react-native';
3+
import {StyleSheet, StyleProp, TextStyle, ImageSourcePropType, AccessibilityProps} from 'react-native';
44
import {Constants, asBaseComponent} from '../../commons/new';
55
import Assets from '../../assets';
66
import {Colors, Typography} from '../../style';
@@ -17,6 +17,10 @@ export interface ModalTopBarProps {
1717
* title custom style
1818
*/
1919
titleStyle?: StyleProp<TextStyle>;
20+
/**
21+
* Accessibility props for the title
22+
*/
23+
titleAccessibilityProps?: Omit<AccessibilityProps, 'accessible'>;
2024
/**
2125
* subtitle to display below the top bar title
2226
*/
@@ -170,7 +174,16 @@ class TopBar extends Component<ModalTopBarProps> {
170174
};
171175

172176
render() {
173-
const {title, titleStyle, subtitle, subtitleStyle, includeStatusBar, containerStyle, useSafeArea} = this.props;
177+
const {
178+
title,
179+
titleStyle,
180+
titleAccessibilityProps,
181+
subtitle,
182+
subtitleStyle,
183+
includeStatusBar,
184+
containerStyle,
185+
useSafeArea
186+
} = this.props;
174187

175188
return (
176189
<View style={containerStyle} useSafeArea={useSafeArea}>
@@ -181,7 +194,14 @@ class TopBar extends Component<ModalTopBarProps> {
181194
{this.renderLeftButtons()}
182195
</View>
183196
<View flex-3 centerH centerV>
184-
<Text $textDefault accessible={!!title} numberOfLines={1} text70 style={[styles.title, titleStyle]}>
197+
<Text
198+
$textDefault
199+
accessible={!!title}
200+
numberOfLines={1}
201+
text70
202+
style={[styles.title, titleStyle]}
203+
{...titleAccessibilityProps}
204+
>
185205
{title}
186206
</Text>
187207
{subtitle && (

0 commit comments

Comments
 (0)