fix: add accessibilityLabel prop to back button

fixes #6895
This commit is contained in:
Satyajit Sahoo
2020-02-19 23:09:00 +01:00
parent d69b0db604
commit bf76075e0f
2 changed files with 6 additions and 3 deletions

View File

@@ -404,6 +404,10 @@ export type StackHeaderLeftButtonProps = {
* Whether it's possible to navigate back in stack.
*/
canGoBack?: boolean;
/**
* Accessibility label for the button for screen readers.
*/
accessibilityLabel?: string;
};
export type StackHeaderTitleProps = {

View File

@@ -29,6 +29,7 @@ export default function HeaderBackButton({
tintColor: customTintColor,
titleLayout,
truncatedLabel = 'Back',
accessibilityLabel = label && label !== 'Back' ? `${label}, back` : 'Go back',
}: Props) {
const { dark, colors } = useTheme();
@@ -153,9 +154,7 @@ export default function HeaderBackButton({
accessible
accessibilityRole="button"
accessibilityComponentType="button"
accessibilityLabel={
label && label !== 'Back' ? `${label}, back` : 'Go back'
}
accessibilityLabel={accessibilityLabel}
accessibilityTraits="button"
testID="header-back"
delayPressIn={0}