Skip to content

Picker title accessibility props #2805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/components/modal/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';
import React, {Component} from 'react';
import {StyleSheet, StyleProp, TextStyle, ImageSourcePropType} from 'react-native';
import {StyleSheet, StyleProp, TextStyle, ImageSourcePropType, AccessibilityProps} from 'react-native';
import {Constants, asBaseComponent} from '../../commons/new';
import Assets from '../../assets';
import {Colors, Typography} from '../../style';
Expand All @@ -17,6 +17,10 @@ export interface ModalTopBarProps {
* title custom style
*/
titleStyle?: StyleProp<TextStyle>;
/**
* Accessibility props for the title
*/
titleAccessibilityProps?: Omit<AccessibilityProps, 'accessible'>;
/**
* subtitle to display below the top bar title
*/
Expand Down Expand Up @@ -170,7 +174,16 @@ class TopBar extends Component<ModalTopBarProps> {
};

render() {
const {title, titleStyle, subtitle, subtitleStyle, includeStatusBar, containerStyle, useSafeArea} = this.props;
const {
title,
titleStyle,
titleAccessibilityProps,
subtitle,
subtitleStyle,
includeStatusBar,
containerStyle,
useSafeArea
} = this.props;

return (
<View style={containerStyle} useSafeArea={useSafeArea}>
Expand All @@ -181,7 +194,14 @@ class TopBar extends Component<ModalTopBarProps> {
{this.renderLeftButtons()}
</View>
<View flex-3 centerH centerV>
<Text $textDefault accessible={!!title} numberOfLines={1} text70 style={[styles.title, titleStyle]}>
<Text
$textDefault
accessible={!!title}
numberOfLines={1}
text70
style={[styles.title, titleStyle]}
{...titleAccessibilityProps}
>
{title}
</Text>
{subtitle && (
Expand Down